'use client' import { useRouter } from 'next/navigation' import { useTranslations } from 'next-intl' import { useCompany } from '@/contexts/CompanyContext' import { Dialog, DialogContent, DialogDescription, DialogTitle, } from '@/components/ui/dialog' import { SETTINGS_SECTIONS } from './sections' import { SettingsShell } from './SettingsShell' /** * The settings popup. Rendered only by the intercepting route * (`@settings/(.)settings/[[...section]]`) on in-app soft navigation, so its * mere presence means "open". Closing pops the history entry that opened it, * returning the user to the page they came from (which stayed mounted in the * `children` slot behind the scrim). On hard load / refresh / deep-link the * interceptor doesn't fire and the real full-page settings render instead. */ export function SettingsModal({ sectionId }: { sectionId?: string }) { const router = useRouter() const { company } = useCompany() const t = useTranslations('settings_modal') // Bare /settings (or an unknown section) defaults to company, or to account // when there is no active company (the no-company escape hatch). const resolved = sectionId && SETTINGS_SECTIONS[sectionId] ? sectionId : company ? 'company' : 'account' function onOpenChange(open: boolean) { if (!open) router.back() } return (
{t('title')}
{t('description')}
) }