36 lines
938 B
TypeScript
36 lines
938 B
TypeScript
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import Providers from "@/components/Providers";
|
|
import Sidebar from "@/components/Sidebar";
|
|
import { getDictionary, Locale } from "@/app/dictionaries";
|
|
import { DictionaryProvider } from "@/components/DictionaryContext";
|
|
|
|
export default async function DashboardLayout(
|
|
props: {
|
|
children: React.ReactNode;
|
|
params: Promise<{ lang: string }>;
|
|
}
|
|
) {
|
|
const params = await props.params;
|
|
|
|
const {
|
|
children
|
|
} = props;
|
|
|
|
const session = await auth();
|
|
if (!session) redirect(`/${params.lang}/login`);
|
|
|
|
const dict = await getDictionary(params.lang as Locale);
|
|
|
|
return (
|
|
<Providers>
|
|
<DictionaryProvider dictionary={dict}>
|
|
<div className="app-layout">
|
|
<Sidebar dict={dict} lang={params.lang} />
|
|
<div className="main-content">{children}</div>
|
|
</div>
|
|
</DictionaryProvider>
|
|
</Providers>
|
|
);
|
|
}
|