"use client";

import { usePathname } from "next/navigation";

import { Footer } from "@/components/layout/Footer";
import { Navbar } from "@/components/layout/Navbar";
import type { NavUser } from "@/lib/auth/session";

interface SiteChromeProps {
  children: React.ReactNode;
  user?: NavUser | null;
}

export function SiteChrome({ children, user }: SiteChromeProps) {
  const pathname = usePathname();
  // Dashboard, studio and admin all provide their own shell — no public chrome.
  const isAppShell =
    pathname.startsWith("/dashboard") ||
    pathname.startsWith("/studio") ||
    pathname.startsWith("/admin");

  if (isAppShell) {
    return <>{children}</>;
  }

  return (
    <>
      <Navbar user={user} />
      {children}
      <Footer />
    </>
  );
}
