Full-stack Next.js 15 application with: - Landing page with marketing components (Hero, Testimonials, Pricing, FAQ) - Multi-step candidature form with API route - Stripe Checkout integration (subscription + webhooks) - Supabase Auth (login/register) with middleware protection - Dashboard with progress tracking and module system - Formations pages with completion tracking - Profile management with password change - Database schema with RLS policies - Resend email integration for transactional emails Stack: Next.js 15, TypeScript, Tailwind CSS v4, Supabase, Stripe, Resend https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
45 lines
1010 B
TypeScript
45 lines
1010 B
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 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">
|
|
<Sidebar user={profile} />
|
|
<main className="flex-1 p-6 md:p-10 overflow-y-auto">{children}</main>
|
|
</div>
|
|
);
|
|
}
|