* feat(reports,settings): report library + focused report routes, settings modal Reports - Replace the monolithic /reports tab-switcher with a calm, grouped report library landing (ReportLibrary + RecentReportsShelf) driven by a new lib/reports/catalog.ts. - Each report opens a focused /reports/[slug] route (FocusedReport) with a shared fiscal-year selector, optional date-range, and URL-based account drill-down into the general ledger. - Extract every report view into components/reports/views, add a reusable ReportExportMenu, and remove the old ReportsNav. Settings - Add an intercepting @settingsModal parallel route so in-app navigation to /settings opens as a modal over the current page; hard loads still resolve to the full page. - Share one SettingsShell (rail + content) between page and modal, extract each section into components/settings/sections/*Content, add a settings hotkey and command-palette entry, and remove the old SettingsSidebar. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(reports,settings): remove dead salary-journal entry, fix border token Addresses PR review feedback (#629): - Remove the unreachable `salary-journal` report from the catalog. It had needsEmployees + no route + no FocusedView handler and `hasEmployees` was never plumbed through, so it never appeared in the library and a direct /reports/salary-journal URL rendered a blank frame. The report was never on the old page and has no view component; the API + generator stay in place for a proper follow-up. Drops its two now-unused i18n keys. - Replace opacity-suffixed `border-border/8` section dividers with full-opacity `border-border` across the extracted settings section components, per the design system (no opacity-suffixed border tokens on surfaces). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: re-trigger checks (pg-real hit a Docker Hub registry timeout) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.6 KiB
TypeScript
70 lines
2.6 KiB
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
import { CompanyDangerZone } from '@/components/settings/CompanyDangerZone'
|
|
import { CompanyInfoForm } from '@/components/settings/CompanyInfoForm'
|
|
import { CompanyMembersSection } from '@/components/settings/CompanyMembersSection'
|
|
import { CompanyProfileSection } from '@/components/settings/CompanyProfileSection'
|
|
import { FiscalPeriodEditor } from '@/components/settings/FiscalPeriodEditor'
|
|
import { LogoUpload } from '@/components/settings/LogoUpload'
|
|
import { SettingsFormWrapper } from '@/components/settings/SettingsFormWrapper'
|
|
import { SettingsLoadingSkeleton } from '@/components/settings/SettingsLoadingSkeleton'
|
|
import { useSettings } from '@/components/settings/useSettings'
|
|
import type { CompanySettings } from '@/types'
|
|
|
|
export function CompanySettingsContent() {
|
|
const router = useRouter()
|
|
const { settings, isLoading, updateSettings } = useSettings()
|
|
|
|
if (isLoading || !settings) return <SettingsLoadingSkeleton />
|
|
|
|
function handleSave(formData: FormData) {
|
|
const updates: Record<string, unknown> = {
|
|
...(formData.has('company_name') && { company_name: formData.get('company_name') as string }),
|
|
...(formData.has('org_number') && { org_number: formData.get('org_number') as string }),
|
|
address_line1: formData.get('address_line1') as string,
|
|
postal_code: formData.get('postal_code') as string,
|
|
city: formData.get('city') as string,
|
|
phone: (formData.get('phone') as string) || '',
|
|
email: (formData.get('email') as string) || '',
|
|
website: (formData.get('website') as string) || '',
|
|
}
|
|
return {
|
|
updates,
|
|
onSuccess: (data: Record<string, unknown>) => {
|
|
updateSettings(data as Partial<CompanySettings>)
|
|
// Refresh server components so the company switcher and DashboardNav
|
|
// pick up the new company_name (rendered from server in the dashboard layout).
|
|
if ('company_name' in updates) {
|
|
router.refresh()
|
|
}
|
|
},
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="space-y-8">
|
|
<SettingsFormWrapper onSave={handleSave} className="space-y-8">
|
|
<CompanyInfoForm settings={settings} />
|
|
</SettingsFormWrapper>
|
|
|
|
<div className="border-t border-border pt-8">
|
|
<LogoUpload
|
|
logoUrl={settings.logo_url}
|
|
onUpdate={(url) => updateSettings({ logo_url: url })}
|
|
/>
|
|
</div>
|
|
|
|
<div className="border-t border-border pt-8">
|
|
<CompanyMembersSection />
|
|
</div>
|
|
|
|
<FiscalPeriodEditor />
|
|
|
|
<CompanyProfileSection />
|
|
|
|
<CompanyDangerZone />
|
|
</div>
|
|
)
|
|
}
|