2024-11-02 07:15:56 +09:00
|
|
|
// src/app/(admin)/layout.tsx
|
2024-11-02 18:01:31 +09:00
|
|
|
import { useAuth } from "@/hooks/useAuth";
|
|
|
|
// import { SideNav } from '@/components/layout/SideNav';
|
|
|
|
import { AdminSidebar } from "@/components/admin/AdminSidebar";
|
|
|
|
import { TopNav } from "@/components/layout/TopNav";
|
2024-11-02 07:15:56 +09:00
|
|
|
|
|
|
|
export default function AdminLayout({
|
|
|
|
children,
|
|
|
|
}: {
|
|
|
|
children: React.ReactNode;
|
|
|
|
}) {
|
2024-11-02 18:01:31 +09:00
|
|
|
const { user } = useAuth();
|
|
|
|
const isAdmin =
|
|
|
|
user?.role === "super_admin" || user?.role === "company_admin";
|
|
|
|
|
|
|
|
if (!isAdmin) {
|
|
|
|
return <div>접근 권한이 없습니다.</div>;
|
|
|
|
}
|
|
|
|
|
2024-11-02 07:15:56 +09:00
|
|
|
return (
|
|
|
|
<div className="min-h-screen flex">
|
2024-11-02 18:01:31 +09:00
|
|
|
<AdminSidebar />
|
2024-11-02 07:15:56 +09:00
|
|
|
<div className="flex-1">
|
|
|
|
<TopNav />
|
|
|
|
<main className="p-6">{children}</main>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2024-11-02 18:01:31 +09:00
|
|
|
}
|