import { redirect } from "next/navigation"; import { Suspense } from "react"; import { AppHeader } from "@/components/layout/app-header"; import { AppShellFallback } from "@/components/layout/app-shell-fallback"; import { AppSidebar } from "@/components/layout/app-sidebar"; import { BottomNav } from "@/components/layout/bottom-nav"; import { QuickAddProvider } from "@/components/layout/quick-add"; import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; import { hasHouseholdRole } from "@/features/households/roles"; import { getHouseholdContext } from "@/lib/dal"; import { APP_VERSION } from "@/lib/version"; /** * Oturum gerektiren alan. Oturum okuması istek anında yapılır (Cache Components), bu yüzden * kullanıcıya bağlı kabuk Suspense içinde render edilir. Her sayfa ayrıca kendi yetkisini * DAL üzerinden kontrol eder (layout istemci gezinmesinde yeniden çalışmaz). */ export default function AppLayout({ children }: { children: React.ReactNode }) { return ( }> {children} ); } async function AuthenticatedShell({ children }: { children: React.ReactNode }) { const ctx = await getHouseholdContext(); if (!ctx) redirect("/login"); const { user, household, memberships } = ctx; const canWrite = household ? hasHouseholdRole(household.role, "member") : false; return ( {/* Mobilde alt menü yüksekliği kadar boşluk */}
{children}
); }