2024-11-10 23:12:38 +01:00
|
|
|
import React from "react";
|
|
|
|
|
import {redirect} from "next/navigation";
|
|
|
|
|
|
|
|
|
|
import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
|
2024-11-10 09:34:27 +01:00
|
|
|
import {AppSidebar} from "@/components/wrappers/Dashboard/SideBar/app-sidebar";
|
2024-11-09 21:38:18 +01:00
|
|
|
import {currentUser} from "@/auth/current-user";
|
2024-11-10 11:01:59 +01:00
|
|
|
import {Header} from "@/features/layout/Header";
|
2024-11-09 21:38:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export default async function Layout({children}: { children: React.ReactNode }) {
|
|
|
|
|
|
|
|
|
|
const user = await currentUser()
|
2024-11-10 23:12:38 +01:00
|
|
|
if (!user) redirect('/login')
|
|
|
|
|
|
2024-11-03 15:29:30 +01:00
|
|
|
return (
|
|
|
|
|
<SidebarProvider>
|
2024-11-10 23:12:38 +01:00
|
|
|
<AppSidebar/>
|
2024-11-10 11:01:59 +01:00
|
|
|
<SidebarInset>
|
|
|
|
|
<Header/>
|
2024-11-10 23:12:38 +01:00
|
|
|
<main>
|
|
|
|
|
{children}
|
|
|
|
|
</main>
|
2024-11-10 11:01:59 +01:00
|
|
|
</SidebarInset>
|
2024-11-03 15:29:30 +01:00
|
|
|
</SidebarProvider>
|
|
|
|
|
)
|
|
|
|
|
}
|