From 9d0e299e3827b38f7ef558c135e45836eb8b969f Mon Sep 17 00:00:00 2001 From: Furqan-14 Date: Mon, 2 Feb 2026 23:06:31 +0530 Subject: [PATCH 1/2] fix: arabic lang issues --- .../Authentication/Components/SignUpForm.tsx | 3 - src/application/dashboard/Dashboard.tsx | 20 +++--- .../modules/admin/components/ModuleList.tsx | 10 +-- .../theme/components/AllPalettes.tsx | 36 +++++----- .../theme/components/PaletteForm.tsx | 68 ++++++++++--------- src/components/layout/AppHeader.tsx | 6 +- src/components/layout/AppSidebar.tsx | 17 +++-- src/i18n/config.ts | 5 ++ src/i18n/locales/ar/common.json | 3 +- src/i18n/locales/ar/dashboard.json | 9 ++- src/i18n/locales/ar/modules.json | 29 +++++--- src/i18n/locales/ar/theme.json | 67 ++++++++++++++++++ src/i18n/locales/en/dashboard.json | 8 ++- src/i18n/locales/en/modules.json | 11 ++- src/i18n/locales/en/theme.json | 67 ++++++++++++++++++ 15 files changed, 268 insertions(+), 91 deletions(-) create mode 100644 src/i18n/locales/ar/theme.json create mode 100644 src/i18n/locales/en/theme.json diff --git a/src/application/Authentication/Components/SignUpForm.tsx b/src/application/Authentication/Components/SignUpForm.tsx index 78a1f92..4fc8137 100644 --- a/src/application/Authentication/Components/SignUpForm.tsx +++ b/src/application/Authentication/Components/SignUpForm.tsx @@ -21,7 +21,6 @@ export default function SignUpForm() { setIsLoading(true); if (!isChecked) { - // Require terms acceptance before sending the signup request. setErrorMessage("Please accept the terms and conditions to continue."); setIsLoading(false); return; @@ -35,10 +34,8 @@ export default function SignUpForm() { }; try { - // Call the backend signup API. await authApi.signup(payload); - // Signup does not return tokens, so take the user to signin. navigate("/signin"); } catch (error) { const message = diff --git a/src/application/dashboard/Dashboard.tsx b/src/application/dashboard/Dashboard.tsx index ab3e433..109ef03 100644 --- a/src/application/dashboard/Dashboard.tsx +++ b/src/application/dashboard/Dashboard.tsx @@ -3,9 +3,11 @@ import axios from 'axios'; import { ExternalLink, Box, Search, Rocket } from 'lucide-react'; import { moduleApi, type Module } from '../modules/user/UserModuleApi'; import { useAuth } from '../../context/AuthContext'; +import { useTranslation } from 'react-i18next'; const Dashboard = () => { const { user } = useAuth(); + const { t } = useTranslation(['dashboard', 'common']); const [modules, setModules] = useState([]); const [loading, setLoading] = useState(true); @@ -54,7 +56,7 @@ const Dashboard = () => { if (filtered.length === 0) return {}; filtered.forEach(module => { - const category = module.category || 'All Modules'; + const category = module.category || t('dashboard:allModules'); if (!groups[category]) { groups[category] = []; } @@ -68,7 +70,7 @@ const Dashboard = () => { }, {} as Record ); - }, [modules, searchTerm]); + }, [modules, searchTerm, t]); return (
@@ -76,10 +78,10 @@ const Dashboard = () => {

- Welcome back, {user?.first_name || 'Admin'}! 👋 + {t('dashboard:title')}, {user?.first_name || 'Admin'}! 👋

- Manage your SaaS ecosystem from one central hub. + {t('dashboard:subtitle')}

@@ -90,7 +92,7 @@ const Dashboard = () => {
setSearchTerm(e.target.value)} className="block w-full pl-10 pr-3 py-2.5 bg-white border border-gray-200 rounded-xl leading-5 text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all shadow-sm hover:shadow-md" @@ -160,7 +162,7 @@ const Dashboard = () => { className="w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-gray-50 hover:bg-blue-600 text-gray-700 hover:text-white rounded-xl font-medium transition-all duration-200 group-hover:shadow-md" > - Launch Module + {t('dashboard:actions.launch')}
@@ -173,16 +175,16 @@ const Dashboard = () => {
-

No modules found

+

{t('common:common.noData')}

- {searchTerm ? `No results found for "${searchTerm}". Try a different keyword.` : "Your dashboard is currently empty. Contact your administrator to assign modules."} + {searchTerm ? t('common:common.noData') : "Your dashboard is currently empty. Contact your administrator to assign modules."}

{searchTerm && ( )} diff --git a/src/application/modules/admin/components/ModuleList.tsx b/src/application/modules/admin/components/ModuleList.tsx index 7b69f6a..51ab81b 100644 --- a/src/application/modules/admin/components/ModuleList.tsx +++ b/src/application/modules/admin/components/ModuleList.tsx @@ -10,7 +10,7 @@ import CustomButton from '../../../../components/custom/CustomButton'; const ModuleList = () => { const navigate = useNavigate(); - const { t } = useTranslation('modules'); + const { t } = useTranslation(['modules', 'common']); const { listModules, deleteModule, loading } = useModuleApi(); const [modules, setModules] = useState([]); const [showForm, setShowForm] = useState(false); @@ -125,14 +125,14 @@ const ModuleList = () => { className="flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors text-sm text-(--text-primary)" > - Environments + {t('registry.card.environments')} @@ -142,14 +142,14 @@ const ModuleList = () => { className="flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-blue-50 hover:bg-blue-100 text-blue-600 rounded-lg transition-colors text-sm" > - Edit + {t('common:actions.edit')} diff --git a/src/application/theme/components/AllPalettes.tsx b/src/application/theme/components/AllPalettes.tsx index c5fba33..a07bf88 100644 --- a/src/application/theme/components/AllPalettes.tsx +++ b/src/application/theme/components/AllPalettes.tsx @@ -9,8 +9,10 @@ import { paletteApi } from "../PaletteApi"; import type { ColorPalette } from "../ThemeTypes"; import PaletteForm from "./PaletteForm"; import { useTheme } from "../../../context/ThemeContext"; +import { useTranslation } from "react-i18next"; const AllPalettes: React.FC = () => { + const { t } = useTranslation(['theme', 'common']); const [palettes, setPalettes] = useState([]); const [isLoading, setIsLoading] = useState(false); const [errorMessage, setErrorMessage] = useState(""); @@ -25,7 +27,7 @@ const AllPalettes: React.FC = () => { const data = await paletteApi.getAllPalettes(); setPalettes(data); } catch (error) { - const message = error instanceof Error ? error.message : "Failed to fetch palettes"; + const message = error instanceof Error ? error.message : t('theme:errors.fetchFailed'); setErrorMessage(message); console.error("Failed to fetch palettes", error); } finally { @@ -48,10 +50,10 @@ const AllPalettes: React.FC = () => { }; const handleDelete = async (id: string) => { - if (!window.confirm("Are you sure you want to delete this palette?")) return; + if (!window.confirm(t('theme:confirmDelete'))) return; try { await paletteApi.deletePalette(id); - toast.success("Palette deleted successfully"); + toast.success(t('theme:success.deleted')); fetchPalettes(); } catch (error) { // toast handled by api client @@ -63,10 +65,10 @@ const AllPalettes: React.FC = () => { try { if (editingPalette) { await paletteApi.updatePalette(editingPalette.id, data); - toast.success("Palette updated successfully"); + toast.success(t('theme:success.updated')); } else { await paletteApi.createPalette(data); - toast.success("Palette created successfully"); + toast.success(t('theme:success.created')); } setIsModalOpen(false); fetchPalettes(); @@ -81,7 +83,7 @@ const AllPalettes: React.FC = () => { () => [ { key: "name", - header: "Name", + header: t('theme:table.name'), searchable: true, render: (row) => (
@@ -94,43 +96,43 @@ const AllPalettes: React.FC = () => { }, { key: "is_default", - header: "Default", + header: t('theme:table.default'), render: (row) => ( row.is_default ? ( - + ) : null ), }, { key: "colors", - header: "Preview", + header: t('theme:table.preview'), render: (row) => (
), }, { key: "actions", - header: "Actions", + header: t('common:columns.actions'), render: (row) => ( handleEdit(row)}> - Edit Palette + {t('theme:actions.edit')} { } }} > - Delete Palette + {t('theme:actions.delete')}
@@ -160,13 +162,13 @@ const AllPalettes: React.FC = () => {
-

Theme Palettes

+

{t('theme:title')}

{/*

Manage system color themes and default palettes.

*/}
}> - Create Palette + {t('theme:actions.create')}
diff --git a/src/application/theme/components/PaletteForm.tsx b/src/application/theme/components/PaletteForm.tsx index 84eb781..bb8a0e4 100644 --- a/src/application/theme/components/PaletteForm.tsx +++ b/src/application/theme/components/PaletteForm.tsx @@ -1,6 +1,7 @@ import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { Check } from "lucide-react"; +import { useTranslation } from "react-i18next"; import CustomModal from "../../../components/custom/CustomModal"; import CustomInput from "../../../components/custom/CustomInput"; import {CustomButton} from "../../../components/custom"; @@ -15,27 +16,27 @@ interface PaletteFormProps { } const colorFields = [ - { label: "Primary Color", key: "primary" }, - { label: "Primary Hover", key: "primary_hover" }, - { label: "Sidebar Background", key: "sidebar_bg" }, - { label: "Sidebar Text", key: "sidebar_text" }, - { label: "Sidebar Text Muted", key: "sidebar_text_muted" }, - { label: "Sidebar Active BG", key: "sidebar_active_bg" }, - { label: "Sidebar Active Text", key: "sidebar_active_text" }, - { label: "Sidebar Hover BG", key: "sidebar_hover_bg" }, - { label: "Sidebar Border", key: "sidebar_border" }, - { label: "Header Background", key: "header_bg" }, - { label: "Header Text", key: "header_text" }, - { label: "Header Border", key: "header_border" }, - { label: "App Background", key: "background" }, - { label: "App Secondary BG", key: "background_secondary" }, - { label: "Text Primary", key: "text_primary" }, - { label: "Text Secondary", key: "text_secondary" }, - { label: "Card Background", key: "card_bg" }, - { label: "Card Border", key: "card_border" }, - { label: "Table Header BG", key: "table_header_bg" }, - { label: "Table Row Hover", key: "table_row_hover" }, - { label: "Table Border", key: "table_border" }, + { key: "primary" }, + { key: "primary_hover" }, + { key: "sidebar_bg" }, + { key: "sidebar_text" }, + { key: "sidebar_text_muted" }, + { key: "sidebar_active_bg" }, + { key: "sidebar_active_text" }, + { key: "sidebar_hover_bg" }, + { key: "sidebar_border" }, + { key: "header_bg" }, + { key: "header_text" }, + { key: "header_border" }, + { key: "background" }, + { key: "background_secondary" }, + { key: "text_primary" }, + { key: "text_secondary" }, + { key: "card_bg" }, + { key: "card_border" }, + { key: "table_header_bg" }, + { key: "table_row_hover" }, + { key: "table_border" }, ]; const emptyColors = colorFields.reduce((acc, field) => { @@ -50,6 +51,7 @@ const PaletteForm: React.FC = ({ isLoading, isOpen, }) => { + const { t } = useTranslation(['theme', 'common']); const { register, handleSubmit, @@ -96,7 +98,7 @@ const PaletteForm: React.FC = ({ onClick={onCancel} disabled={isLoading} > - Cancel + {t('theme:actions.cancel')} = ({ loading={isLoading} leftIcon={} > - {initialData ? "Update Palette" : "Create Palette"} + {initialData ? t('theme:actions.update') : t('theme:actions.create')}
); @@ -114,7 +116,7 @@ const PaletteForm: React.FC = ({ @@ -126,15 +128,15 @@ const PaletteForm: React.FC = ({ >
@@ -146,13 +148,13 @@ const PaletteForm: React.FC = ({ className="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" />

- Color Configuration + {t('theme:form.fields.sectionTitle')}

@@ -175,9 +177,9 @@ const PaletteForm: React.FC = ({ /> {
{/* RIGHT: Actions */} -
+
{/* User Menu */}
@@ -144,7 +144,7 @@ const AppHeader: React.FC = () => { {initials}
-
+

{fullName}

@@ -159,7 +159,7 @@ const AppHeader: React.FC = () => { {isUserMenuOpen && (
Date: Mon, 2 Feb 2026 23:09:35 +0530 Subject: [PATCH 2/2] Fix authentication folder casing to lowercase --- src/application/{Authentication => authentication}/AuthApi.ts | 0 src/application/{Authentication => authentication}/AuthTypes.ts | 0 .../Components/ResetPasswordForm.tsx | 0 .../{Authentication => authentication}/Components/SignInForm.tsx | 0 .../{Authentication => authentication}/Components/SignUpForm.tsx | 0 .../{Authentication => authentication}/ResetPasswordPage.tsx | 0 src/application/{Authentication => authentication}/SignInPage.tsx | 0 src/application/{Authentication => authentication}/SignUpPage.tsx | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename src/application/{Authentication => authentication}/AuthApi.ts (100%) rename src/application/{Authentication => authentication}/AuthTypes.ts (100%) rename src/application/{Authentication => authentication}/Components/ResetPasswordForm.tsx (100%) rename src/application/{Authentication => authentication}/Components/SignInForm.tsx (100%) rename src/application/{Authentication => authentication}/Components/SignUpForm.tsx (100%) rename src/application/{Authentication => authentication}/ResetPasswordPage.tsx (100%) rename src/application/{Authentication => authentication}/SignInPage.tsx (100%) rename src/application/{Authentication => authentication}/SignUpPage.tsx (100%) diff --git a/src/application/Authentication/AuthApi.ts b/src/application/authentication/AuthApi.ts similarity index 100% rename from src/application/Authentication/AuthApi.ts rename to src/application/authentication/AuthApi.ts diff --git a/src/application/Authentication/AuthTypes.ts b/src/application/authentication/AuthTypes.ts similarity index 100% rename from src/application/Authentication/AuthTypes.ts rename to src/application/authentication/AuthTypes.ts diff --git a/src/application/Authentication/Components/ResetPasswordForm.tsx b/src/application/authentication/Components/ResetPasswordForm.tsx similarity index 100% rename from src/application/Authentication/Components/ResetPasswordForm.tsx rename to src/application/authentication/Components/ResetPasswordForm.tsx diff --git a/src/application/Authentication/Components/SignInForm.tsx b/src/application/authentication/Components/SignInForm.tsx similarity index 100% rename from src/application/Authentication/Components/SignInForm.tsx rename to src/application/authentication/Components/SignInForm.tsx diff --git a/src/application/Authentication/Components/SignUpForm.tsx b/src/application/authentication/Components/SignUpForm.tsx similarity index 100% rename from src/application/Authentication/Components/SignUpForm.tsx rename to src/application/authentication/Components/SignUpForm.tsx diff --git a/src/application/Authentication/ResetPasswordPage.tsx b/src/application/authentication/ResetPasswordPage.tsx similarity index 100% rename from src/application/Authentication/ResetPasswordPage.tsx rename to src/application/authentication/ResetPasswordPage.tsx diff --git a/src/application/Authentication/SignInPage.tsx b/src/application/authentication/SignInPage.tsx similarity index 100% rename from src/application/Authentication/SignInPage.tsx rename to src/application/authentication/SignInPage.tsx diff --git a/src/application/Authentication/SignUpPage.tsx b/src/application/authentication/SignUpPage.tsx similarity index 100% rename from src/application/Authentication/SignUpPage.tsx rename to src/application/authentication/SignUpPage.tsx