'use client' import { useMemo } from 'react' import { useFiscalPeriods } from '@/lib/reference-data/hooks' import Link from 'next/link' import { useTranslations } from 'next-intl' import { AlertCircle } from 'lucide-react' import { Card, CardContent } from '@/components/ui/card' import { QUIET_LINK_CLASS } from '@/components/ui/dry-table' import { findFiscalYearGaps, type FiscalYearGap, type PeriodLike } from '@/lib/bookkeeping/fiscal-year-gaps' /** * After a SIE import: the years the company now has, with any hole between * them called out. Fortnox and friends export one räkenskapsår per file, so * "import the next file" is the fix and this is the moment to say it. * Renders nothing while loading, on failure, or when the chain is whole. */ export function FiscalYearGapNotice() { const t = useTranslations('fiscal_year_gaps') // Session-cached period list (lib/reference-data): refreshed by the import // flow's invalidation, so the notice reflects the years just imported. const { periods } = useFiscalPeriods() const gaps = useMemo(() => findFiscalYearGaps(periods as PeriodLike[]), [periods]) if (gaps.length === 0) return null return ( ) }