2023-07-24 15:17:21 +03:00
|
|
|
"use client";
|
|
|
|
import { ReactNode } from "react";
|
|
|
|
|
2023-09-22 17:06:04 +03:00
|
|
|
import { KnowledgeProvider } from "@/lib/context";
|
2023-07-24 15:17:21 +03:00
|
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
|
|
import { redirectToLogin } from "@/lib/router/redirectToLogin";
|
|
|
|
|
|
|
|
import { BrainsList } from "./[brainId]/components";
|
|
|
|
|
|
|
|
interface LayoutProps {
|
|
|
|
children?: ReactNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Layout = ({ children }: LayoutProps): JSX.Element => {
|
|
|
|
const { session } = useSupabase();
|
|
|
|
if (session === null) {
|
|
|
|
redirectToLogin();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="relative h-full w-full flex justify-stretch items-stretch">
|
|
|
|
<BrainsList />
|
2023-09-22 17:06:04 +03:00
|
|
|
<KnowledgeProvider>{children}</KnowledgeProvider>
|
2023-07-24 15:17:21 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Layout;
|