From 0f8a9546b55f2c567b2975a3a840eb5baf37d36d Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Santos Souza de Miranda Date: Wed, 21 Jan 2026 04:11:01 -0300 Subject: [PATCH] feat: [US-011] - Dashboard layout with navbar Co-Authored-By: Claude Opus 4.5 --- src/app/dashboard/layout.tsx | 28 ++++++++++++++++++++++++++++ src/components/Navbar.tsx | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/app/dashboard/layout.tsx create mode 100644 src/components/Navbar.tsx diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx new file mode 100644 index 0000000..497583f --- /dev/null +++ b/src/app/dashboard/layout.tsx @@ -0,0 +1,28 @@ +import { redirect } from 'next/navigation' +import { createClient } from '@/lib/supabase/server' +import Navbar from '@/components/Navbar' + +export default async function DashboardLayout({ + children, +}: { + children: React.ReactNode +}) { + const supabase = await createClient() + + const { + data: { user }, + } = await supabase.auth.getUser() + + if (!user) { + redirect('/login') + } + + return ( +
+ +
+ {children} +
+
+ ) +} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx new file mode 100644 index 0000000..7b5bec8 --- /dev/null +++ b/src/components/Navbar.tsx @@ -0,0 +1,32 @@ +import Link from 'next/link' +import LogoutButton from './LogoutButton' + +interface NavbarProps { + userEmail: string +} + +export default function Navbar({ userEmail }: NavbarProps) { + return ( + + ) +}