Shell con nav agrupada y activa, PageHeader común, tipografía y tokens. Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { createClient } from '@/lib/supabase/server';
|
|
import { logoutAction } from '@/app/auth/actions';
|
|
import { cookies } from 'next/headers';
|
|
import { VIEW_TENANT_NAME_COOKIE } from '@/lib/agency';
|
|
import DashboardShell from '@/components/DashboardShell';
|
|
|
|
export default async function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const supabase = await createClient();
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser();
|
|
|
|
const role =
|
|
user?.user_metadata?.role || user?.app_metadata?.role || 'client';
|
|
const company = user?.user_metadata?.company || '4Ventures Central';
|
|
const email = user?.email || 'usuario@4ventures.es';
|
|
const isAgency = role === 'admin' || role === 'team';
|
|
const cookieStore = await cookies();
|
|
const viewName = cookieStore.get(VIEW_TENANT_NAME_COOKIE)?.value;
|
|
|
|
return (
|
|
<DashboardShell
|
|
email={email}
|
|
company={company}
|
|
role={role}
|
|
isAgency={isAgency}
|
|
viewName={viewName}
|
|
logoutAction={logoutAction}
|
|
>
|
|
{children}
|
|
</DashboardShell>
|
|
);
|
|
}
|