fix: redesign
This commit is contained in:
+20
-5
@@ -1,19 +1,34 @@
|
||||
'use client';
|
||||
|
||||
import { AuthProvider } from '@/contexts/AuthContext';
|
||||
import ThemeToggle from '@/components/ThemeToggle';
|
||||
import AuthGuard from '@/components/AuthGuard';
|
||||
import Sidebar from '@/components/admin/Sidebar';
|
||||
import ToastContainer from '@/components/Toast';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
export default function AdminLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
const isLogin = pathname === '/admin/login' || pathname === '/admin/login/';
|
||||
|
||||
return (
|
||||
<AuthProvider>
|
||||
<div className="min-h-screen bg-gray-100 dark:bg-gray-950">
|
||||
{children}
|
||||
<ThemeToggle floating />
|
||||
<div className="min-h-screen bg-gray-50 dark:bg-gray-950">
|
||||
<ToastContainer />
|
||||
{isLogin ? (
|
||||
children
|
||||
) : (
|
||||
<AuthGuard>
|
||||
<Sidebar />
|
||||
<main className="lg:pr-64 min-h-screen">
|
||||
{children}
|
||||
</main>
|
||||
</AuthGuard>
|
||||
)}
|
||||
</div>
|
||||
</AuthProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user