feat: persistent sidebar nav with role-scoped links, logout, and mobile bottom tab bar

This commit is contained in:
2026-07-12 16:40:57 +08:00
parent ba2cf69a8b
commit 180b0dc0a3
2 changed files with 233 additions and 6 deletions
+17 -6
View File
@@ -1,9 +1,8 @@
// app/(protected)/layout.tsx
export const dynamic = 'force-dynamic'
import { createClient } from '@/lib/supabase/server'
import { redirect } from 'next/navigation'
import { NotificationBell } from '@/components/notifications/bell'
import { Sidebar } from '@/components/layout/sidebar'
export default async function ProtectedLayout({
children,
@@ -17,10 +16,22 @@ export default async function ProtectedLayout({
if (!user) redirect('/login')
const { data: profile } = await supabase
.from('users')
.select('role, name, email')
.eq('id', user.id)
.single()
return (
<>
<NotificationBell />
{children}
</>
<div className="min-h-screen bg-gray-50">
<Sidebar
role={profile?.role ?? 'reporter'}
userName={profile?.name ?? user.email ?? ''}
userEmail={profile?.email ?? user.email ?? ''}
/>
<div className="md:ml-60 pb-16 md:pb-0">
{children}
</div>
</div>
)
}