'use client' import { useTranslations } from 'next-intl' import { getReport } from '@/lib/reports/catalog' import type { EntityType } from '@/types' /** * "Senast öppnade" — compact beige chips for the reports the user opened most * recently. One tap reopens a report straight from the library landing. * Renders nothing when there is no history (first visit). */ export function RecentReportsShelf({ slugs, entityType, hasEmployees, onOpen, }: { slugs: string[] entityType?: EntityType hasEmployees?: boolean onOpen: (slug: string) => void }) { const t = useTranslations('reports') const items = slugs .map((slug) => getReport(slug)) .filter((r): r is NonNullable => !!r) .filter((r) => !r.entityType || r.entityType === entityType) .filter((r) => !r.needsEmployees || hasEmployees) if (items.length === 0) return null return (

{t('recent_heading')}

{items.map((item) => ( ))}
) }