feat: persistent sidebar nav with role-scoped links, logout, and mobile bottom tab bar
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user