From d5186328200cb352cc73c6cb186315b6e03f4859 Mon Sep 17 00:00:00 2001 From: Christopher Arraya Date: Sun, 30 Jul 2023 01:04:24 -0400 Subject: [PATCH] refactor(client): create navbar --- app/page.tsx | 37 ++----------------------------------- components/navbar.tsx | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 35 deletions(-) create mode 100644 components/navbar.tsx diff --git a/app/page.tsx b/app/page.tsx index e142cc2..6879306 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,41 +1,8 @@ -import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; -import { cookies } from "next/headers"; -import Link from "next/link"; -import { buttonVariants } from "@/components/ui/button"; -import LogoutButton from "@/components/logout"; - -export const dynamic = "force-dynamic"; - +import Navbar from "@/components/navbar"; export default async function Index() { - const supabase = createServerComponentClient({ cookies }); - - const { - data: { user }, - } = await supabase.auth.getUser(); - return (
- - +

diff --git a/components/navbar.tsx b/components/navbar.tsx new file mode 100644 index 0000000..94025c0 --- /dev/null +++ b/components/navbar.tsx @@ -0,0 +1,38 @@ +import Link from "next/link"; +import { buttonVariants } from "@/components/ui/button"; +import LogoutButton from "@/components/logout"; +import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"; +import { cookies } from "next/headers"; + +export const dynamic = "force-dynamic"; + +export default async function Navbar() { + const supabase = createServerComponentClient({ cookies }); + + const { + data: { user }, + } = await supabase.auth.getUser(); + + return ( +

+ ); +}