- login, register, candidature, cgv, confidentialite, mentions-legales: add bg-dark class so white text is visible on dark background - admin shell + protected layout: same fix for admin/dashboard pages - CookieBanner: update styling to match navy/orange branding, add RGPD compliance text, include Accepter/Refuser buttons, link to confidentialite - layout.tsx: import and render CookieBanner globally https://claude.ai/code/session_01V8YAjpqRQ3bfBYsABYsEgo
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
import { createClient } from "@/lib/supabase/server";
|
|
import Sidebar from "@/components/dashboard/Sidebar";
|
|
import type { Profile } from "@/types/database.types";
|
|
|
|
export const runtime = "nodejs";
|
|
|
|
export default async function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const supabase = await createClient();
|
|
|
|
// Vérifier l'authentification
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser();
|
|
|
|
if (!user) {
|
|
redirect("/login");
|
|
}
|
|
|
|
// Récupérer le profil
|
|
const { data: profile } = await supabase
|
|
.from("profiles")
|
|
.select("*")
|
|
.eq("id", user.id)
|
|
.single() as { data: Profile | null };
|
|
|
|
if (!profile) {
|
|
redirect("/login");
|
|
}
|
|
|
|
// Vérifier l'abonnement actif
|
|
if (profile.subscription_status !== "active") {
|
|
redirect("/login");
|
|
}
|
|
|
|
return (
|
|
<div className="flex min-h-screen bg-dark">
|
|
<Sidebar user={profile} />
|
|
<main className="flex-1 p-6 md:p-10 overflow-y-auto">{children}</main>
|
|
</div>
|
|
);
|
|
}
|