quivr/frontend/app/chat/layout.tsx
Mamadou DICKO 6acb13d4ae
Frontend/test/chat (#496)
* refactor(<ChatPage/>)

* test(<ChatInput />): add unit tests

* test(<ChatMessages />): add unit tests
2023-07-03 17:39:59 +02:00

31 lines
710 B
TypeScript

"use client";
import { redirect } from "next/navigation";
import { ReactNode } from "react";
import { ChatsProvider } from "@/lib/context/ChatsProvider/chats-provider";
import { useSupabase } from "@/lib/context/SupabaseProvider";
import { ChatsList } from "./components/ChatsList";
interface LayoutProps {
children?: ReactNode;
}
const Layout = ({ children }: LayoutProps): JSX.Element => {
const { session } = useSupabase();
if (session === null) {
redirect("/login");
}
return (
<ChatsProvider>
<div className="relative h-full w-full flex justify-stretch items-stretch">
<ChatsList />
{children}
</div>
</ChatsProvider>
);
};
export default Layout;