'use client' import Image from 'next/image' import { useTranslations } from 'next-intl' import { cn, formatDate } from '@/lib/utils' import type { ReconciliationAccount } from '@/lib/reconciliation/schemas' /** * The account rail of the Avstämning page: one row per account with an * outside truth (bank accounts, the skattekonto), logo or monogram, the * account number, when its outside side was last fetched, and a status dot. * Selection is URL-owned (?account=) by the workspace; the rail only reports. */ const DOT_CLASS: Record['state'] | 'unknown', string> = { reconciled: 'bg-success', open: 'bg-warning', stale: 'bg-warning', not_configured: 'bg-muted-foreground/40', unknown: 'bg-muted-foreground/40', } function monogram(name: string): string { const words = name.trim().split(/\s+/).filter(Boolean) if (words.length === 0) return '?' if (words.length === 1) return words[0].slice(0, 2).toUpperCase() return (words[0][0] + words[1][0]).toUpperCase() } export function AccountLogo({ account, className }: { account: ReconciliationAccount; className?: string }) { if (account.logo_url) { return ( ) } return ( {monogram(account.name)} ) } interface ReconciliationRailProps { accounts: ReconciliationAccount[] selectedKey: string | null onSelect: (accountKey: string) => void } export function ReconciliationRail({ accounts, selectedKey, onSelect }: ReconciliationRailProps) { const t = useTranslations('reconciliation') return ( ) }