quivr/frontend/app/chat/layout.tsx
Aditya Nandan 52e723d534
use context to prevent having duplicate chat states (#297)
* fix(chat): Use a global chat context to avoid duplicate states

* fix(chat): update chats list when creating a new chat
2023-06-11 14:34:36 +02:00

27 lines
635 B
TypeScript

"use client";
import { redirect } from "next/navigation";
import { FC, ReactNode } from "react";
import { useSupabase } from "../supabase-provider";
import { ChatsProvider } from "./ChatsProvider/chats-provider";
import { ChatsList } from "./components";
interface LayoutProps {
children?: ReactNode;
}
const Layout: FC<LayoutProps> = ({ children }) => {
const { session } = useSupabase();
if (!session) redirect("/login");
return (
<ChatsProvider>
<div className="relative h-full w-full flex items-start">
<ChatsList />
{children}
</div>
</ChatsProvider>
);
};
export default Layout;