'use client' import { useTranslations } from 'next-intl' import { ChevronRight } from 'lucide-react' import { DataList, DataListMeta, DataListPrimary, DataListRow, } from '@/components/ui/data-list' import { Badge } from '@/components/ui/badge' import { getLibrarySections, type ReportDescriptor } from '@/lib/reports/catalog' import type { EntityType } from '@/types' /** * The report library: the calm landing for /reports. Reports grouped by * accounting taxonomy, each section a single DataList. One report = one row = * one destination; no data preview, so the landing stays a fast index. */ export function ReportLibrary({ entityType, hasEmployees, dimensionsEnabled, onOpen, }: { entityType?: EntityType hasEmployees?: boolean dimensionsEnabled?: boolean onOpen: (slug: string) => void }) { const t = useTranslations('reports') const sections = getLibrarySections(entityType, hasEmployees, dimensionsEnabled) return (
{sections.map((section) => (

{t(section.labelKey)}

{section.items.map((item) => ( onOpen(item.slug)} trailing={ <> {item.params === 'calendar' && ( {t('calendar_badge')} )} } > {t(item.labelKey)} {t(item.descKey)} ))}
))}
) } function EntityBadge({ item }: { item: ReportDescriptor }) { if (item.entityType === 'enskild_firma') return EF if (item.entityType === 'aktiebolag') return AB return null }