-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout.tsx
34 lines (29 loc) · 863 Bytes
/
layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use client";
import { Spinner } from "@/components/spinner";
import { useConvex, useConvexAuth } from "convex/react";
import { redirect } from "next/navigation";
import Navigation from "./_components/navigation";
import { SearchCommand } from "@/components/search-command";
const MainLayout = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated, isLoading } = useConvexAuth();
if (isLoading) {
return (
<div className=" h-full flex items-center justify-center">
<Spinner size="lg" />
</div>
);
}
if (!isAuthenticated) {
return redirect("/");
}
return (
<div className=" dark:bg-[#1F1F1F] h-full flex ">
<Navigation />
<main className=" flex-1 h-full overflow-y-auto ">
<SearchCommand />
{children}
</main>
</div>
);
};
export default MainLayout;