import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
import { SidebarNav, BottomNav } from "@/components/nav";
import { BabyProvider } from "@/contexts/baby-context";
import { QuickAddFab } from "@/components/quick-add-fab";

export default async function AppLayout({ children }: { children: React.ReactNode }) {
  const session = await auth();
  if (!session?.user) redirect("/auth/login");

  return (
    <BabyProvider>
      <div className="min-h-screen bg-slate-50 dark:bg-slate-900">
        <SidebarNav />
        <main className="app-main min-h-screen">
          {children}
        </main>
        <BottomNav />
        <QuickAddFab />
      </div>
    </BabyProvider>
  );
}
