Responsive variants (md:flex, md:hidden) were silently missing from the Tailwind CSS bundle due to stale build cache — sidebar was always hidden. Changed breakpoint to sm (640px) and use rm -rf .next before builds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
38 lines
890 B
TypeScript
38 lines
890 B
TypeScript
export const dynamic = 'force-dynamic'
|
|
|
|
import { createClient } from '@/lib/supabase/server'
|
|
import { redirect } from 'next/navigation'
|
|
import { Sidebar } from '@/components/layout/sidebar'
|
|
|
|
export default async function ProtectedLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
const supabase = await createClient()
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser()
|
|
|
|
if (!user) redirect('/login')
|
|
|
|
const { data: profile } = await supabase
|
|
.from('users')
|
|
.select('role, name, email')
|
|
.eq('id', user.id)
|
|
.single()
|
|
|
|
return (
|
|
<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="sm:ml-60 pb-16 sm:pb-0">
|
|
{children}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|