SPB Git forge

spb/toveli

Public
14commits 1branches 0releases
1.1 MBsize
maindefault branch
3 h agolast push
TypeScript 50.6% JavaScript 46.1% SQL 2.1% Shell 0.6% CSS 0.5%
1.0 KB · 19 lines tsx
Raw Blame History
1import { redirect } from "next/navigation";2import { headers } from "next/headers";3import { currentUser } from "@/lib/auth/session";4import { pgAvailable } from "@/db/client";5import { MemberNav } from "./member-nav";6import { Empty } from "@/components/ui";7export const dynamic = "force-dynamic";8export default async function MembreLayout({ children }: { children: React.ReactNode }) {9  if (!pgAvailable()) return <div className="mx-auto max-w-3xl px-4 py-10"><Empty title="Espace membre indisponible" hint="Le service des comptes n'est pas configuré sur ce serveur." /></div>;10  const u = await currentUser();11  if (!u) { const h = await headers(); const next = h.get("x-pathname") ?? "/membre"; redirect(`/connexion?next=${encodeURIComponent(next)}`); }12  return (13    <div className="mx-auto max-w-7xl px-4 py-5 md:py-8 grid md:grid-cols-[220px_minmax(0,1fr)] gap-6">14      <MemberNav email={u.email} name={u.publicName ?? u.displayName} roles={u.roles} />15      <div className="min-w-0">{children}</div>16    </div>17  );18}19