'use client' import { useTranslations } from 'next-intl' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' 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 { 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, processing, onBokfor, onMatch, }: { row: StoredSkattekontoTransaction matchSuggestion?: SkattekontoMatchSuggestion | null processing: boolean 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 (