* refactor: optimize page loading and data fetching * fix: resolve recurring production runtime errors * feat: add MCP company and customer updates * fix: handle year-end tax adjustments * feat: harden annual report compliance * fix: expand invoice logo and font support * fix: sanitize API route error responses * fix: sanitize user-facing error messages * feat: persist onboarding and tax assessment notices * fix: reduce cloud backup audit churn * feat: refine invoice editor layout * fix: show saved tax adjustments in INK2 * fix: complete annual report API mappings * docs: record operational safeguards and decisions * fix: harden annual report review findings * fix: adjust column span for description based on VAT registration * New css class name
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { notFound, redirect } from 'next/navigation'
|
|
import { getReport } from '@/lib/reports/catalog'
|
|
import { FocusedReport } from '@/components/reports/FocusedReport'
|
|
import { getDashboardAuthContext, getDashboardCompanyId } from '../../request-context'
|
|
import type { FiscalPeriod } from '@/types'
|
|
|
|
/**
|
|
* Focused single-report route. Unknown slugs 404; reports that own a dedicated
|
|
* route (cash flow, annual report, KPI, SIE) redirect there. Everything else
|
|
* renders inside the shared focused-report shell.
|
|
*/
|
|
export default async function ReportSlugPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ slug: string }>
|
|
}) {
|
|
const { slug } = await params
|
|
const report = getReport(slug)
|
|
if (!report) notFound()
|
|
if (report.route) redirect(report.route)
|
|
|
|
const [{ supabase }, companyId] = await Promise.all([
|
|
getDashboardAuthContext(),
|
|
getDashboardCompanyId(),
|
|
])
|
|
const needsFiscalPeriod = report.params !== 'calendar' && report.params !== 'none'
|
|
const { data: periods } = companyId && needsFiscalPeriod
|
|
? await supabase
|
|
.from('fiscal_periods')
|
|
.select('*')
|
|
.eq('company_id', companyId)
|
|
.order('period_start', { ascending: false })
|
|
: { data: [] }
|
|
|
|
return (
|
|
<FocusedReport
|
|
slug={slug}
|
|
initialPeriods={(periods ?? []) as FiscalPeriod[]}
|
|
initialCompanyId={companyId}
|
|
/>
|
|
)
|
|
}
|