Open-source personal finance manager. Self-hosted, privacy-first.
feat(frontend): improve account detail and transaction layouts (#579)
Leonardo Zanivan3be0370d648d
diff --git a/frontend/src/components/app-layout.tsx b/frontend/src/components/app-layout.tsxindex 8bf3b25f..de133a79 100644--- a/frontend/src/components/app-layout.tsx+++ b/frontend/src/components/app-layout.tsx@@ -438,11 +438,7 @@ export function AppLayout() {{accountsExpanded && (<div className="mt-1 space-y-0.5">{[...visibleAccounts].sort((a, b) => Math.abs(Number(b.current_balance)) - Math.abs(Number(a.current_balance))).slice(0, accountsShowAll ? visibleAccounts.length : 3).map((acc) => {- const balance = Number(acc.current_balance)- const prevBalance = acc.previous_balance ?? 0- const pctChange = prevBalance !== 0- ? ((balance - prevBalance) / Math.abs(prevBalance)) * 100- : null+ const balance = Number(acc.current_balance) || 0const typeKey = acc.type.replace(/_([a-z])/g, (_, c: string) => c.toUpperCase()).replace(/^./, c => c.toUpperCase())return (@@ -462,11 +458,6 @@ export function AppLayout() {<span className={`block tabular-nums font-medium text-xs ${balance < 0 ? 'text-rose-400' : 'text-sidebar-foreground'}`}>{mask(formatCurrency(balance, acc.currency, locale))}</span>- {pctChange !== null && (- <span className={`block text-[10px] tabular-nums font-medium ${pctChange >= 0 ? 'text-emerald-400' : 'text-rose-400'}`}>- {mask(`${pctChange >= 0 ? '+' : ''}${pctChange.toFixed(1)}%`)}- </span>- )}</div></Link>)diff --git a/frontend/src/components/mobile-transaction-row.tsx b/frontend/src/components/mobile-transaction-row.tsxindex e7ca65e3..46fdd886 100644--- a/frontend/src/components/mobile-transaction-row.tsx+++ b/frontend/src/components/mobile-transaction-row.tsx@@ -6,6 +6,12 @@ import { AlertTriangle, ArrowLeftRight, Clock, EyeClosed, Paperclip } from 'luciimport { usePrivacyMode } from '@/hooks/use-privacy-mode'import { useTranslation } from 'react-i18next'import { formatCurrency } from '@/lib/format'+import { shouldShowPendingBadge } from '@/lib/transaction-status'++/** Keep long merchant references on one line when there are no word breaks. */+function hasWordBreaks(text: string): boolean {+ return /\s/.test(text)+}interface MobileTransactionRowProps {tx: Transaction@@ -20,6 +26,8 @@ interface MobileTransactionRowProps {userCurrency: stringonSelect: (id: string, shiftKey: boolean) => voidonClick: (tx: Transaction) => void+ /** Show the payee instead of the account name in an account-scoped view. */+ showPayee?: boolean}export function MobileTransactionRow({@@ -35,6 +43,7 @@ export function MobileTransactionRow({userCurrency,onSelect,onClick,+ showPayee = false,}: MobileTransactionRowProps) {const { mask } = usePrivacyMode()const { t } = useTranslation()@@ -88,7 +97,7 @@ export function MobileTransactionRow({<div className="min-w-0 flex-1">{/* Description row */}<div className="flex items-center gap-1.5">- <p className="text-sm font-semibold text-foreground truncate leading-tight">+ <p className={`text-sm font-semibold text-foreground leading-tight min-w-0 ${hasWordBreaks(tx.description) ? 'break-words whitespace-normal' : 'truncate'}`}>{tx.description}</p>{tx.group_id && (@@ -112,22 +121,35 @@ export function MobileTransactionRow({{tx.installment_number}/{tx.total_installments}</span>)}- {tx.status === 'pending' && (- <Clock size={12} className="text-muted-foreground shrink-0" />+ {shouldShowPendingBadge(tx) && (+ <span+ title={t('transactions.pending')}+ className="shrink-0 inline-flex items-center justify-center rounded-full border border-amber-200 bg-amber-50 p-0.5 dark:border-amber-500/30 dark:bg-amber-500/10"+ >+ <Clock size={12} className="text-amber-500" role="img" aria-label={t('transactions.pending')} />+ </span>)}{(tx.attachment_count ?? 0) > 0 && (<Paperclip size={11} className="text-muted-foreground shrink-0" />)}</div>- {/* Account row */}- {account && (- <div className="flex items-center gap-1.5 mt-0.5">- <AccountIcon account={account} size="xs" />- <span className="text-xs text-muted-foreground truncate">- {getAccountName(account)}- </span>- </div>+ {/* Account row or payee row */}+ {showPayee ? (+ (tx.payee_name || tx.payee) && (tx.payee_name || tx.payee) !== tx.description ? (+ <p className="text-xs text-muted-foreground mt-0.5 truncate">+ {tx.payee_name || tx.payee}+ </p>+ ) : null+ ) : (+ account && (+ <div className="flex items-center gap-1.5 mt-0.5">+ <AccountIcon account={account} size="xs" />+ <span className="text-xs text-muted-foreground truncate">+ {getAccountName(account)}+ </span>+ </div>+ ))}</div>diff --git a/frontend/src/components/transaction-calendar-view.tsx b/frontend/src/components/transaction-calendar-view.tsxindex 1626b57d..f592b2db 100644--- a/frontend/src/components/transaction-calendar-view.tsx+++ b/frontend/src/components/transaction-calendar-view.tsx@@ -11,6 +11,7 @@ import { activityChartData, dayActivity } from '@/lib/calendar-activity'import { weekdayShortLabels } from '@/lib/date-utils'import { cn } from '@/lib/utils'import { formatCurrency } from '@/lib/format'+import { shouldShowPendingBadge } from '@/lib/transaction-status'function parseLocalDate(value: string) {return new Date(`${value}T00:00:00`)@@ -1233,7 +1234,7 @@ function CalendarItemRow({<div className="min-w-0 flex-1"><div className="flex items-center gap-1.5"><p className="text-sm font-semibold text-foreground truncate leading-tight">{item.description}</p>- {item.kind === 'projected' && (+ {item.kind === 'projected' && item.source === 'recurring' && item.status !== 'pending' && (<span className="inline-flex items-center text-[9px] font-semibold uppercase tracking-wide text-violet-700 bg-violet-50 border border-violet-200 dark:bg-violet-950/40 dark:text-violet-300 dark:border-violet-900 px-1 py-0.5 rounded-full shrink-0">{t('transactions.calendarProjected')}</span>@@ -1244,8 +1245,13 @@ function CalendarItemRow({{item.is_ignored && (<EyeClosed className="h-3 w-3 text-gray-500 shrink-0" />)}- {item.status === 'pending' && (- <Clock size={12} className="text-muted-foreground shrink-0" />+ {shouldShowPendingBadge(item) && (+ <span+ title={t('transactions.pending')}+ className="shrink-0 inline-flex items-center justify-center rounded-full border border-amber-200 bg-amber-50 p-0.5 dark:border-amber-500/30 dark:bg-amber-500/10"+ >+ <Clock size={12} className="text-amber-500" role="img" aria-label={t('transactions.pending')} />+ </span>)}</div>{(account || item.account_name) && (diff --git a/frontend/src/pages/account-detail.tsx b/frontend/src/pages/account-detail.tsxindex 65556505..8fe222ce 100644--- a/frontend/src/pages/account-detail.tsx+++ b/frontend/src/pages/account-detail.tsx@@ -8,11 +8,13 @@ import { format, addDays, addMonths, parseISO } from 'date-fns'import { accounts, transactions, categories as categoriesApi, categoryGroups as categoryGroupsApi } from '@/lib/api'import { localDateString } from '@/lib/date-utils'import { invalidateFinancialQueries } from '@/lib/invalidate-queries'+import { shouldShowPendingBadge } from '@/lib/transaction-status'import { toast } from 'sonner'import type { CreditCardBill, Transaction } from '@/types'import { Skeleton } from '@/components/ui/skeleton'import { Button } from '@/components/ui/button'import { ArrowLeft, ArrowLeftRight, CalendarClock, ChevronLeft, ChevronRight, Clock, EyeClosed, HelpCircle, Paperclip, Pencil, X } from 'lucide-react'+import { MobileTransactionRow } from '@/components/mobile-transaction-row'import { CategoryIcon } from '@/components/category-icon'import { TransactionDialog, extractApiError, type TransactionSavePayload } from '@/components/transaction-dialog'import { TransferDialog } from '@/components/transfer-dialog'@@ -22,6 +24,7 @@ import { Input } from '@/components/ui/input'import { Label } from '@/components/ui/label'import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'import { usePrivacyMode } from '@/hooks/use-privacy-mode'+import { useIsMobile } from '@/hooks/use-mobile'import { useAuth } from '@/contexts/auth-context'import { useWorkspace } from '@/contexts/workspace-context'import { resolveDateFnsLocale } from '@/lib/date-fns-locale'@@ -29,6 +32,7 @@ import { formatCurrency } from '@/lib/format'import {AreaChart,Area,+ Line,XAxis,YAxis,Tooltip,@@ -270,6 +274,7 @@ export default function AccountDetailPage() {const userCurrency = user?.preferences?.currency_display ?? 'USD'const locale = useDisplayLocale()const dateLocale = useDateLocale()+ const isMobile = useIsMobile()const queryClient = useQueryClient()const [dialogOpen, setDialogOpen] = useState(false)const [editingTx, setEditingTx] = useState<Transaction | null>(null)@@ -462,19 +467,19 @@ export default function AccountDetailPage() {if (account.statement_close_day) {cycles.push(creditCardCycleBoundaries(account.statement_close_day, new Date()))}- return cycles.slice(-6)+ return cycles.slice(isMobile ? -4 : -6)}if (!account.statement_close_day) return []const cycles: { start: string; end: string }[] = []let ref = new Date()- for (let i = 0; i < 6; i++) {+ for (let i = 0; i < (isMobile ? 4 : 6); i++) {const c = creditCardCycleBoundaries(account.statement_close_day, ref)cycles.unshift(c)ref = new Date(parseISO(c.start + 'T00:00:00').getTime() - 86400000)}return cycles- }, [account, billsAsc])+ }, [account, billsAsc, isMobile])const timelineQueries = useQueries({queries: timelineCycles.map(c => ({@@ -725,6 +730,30 @@ export default function AccountDetailPage() {: { start: defaultFrom(), end: defaultTo() }const hasFilters = filterFrom !== resolvedDefaultRange.start || filterTo !== resolvedDefaultRange.end+ // The mobile transaction view is intentionally grouped by day so the date+ // remains visible without spending a full column on every row.+ const groupedByDate = useMemo(() => {+ const groups: { date: string; label: string; items: TxWithBalance[] }[] = []+ let current: { date: string; label: string; items: TxWithBalance[] } | null = null+ for (const tx of txWithRunningBalance) {+ if (!current || current.date !== tx.date) {+ current = {+ date: tx.date,+ label: new Date(tx.date + 'T00:00:00').toLocaleDateString(dateLocale, {+ weekday: 'short',+ day: 'numeric',+ month: 'short',+ year: 'numeric',+ }),+ items: [],+ }+ groups.push(current)+ }+ current.items.push(tx)+ }+ return groups+ }, [txWithRunningBalance, dateLocale])+const isLoading = accountLoading || summaryLoadingif (isLoading) {@@ -760,7 +789,7 @@ export default function AccountDetailPage() {<h1 className="text-2xl sm:text-3xl font-semibold text-foreground tracking-tight truncate">{getAccountName(account)}</h1>- <div className="flex items-center gap-2 mt-1 flex-wrap">+ <div className="flex items-center gap-2 mt-1 overflow-hidden"><span className="text-xs font-medium text-muted-foreground">{t(`accounts.type${account.type.split('_').map(s => s[0].toUpperCase() + s.slice(1)).join('')}`, account.type)}</span>@@ -811,7 +840,7 @@ export default function AccountDetailPage() {</Button>)}</div>- <div className="flex items-center gap-2 sm:gap-3 flex-wrap">+ <div className="flex items-center gap-2 sm:gap-3">{isCreditCard ? (<div className="flex items-center gap-1"><button@@ -887,7 +916,7 @@ export default function AccountDetailPage() {<Buttonvariant="ghost"size="sm"- className="text-muted-foreground hover:text-foreground"+ className="text-muted-foreground hover:text-foreground min-h-[44px] min-w-[44px] px-3 shrink-0"onClick={() => {filterTouched.current = falseif (account?.type === 'credit_card') {@@ -904,8 +933,8 @@ export default function AccountDetailPage() {}}}>- <X className="h-3.5 w-3.5 mr-1" />- {t('transactions.clearFilters')}+ <X className="h-3.5 w-3.5 sm:mr-1" />+ <span className="hidden sm:inline">{t('transactions.clearFilters')}</span></Button>)}{isForeignCurrency && (@@ -1072,11 +1101,11 @@ export default function AccountDetailPage() {: nullreturn (<div className="grid grid-cols-3 gap-2 sm:gap-4 mb-6">- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 truncate">{t('accounts.cycleBillTotal')}</p>- <p className="text-base sm:text-2xl font-bold tabular-nums text-foreground">+ <p className="text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums text-foreground">{mask(formatCurrency(billTotal, displayCurrency, locale))}</p>{deltaPct != null && prevCycleLabel && (@@ -1085,24 +1114,24 @@ export default function AccountDetailPage() {</p>)}</div>- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 flex items-center gap-1.5">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 flex items-center gap-1 truncate">{t('accounts.availableCredit')}- <span className="inline-flex items-center px-1 py-0 rounded text-[9px] font-bold uppercase tracking-wide bg-muted text-muted-foreground">+ <span className="inline-flex items-center px-1 py-0 rounded text-[8px] sm:text-[9px] font-bold uppercase tracking-wide bg-muted text-muted-foreground shrink-0">{t('accounts.currentTag')}</span></p>- <p className="text-base sm:text-2xl font-bold tabular-nums text-emerald-600">+ <p className="text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums text-emerald-600">{account.available_credit != null? mask(formatCurrency(Number(account.available_credit), account.currency, locale)): '—'}</p></div>- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 truncate">{t('accounts.dueDate')}</p>- <p className="text-base sm:text-2xl font-bold tabular-nums text-foreground">+ <p className="text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums text-foreground">{cycleDueDate ? formatFriendlyDate(cycleDueDate, dateLocale) : '—'}</p>{dueSubtitle && (@@ -1114,34 +1143,34 @@ export default function AccountDetailPage() {</div>)})() : (- <div className="grid grid-cols-3 gap-2 sm:gap-4 mb-6">- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1">+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-4 mb-6">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 truncate">{t('accounts.currentBalance')}</p>- <p className={`text-base sm:text-2xl font-bold tabular-nums ${(summary?.current_balance ?? 0) < 0 ? 'text-rose-500' : 'text-foreground'}`}>+ <p className={`text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums ${(summary?.current_balance ?? 0) < 0 ? 'text-rose-500' : 'text-emerald-600'}`}>{mask(formatCurrency((showPrimary ? summary?.current_balance_primary : undefined) ?? summary?.current_balance ?? 0,displayCurrency, locale))}</p></div>- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 truncate">{t('accounts.income')}</p>- <p className="text-base sm:text-2xl font-bold tabular-nums text-emerald-600">+ <p className="text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums text-emerald-600">{mask(formatCurrency((showPrimary ? summary?.monthly_income_primary : undefined) ?? summary?.monthly_income ?? 0,displayCurrency, locale))}</p></div>- <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4">- <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1">+ <div className="bg-card rounded-xl border border-border shadow-sm p-3 sm:p-4 overflow-hidden">+ <p className="text-[10px] sm:text-xs font-medium text-muted-foreground mb-1 truncate">{t('accounts.expenses')}</p>- <p className="text-base sm:text-2xl font-bold tabular-nums text-rose-500">+ <p className="text-[length:clamp(0.7rem,3.5vw,1.25rem)] sm:text-2xl font-bold tabular-nums text-rose-500">{mask(formatCurrency((showPrimary ? summary?.monthly_expenses_primary : undefined) ?? summary?.monthly_expenses ?? 0,displayCurrency, locale@@ -1246,6 +1275,22 @@ export default function AccountDetailPage() {{/* Balance / Cycle spending chart */}{(() => {const cycleEmpty = isCreditCard && chartData.length > 0 && chartData[chartData.length - 1].balance === 0+ const balances = chartData.map(d => d.balance)+ const chartMin = Math.min(0, ...balances)+ const chartMax = Math.max(0, ...balances)+ const dataMin = balances.length > 0 ? Math.min(...balances) : 0+ const dataMax = balances.length > 0 ? Math.max(...balances) : 0+ const flat = chartMin === chartMax+ const zeroFrac = flat+ ? 1+ : Math.min(1, Math.max(0, chartMax / (chartMax - chartMin)))+ const crossesZero = dataMin < 0 && dataMax > 0+ const strokeSplit = crossesZero+ ? Math.min(1, Math.max(0, dataMax / (dataMax - dataMin)))+ : 1+ const strokeSplitFrac = flat ? 1 : Math.min(1, strokeSplit + 0.01)+ const strokeSolid = dataMin >= 0 ? '#10B981' : '#F43F5E'+ const lastBalance = balances.length > 0 ? balances[balances.length - 1] : 0return (<div className="bg-card rounded-xl border border-border shadow-sm mb-6"><div className="px-5 pt-5 pb-3">@@ -1268,10 +1313,35 @@ export default function AccountDetailPage() {margin={{ top: 4, right: 8, left: 0, bottom: 0 }}><defs>- <linearGradient id="acctBalGrad" x1="0" y1="0" x2="0" y2="1">- <stop offset="5%" stopColor={isCreditCard ? '#F43F5E' : '#10B981'} stopOpacity={0.18} />- <stop offset="95%" stopColor={isCreditCard ? '#F43F5E' : '#10B981'} stopOpacity={0.02} />- </linearGradient>+ {isCreditCard ? (+ <linearGradient id="acctBalGrad" x1="0" y1="0" x2="0" y2="1">+ <stop offset="5%" stopColor="#F43F5E" stopOpacity={0.18} />+ <stop offset="95%" stopColor="#F43F5E" stopOpacity={0.02} />+ </linearGradient>+ ) : (+ <>+ <linearGradient id="acctBalGrad" x1="0" y1="0" x2="0" y2="1">+ {crossesZero || dataMin >= 0 ? (+ <>+ <stop offset="0%" stopColor="#10B981" stopOpacity={0.18} />+ <stop offset={`${zeroFrac * 100}%`} stopColor="#10B981" stopOpacity={0.02} />+ </>+ ) : null}+ {crossesZero || dataMax <= 0 ? (+ <>+ <stop offset={`${zeroFrac * 100}%`} stopColor="#F43F5E" stopOpacity={0.02} />+ <stop offset="100%" stopColor="#F43F5E" stopOpacity={0.18} />+ </>+ ) : null}+ </linearGradient>+ {crossesZero && (+ <linearGradient id="acctBalStroke" x1="0" y1="0" x2="0" y2="1">+ <stop offset={`${strokeSplitFrac * 100}%`} stopColor="#10B981" />+ <stop offset={`${strokeSplitFrac * 100}%`} stopColor="#F43F5E" />+ </linearGradient>+ )}+ </>+ )}</defs><XAxisdataKey="label"@@ -1294,7 +1364,7 @@ export default function AccountDetailPage() {tickCount={5}domain={[(dataMin: number) => dataMin < 0 ? Math.floor(dataMin / 100) * 100 : 0,- (dataMax: number) => Math.ceil(dataMax / 100) * 100,+ (dataMax: number) => dataMax === 0 ? 100 : Math.ceil(dataMax / 100) * 100,]}/><Tooltip@@ -1315,11 +1385,17 @@ export default function AccountDetailPage() {<Areatype="monotone"dataKey="balance"- stroke={isCreditCard ? '#F43F5E' : '#10B981'}+ stroke="none"+ tooltipType="none"+ fill={flat ? '#10B981' : 'url(#acctBalGrad)'}+ />+ <Line+ type="monotone"+ dataKey="balance"+ stroke={isCreditCard ? '#F43F5E' : (crossesZero ? 'url(#acctBalStroke)' : strokeSolid)}strokeWidth={2}- fill="url(#acctBalGrad)"dot={false}- activeDot={{ r: 3, fill: isCreditCard ? '#F43F5E' : '#10B981' }}+ activeDot={{ r: 3, fill: isCreditCard ? '#F43F5E' : (lastBalance >= 0 ? '#10B981' : '#F43F5E') }}/></AreaChart></ResponsiveContainer>@@ -1343,16 +1419,53 @@ export default function AccountDetailPage() {</div>) : txWithRunningBalance.length === 0 ? (<p className="p-6 text-center text-muted-foreground">{t('accounts.noTransactions')}</p>+ ) : isMobile ? (+ <div>+ {groupedByDate.map((group) => (+ <div key={group.date}>+ <div className="bg-muted/80 px-4 py-1.5 border-b border-border">+ <span className="text-xs font-semibold text-muted-foreground uppercase tracking-wider">+ {group.label}+ </span>+ </div>+ {group.items.map((tx) => (+ <MobileTransactionRow+ key={tx.id}+ tx={tx}+ account={account}+ groupName={undefined}+ selected={false}+ selectable={false}+ canWrite={canWrite}+ highlighted={false}+ locale={locale}+ userCurrency={userCurrency}+ onSelect={() => {}}+ showPayee+ onClick={(clickedTx) => {+ // The opening-balance row is synthetic; the desktop+ // table makes it non-clickable and mobile must match.+ if (clickedTx.source === 'opening_balance') return+ if (!clickedTx.is_shared && canWrite) {+ setEditingTx(clickedTx)+ setDialogOpen(true)+ }+ }}+ />+ ))}+ </div>+ ))}+ </div>) : (<div className="overflow-x-auto"><table className="w-full text-sm"><thead><tr className="border-b">- <th className="px-3 sm:px-4 py-3 text-left font-medium">{t('transactions.date')}</th>- <th className="px-3 sm:px-4 py-3 text-left font-medium">{t('transactions.description')}</th>- <th className="px-4 py-3 text-left font-medium hidden md:table-cell">{t('transactions.category')}</th>- <th className="px-3 sm:px-4 py-3 text-right font-medium">{t('transactions.amount')}</th>- <th className="px-4 py-3 text-right font-medium hidden sm:table-cell">{t('accounts.runningBalance')}</th>+ <th className="px-2 sm:px-4 py-3 text-left font-medium whitespace-nowrap">{t('transactions.date')}</th>+ <th className="px-2 sm:px-4 py-3 text-left font-medium">{t('transactions.description')}</th>+ <th className="px-2 sm:px-4 py-3 text-left font-medium hidden md:table-cell">{t('transactions.category')}</th>+ <th className="px-2 sm:px-4 py-3 text-right font-medium whitespace-nowrap">{t('transactions.amount')}</th>+ <th className="px-2 sm:px-4 py-3 text-right font-medium hidden sm:table-cell whitespace-nowrap">{t('accounts.runningBalance')}</th></tr></thead><tbody>@@ -1375,9 +1488,10 @@ export default function AccountDetailPage() {<td className="px-3 sm:px-4 py-3 text-xs text-muted-foreground whitespace-nowrap">{formatDateStr(tx.date, dateLocale)}</td>- <td className="px-3 sm:px-4 py-3">- <div>- <span className="font-semibold text-foreground text-sm">{tx.description}</span>+ <td className="px-3 sm:px-4 py-3 w-full max-w-0">+ <div className="flex items-center gap-1.5 min-w-0">+ <span className="font-semibold text-foreground text-sm truncate">{tx.description}</span>+ <div className="flex items-center gap-1 shrink-0">{isOpening && (<span className="ml-2 text-xs text-muted-foreground font-normal border border-border rounded px-1.5 py-0.5">{t('accounts.openingBalance')}@@ -1390,12 +1504,6 @@ export default function AccountDetailPage() {<span title={t('transactions.transferTooltip')}><HelpCircle className="h-3 w-3 text-blue-400" /></span></span>)}- {isPending && (- <span className="ml-2 inline-flex items-center gap-1 text-xs text-amber-600 font-normal bg-amber-50 border border-amber-200 rounded px-1.5 py-0.5">- <Clock className="h-3 w-3" />- {t('transactions.pending')}- </span>- )}{isIgnored && (<span className="ml-2 inline-flex items-center gap-1 text-xs text-gray-600 font-normal bg-gray-100 border border-gray-200 rounded px-1.5 py-0.5"><EyeClosed className="h-3 w-3" />@@ -1403,6 +1511,14 @@ export default function AccountDetailPage() {<span title={t('transactions.ignoreTransferHint')}><HelpCircle className="h-3 w-3 text-blue-400" /></span></span>)}+ {tx.recurring_transaction_id != null && (+ <span+ className="text-[10px] font-semibold uppercase tracking-wide text-primary bg-primary/5 border border-primary/10 px-1.5 py-0.5 rounded-full shrink-0"+ title={t('transactions.recurringLinkedTooltip')}+ >+ {t('transactions.recurringBadge')}+ </span>+ )}{tx.installment_number != null && tx.total_installments != null && (<spanclassName="ml-2 inline-flex items-center text-[10px] font-bold tabular-nums text-amber-700 dark:text-amber-400 bg-amber-100 dark:bg-amber-500/20 border border-amber-200 dark:border-amber-500/30 px-1.5 py-0.5 rounded-full"@@ -1413,6 +1529,14 @@ export default function AccountDetailPage() {{tx.installment_number}/{tx.total_installments}</span>)}+ {shouldShowPendingBadge(tx) && (+ <span+ title={t('transactions.pending')}+ className="shrink-0 inline-flex items-center justify-center rounded-full border border-amber-200 bg-amber-50 p-0.5 dark:border-amber-500/30 dark:bg-amber-500/10"+ >+ <Clock size={12} className="text-amber-500" role="img" aria-label={t('transactions.pending')} />+ </span>+ )}{tx.effective_bill_date && (<spanclassName="ml-2 inline-flex items-center gap-1 text-xs text-violet-600 dark:text-violet-400 font-normal bg-violet-50 dark:bg-violet-500/10 border border-violet-200 dark:border-violet-500/30 rounded px-1.5 py-0.5"@@ -1425,9 +1549,10 @@ export default function AccountDetailPage() {{(tx.attachment_count ?? 0) > 0 && (<Paperclip size={12} className="ml-2 inline text-muted-foreground" />)}+ </div></div>{(tx.payee_name || tx.payee) && (tx.payee_name || tx.payee) !== tx.description && (- <p className="text-xs text-muted-foreground mt-0.5">{tx.payee_name || tx.payee}</p>+ <p className="text-xs text-muted-foreground mt-0.5 truncate">{tx.payee_name || tx.payee}</p>)}</td><td className="px-4 py-3 hidden md:table-cell">@@ -1440,7 +1565,7 @@ export default function AccountDetailPage() {<span className="text-muted-foreground">—</span>)}</td>- <td className={`px-3 sm:px-4 py-3 text-right text-xs sm:text-sm font-semibold tabular-nums ${tx.is_ignored ? 'text-gray-500' : tx.type === 'credit' ? 'text-emerald-600' : 'text-rose-500'}`}>+ <td className={`px-2 sm:px-4 py-3 text-right text-xs sm:text-sm font-semibold tabular-nums whitespace-nowrap ${tx.is_ignored ? 'text-gray-500' : tx.type === 'credit' ? 'text-emerald-600' : 'text-rose-500'}`}>{mask(`${tx.is_ignored ? ' ' : tx.type === 'credit' ? '+' : '-'}${formatCurrency(Math.abs(Number(tx.amount)), tx.currency, locale)}`)}{tx.currency !== userCurrency && tx.amount_primary != null && (<span className="block text-[10px] text-muted-foreground tabular-nums">@@ -1448,7 +1573,7 @@ export default function AccountDetailPage() {</span>)}</td>- <td className={`px-4 py-3 text-right tabular-nums text-sm hidden sm:table-cell ${(account.type === 'credit_card' ? tx.runningBalance > 0 : tx.runningBalance < 0) ? 'text-rose-500' : 'text-muted-foreground'}`}>+ <td className={`px-4 py-3 text-right tabular-nums text-sm hidden sm:table-cell whitespace-nowrap ${(account.type === 'credit_card' ? tx.runningBalance > 0 : tx.runningBalance < 0) ? 'text-rose-500' : 'text-muted-foreground'}`}>{mask(formatCurrency(tx.runningBalance, displayCurrency, locale))}</td></tr>diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsxindex e924f8f0..c7c624a6 100644--- a/frontend/src/pages/dashboard.tsx+++ b/frontend/src/pages/dashboard.tsx@@ -1096,7 +1096,7 @@ export default function DashboardPage() {</span>)}{row.isProjected && (- <span className="inline-flex items-center text-[9px] font-semibold uppercase tracking-wide text-primary bg-primary/5 border border-primary/10 px-1 py-0.5 rounded-full shrink-0">+ <span className="inline-flex items-center text-[10px] font-semibold uppercase tracking-wide text-primary bg-primary/5 border border-primary/10 px-1.5 py-0.5 rounded-full shrink-0">{t('transactions.recurringBadge')}</span>)}diff --git a/frontend/src/pages/transactions.tsx b/frontend/src/pages/transactions.tsxindex af166ef3..01d128ee 100644--- a/frontend/src/pages/transactions.tsx+++ b/frontend/src/pages/transactions.tsx@@ -35,7 +35,7 @@ import {TableRow,} from '@/components/ui/table'import { Skeleton } from '@/components/ui/skeleton'-import { AlertTriangle, ArrowLeftRight, ArrowUp, ArrowDown, Check, HelpCircle, Info, Paperclip, Trash2, Users, X, EyeClosed, SlidersHorizontal } from 'lucide-react'+import { AlertTriangle, ArrowLeftRight, ArrowUp, ArrowDown, Check, Clock, HelpCircle, Info, Paperclip, Trash2, Users, X, EyeClosed, SlidersHorizontal } from 'lucide-react'import type { Transaction, Rule, InstallmentSeriesInput, TransactionApplyScope, TransactionEditPayload } from '@/types'import { RuleDialog, type RuleDialogInitialData } from '@/components/rule-dialog'import { PageHeader } from '@/components/page-header'@@ -60,6 +60,7 @@ import { useAuth } from '@/contexts/auth-context'import { useWorkspace } from '@/contexts/workspace-context'import { useCollectionFilter } from '@/contexts/collection-filter-context'import { formatCurrency } from '@/lib/format'+import { shouldShowPendingBadge } from '@/lib/transaction-status'type TransactionUpdatePayload = TransactionEditPayload & {apply_to_transfer_pair?: boolean@@ -1104,6 +1105,14 @@ export default function TransactionsPage() {{tx.installment_number}/{tx.total_installments}</span>)}+ {shouldShowPendingBadge(tx) && (+ <span+ title={t('transactions.pending')}+ className="shrink-0 inline-flex items-center justify-center rounded-full border border-amber-200 bg-amber-50 p-0.5 dark:border-amber-500/30 dark:bg-amber-500/10"+ >+ <Clock size={12} className="text-amber-500" role="img" aria-label={t('transactions.pending')} />+ </span>+ )}{(tx.attachment_count ?? 0) > 0 && (<Paperclip size={12} className="text-muted-foreground shrink-0" />)}