import type { ReactNode } from "react"; import { Link } from "react-router"; import { useTranslation } from "react-i18next"; import type { SettingsHubVM } from "@hivegrid/view-models"; import { PAGE_HEADER_ICON_CLASS, PageHeader, PageShell } from "../shared/PageShell"; import { Tabs } from "~/ui/components/Tabs"; /** * AK-SET-01 · shared chrome for every settings hub. * * Renders the hub header plus a permanently visible tab bar and yields the * active tab's route below it. The tab markup follows the settings tab bar * already shipped in MembersPage: a wrapping a , so each tab * stays a real navigation target rather than an onClick handler. * * The inner settings rail (SidebarIconsLayout) is deliberately untouched by * this component — it only ever receives a shorter item list. */ export function SettingsHubShell({ vm, icon, children, }: { vm: SettingsHubVM; icon?: ReactNode; children: ReactNode; }): React.JSX.Element { const { t } = useTranslation(); // `empty` means the loader handed over a hub without a single reachable tab. // It should have thrown a 404 instead, so render the content bare rather than // an empty chrome that suggests the user is somewhere they may not be. if (vm.status !== "ready") { return {children}; } const { hubId, titleKey, subtitleKey, tabs } = vm.data; return ( {icon} : undefined} title={t(titleKey)} subtitle={subtitleKey ? t(subtitleKey) : undefined} />
{tabs.map((tab) => ( {t(tab.labelKey)} ))}
{/* PageShell is items-start, so the tab content would size to its own content and leave dead space on the right — this keeps it stretched. */}
{children}
); }