From 9ae0f6342407aaa3ba99e1242c82ad28577f8c96 Mon Sep 17 00:00:00 2001 From: mengstabketemaw Date: Tue, 16 Jun 2026 11:40:38 +0300 Subject: [PATCH] backoffice i18n config --- apps/backoffice/src/app/i18n/locales/am.ts | 2 + apps/backoffice/src/app/i18n/locales/en.ts | 2 + .../src/app/layouts/BackofficeLayout.tsx | 8 +- .../src/app/layouts/components/AppSidebar.tsx | 84 ++++++++++--------- 4 files changed, 53 insertions(+), 43 deletions(-) diff --git a/apps/backoffice/src/app/i18n/locales/am.ts b/apps/backoffice/src/app/i18n/locales/am.ts index b9922ace5..2ee6430c4 100644 --- a/apps/backoffice/src/app/i18n/locales/am.ts +++ b/apps/backoffice/src/app/i18n/locales/am.ts @@ -29,6 +29,8 @@ export const am: Translations = { home: 'መነሻ', notifications: 'ማሳወቂያዎች', administrator: 'አስተዳዳሪ', + collapse: 'ሰብስብ', + expand: 'ዘርጋ', }, breadcrumbs: { diff --git a/apps/backoffice/src/app/i18n/locales/en.ts b/apps/backoffice/src/app/i18n/locales/en.ts index fee962d38..b0d4106a7 100644 --- a/apps/backoffice/src/app/i18n/locales/en.ts +++ b/apps/backoffice/src/app/i18n/locales/en.ts @@ -27,6 +27,8 @@ export const en = { home: 'Home', notifications: 'Notifications', administrator: 'Administrator', + collapse: 'Collapse', + expand: 'Expand', }, breadcrumbs: { diff --git a/apps/backoffice/src/app/layouts/BackofficeLayout.tsx b/apps/backoffice/src/app/layouts/BackofficeLayout.tsx index a3a3ab54c..3c9592a36 100644 --- a/apps/backoffice/src/app/layouts/BackofficeLayout.tsx +++ b/apps/backoffice/src/app/layouts/BackofficeLayout.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { AppShell } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; import { Outlet } from 'react-router-dom'; @@ -6,11 +7,14 @@ import { AppSidebar } from './components/AppSidebar'; export function BackofficeLayout() { const [opened, { toggle }] = useDisclosure(); + const [collapsed, setCollapsed] = useState(false); + + const handleToggleCollapse = () => setCollapsed((prev) => !prev); return ( @@ -18,7 +22,7 @@ export function BackofficeLayout() { - + diff --git a/apps/backoffice/src/app/layouts/components/AppSidebar.tsx b/apps/backoffice/src/app/layouts/components/AppSidebar.tsx index 6533e9c15..a27dc86fe 100644 --- a/apps/backoffice/src/app/layouts/components/AppSidebar.tsx +++ b/apps/backoffice/src/app/layouts/components/AppSidebar.tsx @@ -1,7 +1,6 @@ import { useTranslation } from 'react-i18next'; import { AppShell, - Box, Group, NavLink, ScrollArea, @@ -15,23 +14,21 @@ import { IconLayoutDashboard, IconUsers, IconShieldCheck, - IconLogout, + IconChevronLeft, + IconChevronRight, } from '@tabler/icons-react'; import { useNavigate, useLocation } from 'react-router-dom'; -import { useDispatch } from 'react-redux'; -import { logout } from '@ema-platform/auth'; -export function AppSidebar() { +interface AppSidebarProps { + collapsed: boolean; + onToggleCollapse: () => void; +} + +export function AppSidebar({ collapsed, onToggleCollapse }: AppSidebarProps) { const { t } = useTranslation(); const navigate = useNavigate(); - const dispatch = useDispatch(); const { pathname } = useLocation(); - const handleLogout = () => { - dispatch(logout()); - navigate('/login'); - }; - return ( <> @@ -39,73 +36,78 @@ export function AppSidebar() { -
- - {t('app.name')} - - - {t('app.tagline')} - -
+ {!collapsed && ( +
+ + {t('app.name')} + + + {t('app.tagline')} + +
+ )}
- - {t('nav.menu')} - + {!collapsed && ( + + {t('nav.menu')} + + )} } active={pathname.startsWith('/dashboard')} onClick={() => navigate('/dashboard')} variant="light" color="blue" - styles={{ root: { borderRadius: rem(10) }, label: { fontWeight: 500 } }} + styles={{ + root: { borderRadius: rem(10) }, + label: { fontWeight: 500, display: collapsed ? 'none' : 'block' }, + }} /> } active={pathname.startsWith('/um')} onClick={() => navigate('/um/user-management/dashboard')} variant="light" color="blue" - styles={{ root: { borderRadius: rem(10) }, label: { fontWeight: 500 } }} + styles={{ + root: { borderRadius: rem(10) }, + label: { fontWeight: 500, display: collapsed ? 'none' : 'block' }, + }} /> - - AD - - - - Amanuel D. + {!collapsed && ( + + {t('common.collapse')} - - {t('common.administrator')} - - + )} - + {collapsed ? : }