'use client' import { useTranslations } from 'next-intl' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Checkbox } from '@/components/ui/checkbox' import { TD_CLASS, QUIET_LINK_CLASS } from '@/components/ui/dry-table' import { cn, formatCurrency, formatDate } from '@/lib/utils' import { formatVoucher } from '@/lib/bookkeeping/voucher-series-resolver' import { AlertCircle, Landmark, Link2, Loader2 } from 'lucide-react' import type { SkattekontoBookingSuggestion, SkattekontoMatchSuggestion, StoredSkattekontoTransaction, } from '@/types/skatteverket' /** * Skattekonto-rad in the /transactions inbox, rendered as a dry-table row * (concept scene 10). The Skatteverket chip is the cue that this row is * fundamentally different from a bank tx: different counter-account (1630 vs * 1930), different categorization rules. No foldout: both actions fit inline. */ export default function SkattekontoInboxCard({ row, matchSuggestion, bookingSuggestion, isExiting = false, processing, selectable, isSelected, onToggleSelect, onBokfor, onMatch, }: { row: StoredSkattekontoTransaction matchSuggestion?: SkattekontoMatchSuggestion | null bookingSuggestion?: SkattekontoBookingSuggestion | null /** The row was just booked and is animating out during the page's 350ms * removal window (.row-exit collapse; instant under reduced motion). */ isExiting?: boolean processing: boolean selectable?: boolean isSelected?: boolean onToggleSelect?: (id: string) => void onBokfor: (row: StoredSkattekontoTransaction) => void onMatch: (row: StoredSkattekontoTransaction) => void }) { const t = useTranslations('tx_skattekonto_card') const amount = Number(row.belopp_skatteverket) const isIncome = amount > 0 const duplicateLabel = matchSuggestion?.voucher_series && matchSuggestion?.voucher_number ? t('duplicate_title_with_voucher', { label: formatVoucher({ voucher_series: matchSuggestion.voucher_series, voucher_number: matchSuggestion.voucher_number, }), }) : t('duplicate_title_draft') return (