MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / ChatLayout

Function ChatLayout

frontend/src/components/chat/chat-layout.tsx:9–42  ·  view source on GitHub ↗
({
  children,
}: {
  children: React.ReactNode;
})

Source from the content-addressed store, hash-verified

7import { useAuthContext } from '@/providers/AuthProvider';
8
9export default function ChatLayout({
10 children,
11}: {
12 children: React.ReactNode;
13}) {
14 const { isAuthorized } = useAuthContext();
15 const [isModalOpen, setIsModalOpen] = useState(false);
16
17 const { refetch } = useQuery(GET_USER_PROJECTS, {
18 skip: !isAuthorized,
19 });
20 const router = useRouter();
21
22 useEffect(() => {
23 if (!isAuthorized) {
24 router.push('/');
25 }
26 }, [isAuthorized, router]);
27
28 if (!isAuthorized) {
29 return null;
30 }
31
32 return (
33 <main className="flex h-[calc(100dvh)] flex-col items-center">
34 <ProjectModal
35 isOpen={isModalOpen}
36 onClose={() => setIsModalOpen(false)}
37 refetchProjects={refetch}
38 />
39 <div className="w-full h-full">{children}</div>
40 </main>
41 );
42}

Callers

nothing calls this directly

Calls 1

useAuthContextFunction · 0.90

Tested by

no test coverage detected