"use client"; import { usePathname } from "next/navigation"; import SettingsBreadcrumb from "@/components/settings/SettingsBreadcrumb"; import { SettingsToolbar } from "@/components/settings/SettingsToolbar"; import { SettingsLoadStatusBanner } from "@/components/settings/SettingsLoadStatusBanner"; import { SETTINGS_HUB_HREF, isNavOnlyRoute } from "@/lib/settings-nav"; // Two-level hub: the dashboard at `/settings` is the entry; categories with // several settings open a sub-hub, the rest go straight to a leaf. Every page // below the hub carries a breadcrumb top-left so the user knows where they // are. The sticky Save Draft / Apply toolbar rides above the scroll area on // leaf pages only — nav-only pages (hub, sub-hubs) have nothing to save. export default function SettingsMain({ children, }: Readonly<{ children: React.ReactNode }>) { const pathname = usePathname() ?? ""; const isHub = pathname === SETTINGS_HUB_HREF; if (isHub) { return (
{children}
); } const showToolbar = !isNavOnlyRoute(pathname); return (
{showToolbar && (
)}
{/* Inner scroll container. Sticky elements inside (e.g. the profile-list aside in ServiceConfigEditor) anchor to this ancestor instead of the outer flex column, so the left column stays put while the right side scrolls. ``min-h-0`` is required for the flex child to constrain to remaining space — without it, ``overflow-y-auto`` would never clip. */}
{children}
); }