2025-04-16 01:20:15 +08:00
|
|
|
import DashboardLayout from "@/components/dashboard/DashboardLayout";
|
2025-04-12 08:04:40 +08:00
|
|
|
import { createClient } from "@/lib/supabase/server";
|
2025-04-12 02:57:17 +08:00
|
|
|
|
2025-04-16 01:20:15 +08:00
|
|
|
interface DashboardRootLayoutProps {
|
2025-04-12 08:04:40 +08:00
|
|
|
children: React.ReactNode;
|
2025-04-13 00:37:45 +08:00
|
|
|
}
|
|
|
|
|
2025-04-16 01:20:15 +08:00
|
|
|
export default async function DashboardRootLayout({
|
2025-04-13 00:37:45 +08:00
|
|
|
children,
|
2025-04-16 01:20:15 +08:00
|
|
|
}: DashboardRootLayoutProps) {
|
2025-04-12 08:04:40 +08:00
|
|
|
// Get the current user via Supabase
|
2025-04-16 01:20:15 +08:00
|
|
|
const supabaseClient = await createClient();
|
2025-04-12 08:04:40 +08:00
|
|
|
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
|
|
|
|
|
|
// Get the personal account details
|
|
|
|
const { data: personalAccount } = await supabaseClient.rpc('get_personal_account');
|
2025-04-12 02:57:17 +08:00
|
|
|
|
2025-04-12 08:04:40 +08:00
|
|
|
return (
|
|
|
|
<DashboardLayout
|
|
|
|
accountId={personalAccount?.account_id || user.id}
|
2025-04-13 00:37:45 +08:00
|
|
|
userName={user?.user_metadata?.name || user.email?.split('@')[0] || 'User'}
|
|
|
|
userEmail={user.email}
|
|
|
|
rightPanelTitle="Suna's Computer"
|
2025-04-12 08:04:40 +08:00
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</DashboardLayout>
|
|
|
|
);
|
2025-04-16 01:20:15 +08:00
|
|
|
}
|