From 03ec18c5e61bf816adf533e483f3d8fbe219a0f4 Mon Sep 17 00:00:00 2001 From: yotakii Date: Mon, 2 Mar 2026 14:35:36 +0300 Subject: [PATCH] fix layout --- frontend/src/app/admin/layout.tsx | 48 ++++----- frontend/src/app/layout.tsx | 173 +++++++++++------------------- 2 files changed, 79 insertions(+), 142 deletions(-) diff --git a/frontend/src/app/admin/layout.tsx b/frontend/src/app/admin/layout.tsx index 67e9127..f07285f 100644 --- a/frontend/src/app/admin/layout.tsx +++ b/frontend/src/app/admin/layout.tsx @@ -1,8 +1,7 @@ 'use client' -import dynamic from 'next/dynamic' import ProtectedRoute from '@/components/ProtectedRoute' -import { AuthProvider, useAuth } from '@/contexts/AuthContext' +import { useAuth } from '@/contexts/AuthContext' import Link from 'next/link' import { usePathname } from 'next/navigation' import { @@ -17,8 +16,7 @@ import { Clock, Building2, LogOut, - LayoutDashboard, - Users2 + LayoutDashboard } from 'lucide-react' function AdminLayoutContent({ children }: { children: React.ReactNode }) { @@ -29,7 +27,6 @@ function AdminLayoutContent({ children }: { children: React.ReactNode }) { { icon: LayoutDashboard, label: 'لوحة التحكم', href: '/admin', exact: true }, { icon: Users, label: 'إدارة المستخدمين', href: '/admin/users' }, { icon: Shield, label: 'الأدوار والصلاحيات', href: '/admin/roles' }, - { icon: Users2, label: 'مجموعات الصلاحيات', href: '/admin/permission-groups' }, { icon: Database, label: 'النسخ الاحتياطي', href: '/admin/backup' }, { icon: Settings, label: 'إعدادات النظام', href: '/admin/settings' }, { icon: FileText, label: 'سجل العمليات', href: '/admin/audit-logs' }, @@ -40,7 +37,9 @@ function AdminLayoutContent({ children }: { children: React.ReactNode }) { ] const isActive = (href: string, exact?: boolean) => { - if (exact) return pathname === href + if (exact) { + return pathname === href + } return pathname.startsWith(href) } @@ -58,7 +57,6 @@ function AdminLayoutContent({ children }: { children: React.ReactNode }) {

System Admin

-

{user?.username}

{user?.role?.name}

@@ -74,7 +72,9 @@ function AdminLayoutContent({ children }: { children: React.ReactNode }) { key={item.href} href={item.href} className={`flex items-center gap-3 px-4 py-3 rounded-lg mb-2 transition-all ${ - active ? 'bg-red-600 text-white shadow-md' : 'text-gray-700 hover:bg-gray-100' + active + ? 'bg-red-600 text-white shadow-md' + : 'text-gray-700 hover:bg-gray-100' }`} > @@ -104,30 +104,18 @@ function AdminLayoutContent({ children }: { children: React.ReactNode }) { {/* Main Content */} -
{children}
+
+ {children} +
) } - -const AdminLayoutClient = dynamic( - () => - Promise.resolve(function AdminLayoutClient({ - children - }: { - children: React.ReactNode - }) { - return ( - - - {children} - - - ) - }), - { ssr: false } -) - export default function AdminLayout({ children }: { children: React.ReactNode }) { - return {children} -} \ No newline at end of file + return ( + + {children} + + ) +} + diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index c30bc2e..e2031b8 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,120 +1,69 @@ -'use client' +import type { Metadata } from 'next' +import { Cairo, Readex_Pro } from 'next/font/google' +import './globals.css' +import { Providers } from './providers' +import { AuthProvider } from '@/contexts/AuthContext' +import { LanguageProvider } from '@/contexts/LanguageContext' +import { Toaster } from 'react-hot-toast' -import ProtectedRoute from '@/components/ProtectedRoute' -import { useAuth } from '@/contexts/AuthContext' -import Link from 'next/link' -import { usePathname } from 'next/navigation' -import { - Users, - Shield, - Database, - Settings, - FileText, - Activity, - Mail, - Key, - Clock, - Building2, - LogOut, - LayoutDashboard, - Users2 -} from 'lucide-react' +const cairo = Cairo({ + subsets: ['latin', 'arabic'], + variable: '--font-cairo', + display: 'swap', +}) -function AdminLayoutContent({ children }: { children: React.ReactNode }) { - const { user, logout } = useAuth() - const pathname = usePathname() +const readexPro = Readex_Pro({ + subsets: ['latin', 'arabic'], + variable: '--font-readex', + display: 'swap', +}) - const menuItems = [ - { icon: LayoutDashboard, label: 'لوحة التحكم', href: '/admin', exact: true }, - { icon: Users, label: 'إدارة المستخدمين', href: '/admin/users' }, - { icon: Shield, label: 'الأدوار والصلاحيات', href: '/admin/roles' }, - { icon: Users2, label: 'مجموعات الصلاحيات', href: '/admin/permission-groups' }, - { icon: Database, label: 'النسخ الاحتياطي', href: '/admin/backup' }, - { icon: Settings, label: 'إعدادات النظام', href: '/admin/settings' }, - { icon: FileText, label: 'سجل العمليات', href: '/admin/audit-logs' }, - { icon: Activity, label: 'صحة النظام', href: '/admin/health' }, - { icon: Mail, label: 'إعدادات البريد', href: '/admin/email' }, - { icon: Key, label: 'مفاتيح API', href: '/admin/api-keys' }, - { icon: Clock, label: 'المهام المجدولة', href: '/admin/scheduled-jobs' } - ] - - const isActive = (href: string, exact?: boolean) => { - if (exact) { - return pathname === href - } - return pathname.startsWith(href) - } +export const metadata: Metadata = { + title: 'Z.CRM - نظام إدارة علاقات العملاء', + description: 'Enterprise CRM System for Contact Management, Sales, HR, Inventory, Projects, and Marketing', +} +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { return ( -
- - -
- {children} -
-
+ + + + + {children} + + + + + ) } -export default function AdminLayout({ children }: { children: React.ReactNode }) { - return ( - - {children} - - ) -} \ No newline at end of file