diff --git a/content/i18n/ru.json b/content/i18n/ru.json index 8f75c05..8163927 100644 --- a/content/i18n/ru.json +++ b/content/i18n/ru.json @@ -1,10 +1,10 @@ { - "common": { - "greeting": "Здравей", - "farewell": "Довиждане", - "changeTo": "Смени на", - "BG": "[RU] Български", - "EN": "[RU] Английски", - "RU": "[RU] Руски" - } + "common": { + "greeting": "Здравей", + "farewell": "Довиждане", + "changeTo": "Смени на", + "BG": "[RU] Български", + "EN": "[RU] Английски", + "RU": "[RU] Руски" + } } \ No newline at end of file diff --git a/pages/cart/translations/index.tsx b/pages/cart/translations/index.tsx index dac44fe..c34c2e6 100644 --- a/pages/cart/translations/index.tsx +++ b/pages/cart/translations/index.tsx @@ -4,6 +4,7 @@ import ProtectedRoute from "../../../components/protectedRoute"; import { UserRole } from "@prisma/client"; import Layout from 'components/layout'; import { useRouter } from "next/router"; +import { ToastContainer, toast } from 'react-toastify'; const locales = ['bg', 'en', 'ru']; @@ -21,12 +22,15 @@ const AdminTranslations = () => { }, [locale]); const handleSave = () => { - axiosInstance.post(`/api/translations/${locale}/modified`, translations) + axiosInstance.post(`/api/translations/${locale}`, translations) .then(res => { if (res.data.status === 'Updated') { - alert('Translations updated!'); + toast.success('Translations updated!'); + } else { + toast.error('Something went wrong!'); } - }); + }) + .catch(err => toast.error('Failed to update translations: ' + err.message)); }; const handleChange = (key, value) => { @@ -37,19 +41,30 @@ const AdminTranslations = () => {
-

Edit Translations

-
- - +
+
+

Edit Translations

+
+ +
+ +
+
+
@@ -71,20 +86,22 @@ const AdminTranslations = () => { value={translations[key] || ''} placeholder='Въведи превод...' onChange={e => handleChange(key, e.target.value)} - className="block w-full text-base px-2 py-1 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 rounded" + className="block w-full text-base px-2 py-1 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 rounded placeholder-gray-400" + style={{ transition: 'box-shadow .3s', boxShadow: translations[key] ? '0 0 0px 1px rgba(59, 130, 246, 0.5)' : 'none' }} /> + ))}
- + */}