import { createClient } from '@/lib/supabase/server' import { redirect } from 'next/navigation' import { UserNav } from '@/components/layout/user-nav' import Link from 'next/link' export default async function DashboardLayout({ children, }: { children: React.ReactNode }) { const supabase = await createClient() // Get user (should always exist due to middleware) const { data: { user }, error: authError } = await supabase.auth.getUser() if (authError || !user) { redirect('/login') } // Get profile with plan info const { data: profile } = await supabase .from('profiles') .select(` *, plans ( name, display_name_it ) `) .eq('id', user.id) .single() return (
{/* Header */}
Leopost
{/* Main content */}
{children}
) }