'use client' import { Suspense } from 'react' import { SettingsRail } from './SettingsRail' import { SettingsLoadingSkeleton } from './SettingsLoadingSkeleton' import { SettingsProvider } from './useSettings' import { SETTINGS_SECTIONS } from './sections' interface SettingsShellProps { variant: 'page' | 'modal' /** Resolved section id. Required for the modal (drives which content renders); * optional for the page where `{children}` is the route's own content. */ activeSection?: string children?: React.ReactNode } /** * Shared two-pane settings layout (category rail + content). The full-page * route renders it via `settings/layout.tsx` (content = the route's children); * the routed modal renders it inside a Dialog (content resolved from the * section map). Keeping one shell means page and modal stay visually identical. */ export function SettingsShell({ variant, activeSection, children }: SettingsShellProps) { if (variant === 'modal') { const Section = activeSection ? SETTINGS_SECTIONS[activeSection] : undefined return ( // One provider per open shell: the section it wraps is swapped on tab change // without remounting the shell, so the settings fetch is shared across tabs.
}> {Section ?
: null}
) } return (
{children}
) }