Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat(mobile): add mobile transaction cards with pending/posted status (#507)

Leonardo Zanivan21d87ac6aec3
diff --git a/backend/app/api/transactions.py b/backend/app/api/transactions.py
index 7601da51..ac758489 100644
--- a/backend/app/api/transactions.py
+++ b/backend/app/api/transactions.py
@@ -92,6 +92,7 @@ async def list_transactions(
q: Optional[str] = Query(None),
uncategorized: bool = Query(False),
type: Optional[str] = Query(None),
+ status: Optional[str] = Query(None, description="Filter by transaction status (posted|pending)"),
page: int = Query(1, ge=1),
limit: int = Query(50, ge=1, le=500),
include_opening_balance: bool = Query(False),
@@ -114,6 +115,7 @@ async def list_transactions(
include_opening_balance=include_opening_balance, search=q, uncategorized=uncategorized,
txn_type=type, exclude_transfers=exclude_transfers,
user_pnl_only=user_pnl_only,
+ status=status,
accounting_mode=accounting_mode,
tags=tags,
bill_id=bill_id,
@@ -164,6 +166,7 @@ async def export_transactions(
q: Optional[str] = Query(None),
uncategorized: bool = Query(False),
type: Optional[str] = Query(None),
+ status: Optional[str] = Query(None),
tags: Optional[List[str]] = Query(None),
transaction_ids: Optional[List[uuid.UUID]] = Query(None, description="If set, exports exactly these rows (scoped to the workspace); other filters are ignored."),
ctx: WorkspaceContext = Depends(current_workspace),
@@ -185,7 +188,7 @@ async def export_transactions(
account_ids=_merge_id_filters(account_id, account_ids),
category_ids=_merge_id_filters(category_id, category_ids),
payee_id=payee_id, from_date=from_date, to_date=to_date,
- search=q, uncategorized=uncategorized, txn_type=type, skip_pagination=True,
+ search=q, uncategorized=uncategorized, txn_type=type, status=status, skip_pagination=True,
accounting_mode=accounting_mode,
tags=tags,
)
diff --git a/backend/app/schemas/transaction.py b/backend/app/schemas/transaction.py
index 2d43cdc1..63f9700a 100644
--- a/backend/app/schemas/transaction.py
+++ b/backend/app/schemas/transaction.py
@@ -34,6 +34,11 @@ class TransactionCreate(TransactionBase):
fx_rate_used: Optional[Decimal] = None
effective_bill_date: Optional[_Date] = None
splits: Optional[TransactionSplitsInput] = None
+ # Manual status override. When omitted the transaction is created as
+ # "posted" (settled), matching the model default. Pass "pending"
+ # (not yet settled) to record an entry that isn't settled yet. Only
+ # posted/pending are valid.
+ status: Optional[Literal["posted", "pending"]] = None
class TransactionUpdate(BaseModel):
@@ -49,6 +54,10 @@ class TransactionUpdate(BaseModel):
amount_primary: Optional[Decimal] = None
fx_rate_used: Optional[Decimal] = None
is_ignored: Optional[bool] = None
+ # Manual status override (posted=settled, pending=not yet settled). Lets the
+ # user mark a manually-entered transaction as settled once it clears,
+ # or flip a synced row back to pending before the next sync.
+ status: Optional[Literal["posted", "pending"]] = None
apply_to_transfer_pair: bool = False
# CC bucketing override (issue #92). Empty string / explicit null clears
# it back to auto. Only meaningful for credit-card accounts.
diff --git a/backend/app/services/dashboard_service.py b/backend/app/services/dashboard_service.py
index b7d598e8..1a320b19 100644
--- a/backend/app/services/dashboard_service.py
+++ b/backend/app/services/dashboard_service.py
@@ -156,6 +156,8 @@ async def get_summary(
# don't inflate the month's income figure. counts_as_user_pnl() skips
# paired transfers, transfer-like categories AND settlement movements
# (whose offset is already in the owner's share, see share-only model).
+ # Only posted (settled) transactions count; pending entries stay out of
+ # the period totals until they post.
monthly_result = await session.execute(
select(
func.sum(case((Transaction.type == "credit", Transaction.amount), else_=0)),
@@ -168,6 +170,7 @@ async def get_summary(
report_date >= month_start,
report_date < month_end,
Transaction.source != "opening_balance",
+ Transaction.status == "posted",
counts_as_user_pnl(),
*acct_filter,
)
@@ -276,7 +279,8 @@ async def get_summary(
monthly_income_primary = real_monthly_income
monthly_expenses_primary = abs(real_monthly_expenses)
- # Use amount_primary sums for more accurate multi-currency income/expenses
+ # Use amount_primary sums for more accurate multi-currency income/expenses.
+ # Same posted-only rule as the native-currency totals above.
primary_result = await session.execute(
select(
func.sum(case((Transaction.type == "credit", Transaction.amount_primary), else_=0)),
@@ -289,6 +293,7 @@ async def get_summary(
report_date >= month_start,
report_date < month_end,
Transaction.source != "opening_balance",
+ Transaction.status == "posted",
counts_as_user_pnl(),
Transaction.amount_primary.isnot(None),
*acct_filter,
diff --git a/backend/app/services/transaction_service.py b/backend/app/services/transaction_service.py
index 1e46ea06..a0b5b85c 100644
--- a/backend/app/services/transaction_service.py
+++ b/backend/app/services/transaction_service.py
@@ -115,6 +115,7 @@ async def get_transactions(
min_amount: Optional[float] = None,
max_amount: Optional[float] = None,
account_types: Optional[list[str]] = None,
+ status: Optional[str] = None,
include_summary: bool = False,
user_pnl_only: bool = False,
) -> tuple[list[Transaction], int, Optional[dict]]:
@@ -253,6 +254,8 @@ async def get_transactions(
base_query = base_query.where(Account.is_closed == False, counts_as_user_pnl())
if txn_type:
base_query = base_query.where(Transaction.type == txn_type)
+ if status:
+ base_query = base_query.where(Transaction.status == status)
if currency:
# Native-currency filter — match the column verbatim. Lets agents
# answer "do I have any EUR transactions?" without text-searching
@@ -701,6 +704,10 @@ async def create_transaction(
date=data.date,
type=data.type,
source="manual",
+ # Manually-entered transactions default to "posted" (settled),
+ # matching the model default. Callers may still create them as
+ # "pending" (not yet settled) via TransactionCreate.status.
+ status=data.status or "posted",
notes=data.notes,
effective_bill_date=data.effective_bill_date,
)
diff --git a/backend/mcp_server/tools/transactions.py b/backend/mcp_server/tools/transactions.py
index 05c6983a..459c571b 100644
--- a/backend/mcp_server/tools/transactions.py
+++ b/backend/mcp_server/tools/transactions.py
@@ -64,6 +64,7 @@ from mcp_server.tools._helpers import num, parse_date, parse_uuid, parse_uuid_li
"description": "Maximum absolute amount (primary-currency view).",
},
"tx_type": {"type": "string", "enum": ["debit", "credit"], "description": "debit = expense, credit = income"},
+ "status": {"type": "string", "enum": ["posted", "pending"], "description": "Filter by posting status: posted = settled, pending = not yet settled."},
"uncategorized": {"type": "boolean", "default": False, "description": "Only transactions without a category"},
"exclude_transfers": {"type": "boolean", "default": False, "description": "Exclude transfers between user's own accounts"},
"tags": {"type": "array", "items": {"type": "string"}, "description": "Match any of these tags"},
@@ -108,6 +109,7 @@ async def list_transactions(
min_amount: float | None = None,
max_amount: float | None = None,
tx_type: str | None = None,
+ status: str | None = None,
uncategorized: bool = False,
exclude_transfers: bool = False,
tags: list[str] | None = None,
@@ -137,6 +139,7 @@ async def list_transactions(
min_amount=float(min_amount) if min_amount is not None else None,
max_amount=float(max_amount) if max_amount is not None else None,
txn_type=tx_type,
+ status=status,
uncategorized=uncategorized,
exclude_transfers=exclude_transfers,
tags=tags or None,
diff --git a/backend/tests/test_dashboard_service.py b/backend/tests/test_dashboard_service.py
index 433a7315..e4289565 100644
--- a/backend/tests/test_dashboard_service.py
+++ b/backend/tests/test_dashboard_service.py
@@ -52,7 +52,7 @@ async def _add_txn(
session: AsyncSession, user_id: uuid.UUID, account_id: uuid.UUID,
amount: float, txn_type: str, txn_date: date,
source: str = "manual", transfer_pair_id: uuid.UUID | None = None,
- category_id: uuid.UUID | None = None,
+ category_id: uuid.UUID | None = None, status: str = "posted",
) -> Transaction:
from datetime import datetime, timezone
txn = Transaction(
@@ -60,6 +60,7 @@ async def _add_txn(
description=f"Test {txn_type} {amount}", amount=Decimal(str(amount)),
date=txn_date, type=txn_type, source=source, currency="BRL",
transfer_pair_id=transfer_pair_id, category_id=category_id,
+ status=status,
created_at=datetime.now(timezone.utc),
)
session.add(txn)
@@ -293,6 +294,24 @@ async def test_get_summary_excludes_transfers(session: AsyncSession, test_user,
assert summary.monthly_expenses == pytest.approx(100.0)
+async def test_get_summary_excludes_pending_from_period_totals(
+ session: AsyncSession, test_user, test_workspace
+):
+ """Pending (not yet settled) transactions stay out of monthly income/expenses."""
+ account = await _make_account(session, test_user.id, "Pending Excl")
+ today = date.today()
+
+ await _add_txn(session, test_user.id, account.id, 100, "debit", today)
+ await _add_txn(session, test_user.id, account.id, 50, "credit", today)
+ await _add_txn(session, test_user.id, account.id, 10000, "debit", today, status="pending")
+ await _add_txn(session, test_user.id, account.id, 9000, "credit", today, status="pending")
+
+ summary = await get_summary(session, test_workspace.id, test_user.id)
+ assert summary.monthly_expenses == pytest.approx(100.0)
+ assert summary.monthly_income == pytest.approx(50.0)
+
+
@pytest.mark.asyncio
async def test_get_summary_pending_categorization(session: AsyncSession, test_user, test_workspace):
"""Summary counts uncategorized transactions."""
diff --git a/backend/tests/test_transaction_service.py b/backend/tests/test_transaction_service.py
index 6c0b18e8..e8103393 100644
--- a/backend/tests/test_transaction_service.py
+++ b/backend/tests/test_transaction_service.py
@@ -70,9 +70,44 @@ async def test_create_transaction_manual(
assert txn.id is not None
assert txn.description == "Lunch"
assert txn.source == "manual"
+ assert txn.status == "posted"
assert txn.category_id == test_categories[0].id
+async def test_create_transaction_manual_status_override(
+ session: AsyncSession, test_user, test_workspace, test_categories, txn_account
+):
+ """Creating a manual transaction can set status explicitly (posted/pending)."""
+ data = TransactionCreate(
+ description="Rent",
+ amount=Decimal("1200.00"),
+ date=date(2025, 3, 1),
+ type="debit",
+ account_id=txn_account.id,
+ category_id=test_categories[0].id,
+ status="posted",
+ )
+ txn = await create_transaction(session, test_workspace.id, test_user.id, data)
+
+ assert txn.source == "manual"
+ assert txn.status == "posted"
+
+ pending = TransactionCreate(
+ description="Groceries",
+ amount=Decimal("80.00"),
+ date=date(2025, 3, 2),
+ type="debit",
+ account_id=txn_account.id,
+ category_id=test_categories[0].id,
+ status="pending",
+ )
+ pending_txn = await create_transaction(session, test_workspace.id, test_user.id, pending)
+
+ assert pending_txn.source == "manual"
+ assert pending_txn.status == "pending"
+
+
@pytest.mark.asyncio
async def test_create_transaction_honors_effective_bill_date(
session: AsyncSession, test_user, test_workspace
@@ -483,6 +518,44 @@ async def test_get_transactions_filter_by_type(
assert all(t.type == "credit" for t in results)
+async def test_get_transactions_filter_by_status(session: AsyncSession, test_user, test_workspace, txn_account):
+ txn_pending = Transaction(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ account_id=txn_account.id,
+ description="Pending",
+ amount=Decimal("50"),
+ date=date(2025, 3, 1),
+ type="debit",
+ source="manual",
+ status="pending",
+ created_at=datetime.now(timezone.utc),
+ )
+ txn_posted = Transaction(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ account_id=txn_account.id,
+ description="Posted",
+ amount=Decimal("1000"),
+ date=date(2025, 3, 1),
+ type="debit",
+ source="manual",
+ status="posted",
+ created_at=datetime.now(timezone.utc),
+ )
+ session.add_all([txn_pending, txn_posted])
+ await session.commit()
+
+ results, _, _ = await get_transactions(session, test_workspace.id, test_user.id, status="pending")
+ assert results
+ assert all(t.status == "pending" for t in results)
+
+ results, _, _ = await get_transactions(session, test_workspace.id, test_user.id, status="posted")
+ assert results
+ assert all(t.status == "posted" for t in results)
+
+
# ---------------------------------------------------------------------------
# get_transaction / update_transaction / delete_transaction
# ---------------------------------------------------------------------------
@@ -555,6 +628,45 @@ async def test_update_transaction_not_found(session: AsyncSession, test_user, te
assert result is None
+async def test_update_transaction_status(session: AsyncSession, test_user, test_workspace, txn_account):
+ """Manual transactions can be flipped between pending and posted via TransactionUpdate.status."""
+ txn = Transaction(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ account_id=txn_account.id,
+ description="Lunch",
+ amount=Decimal("35.00"),
+ date=date(2025, 3, 10),
+ type="debit",
+ source="manual",
+ status="pending",
+ created_at=datetime.now(timezone.utc),
+ )
+ session.add(txn)
+ await session.commit()
+
+ updated = await update_transaction(
+ session,
+ txn.id,
+ test_workspace.id,
+ test_user.id,
+ TransactionUpdate(status="posted"),
+ )
+ assert updated is not None
+ assert updated.status == "posted"
+
+ flipped = await update_transaction(
+ session,
+ txn.id,
+ test_workspace.id,
+ test_user.id,
+ TransactionUpdate(status="pending"),
+ )
+ assert flipped is not None
+ assert flipped.status == "pending"
+
+
@pytest.mark.asyncio
async def test_delete_transaction(session: AsyncSession, test_user, test_workspace, txn_account):
txn = Transaction(
diff --git a/frontend/src/components/mobile-transaction-row.tsx b/frontend/src/components/mobile-transaction-row.tsx
new file mode 100644
index 00000000..04a62aad
--- /dev/null
+++ b/frontend/src/components/mobile-transaction-row.tsx
@@ -0,0 +1,161 @@
+import { getAccountName } from '@/lib/account-utils'
+import { AccountIcon } from '@/components/account-icon'
+import { CategoryIcon } from '@/components/category-icon'
+import type { Transaction, Account } from '@/types'
+import { AlertTriangle, ArrowLeftRight, Clock, EyeClosed, Paperclip } from 'lucide-react'
+import { usePrivacyMode } from '@/hooks/use-privacy-mode'
+import { useTranslation } from 'react-i18next'
+
+function formatCurrency(value: number, currency = 'USD', locale = 'en-US') {
+ return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value)
+}
+
+interface MobileTransactionRowProps {
+ tx: Transaction
+ account: Account | undefined
+ groupName: string | undefined
+ selected: boolean
+ selectable: boolean
+ canWrite: boolean
+ highlighted: boolean
+ highlightedRowRef?: React.Ref<HTMLDivElement>
+ locale: string
+ userCurrency: string
+ onSelect: (id: string, shiftKey: boolean) => void
+ onClick: (tx: Transaction) => void
+}
+
+export function MobileTransactionRow({
+ tx,
+ account,
+ groupName,
+ selected,
+ selectable,
+ canWrite,
+ highlighted,
+ highlightedRowRef,
+ locale,
+ userCurrency,
+ onSelect,
+ onClick,
+}: MobileTransactionRowProps) {
+ const { mask } = usePrivacyMode()
+ const { t } = useTranslation()
+
+ const displayAmount = tx.is_shared && tx.viewer_share != null
+ ? Number(tx.viewer_share)
+ : Number(tx.amount)
+
+ const amountColor = tx.is_ignored
+ ? 'text-gray-500'
+ : tx.type === 'credit'
+ ? 'text-emerald-600'
+ : 'text-rose-500'
+
+ return (
+ <div
+ ref={highlighted ? highlightedRowRef : undefined}
+ className={`flex items-center gap-3 pl-3 pr-3 py-3 border-b border-border last:border-0 transition-colors ${
+ selected ? 'bg-primary/5' : 'bg-card'
+ } ${highlighted ? 'securo-highlight-flash' : ''} ${
+ tx.is_shared || !canWrite ? 'cursor-default' : 'cursor-pointer active:bg-muted/60'
+ }`}
+ onClick={() => {
+ if (tx.is_shared) return
+ if (!canWrite) return
+ onClick(tx)
+ }}
+ >
+ {/* Checkbox */}
+ {selectable && (
+ <div className="shrink-0">
+ <input
+ type="checkbox"
+ checked={selected}
+ onChange={() => {}}
+ onClick={(e) => {
+ e.stopPropagation()
+ onSelect(tx.id, e.shiftKey)
+ }}
+ className="h-4 w-4 rounded border-border accent-primary cursor-pointer"
+ />
+ </div>
+ )}
+
+ {/* Category Icon */}
+ <div className="shrink-0">
+ <CategoryIcon icon={tx.category?.icon} color={tx.category?.color} size="md" />
+ </div>
+
+ {/* Content */}
+ <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">
+ {tx.description}
+ </p>
+ {tx.group_id && (
+ <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">
+ {tx.is_shared && tx.parent_owner_name ? tx.parent_owner_name : t('splitGroups.ownerRowBadge', { group: groupName ?? '' })}
+ </span>
+ )}
+ {!!tx.transfer_pair_id && (
+ <ArrowLeftRight className="h-3 w-3 text-blue-600 shrink-0" />
+ )}
+ {tx.is_ignored && (
+ <EyeClosed className="h-3 w-3 text-gray-500 shrink-0" />
+ )}
+ {tx.recurring_transaction_id != null && (
+ <span className="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">
+ R
+ </span>
+ )}
+ {tx.installment_number != null && tx.total_installments != null && (
+ <span className="text-[9px] 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 py-0.5 rounded-full shrink-0">
+ {tx.installment_number}/{tx.total_installments}
+ </span>
+ )}
+ {tx.status === 'pending' && (
+ <Clock size={12} className="text-muted-foreground shrink-0" />
+ )}
+ {(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>
+ )}
+ </div>
+
+ {/* Amount */}
+ <div className="shrink-0 text-right">
+ <span className={`text-sm font-bold tabular-nums ${amountColor}`}>
+ {mask(
+ `${tx.is_ignored ? ' ' : tx.type === 'credit' ? '+' : '\u2212'}${formatCurrency(
+ Math.abs(displayAmount),
+ tx.currency,
+ locale,
+ )}`,
+ )}
+ </span>
+ {tx.amount_primary != null && tx.currency !== userCurrency && (
+ <div className="flex items-center justify-end gap-0.5 mt-0.5">
+ {tx.fx_fallback && (
+ <AlertTriangle size={10} className="text-amber-500 shrink-0" />
+ )}
+ <span className="text-[10px] text-muted-foreground tabular-nums">
+ {mask(formatCurrency(Math.abs(tx.amount_primary), userCurrency, locale))}
+ </span>
+ </div>
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/components/mobile-transactions-filter-menu.tsx b/frontend/src/components/mobile-transactions-filter-menu.tsx
index 3d5e3dab..1bccc1c4 100644
--- a/frontend/src/components/mobile-transactions-filter-menu.tsx
+++ b/frontend/src/components/mobile-transactions-filter-menu.tsx
@@ -7,6 +7,7 @@ import {
ChevronLeft,
ChevronRight,
Coins,
+ ListChecks,
Store,
Tag,
Users,
@@ -32,6 +33,7 @@ export type MobileFilterView =
| 'payee'
| 'group'
| 'type'
+ | 'status'
| 'date'
| 'amount'
@@ -57,6 +59,7 @@ interface MobileTransactionsFilterMenuProps {
payeeId: string
groupId: string
type: string
+ status: string
from: string
to: string
minAmount: string
@@ -74,6 +77,7 @@ interface MobileTransactionsFilterMenuProps {
onPayeeChange: (value: string) => void
onGroupIdChange: (value: string) => void
onTypeChange: (value: string) => void
+ onStatusChange: (value: string) => void
onDateRangeChange: (from: string, to: string) => void
onAmountRangeChange: (min: string, max: string) => void
onApplyAmountRange: () => void
@@ -433,6 +437,7 @@ function buildRootOptions(
{ view: 'payee', icon: Store, label: labels.payee, summary: summaries.payee },
{ view: 'group', icon: Users, label: labels.group, summary: summaries.group },
{ view: 'type', icon: ArrowUpDown, label: labels.type, summary: summaries.type },
+ { view: 'status', icon: ListChecks, label: labels.status, summary: summaries.status },
{ view: 'date', icon: CalendarIcon, label: labels.date, summary: summaries.date },
{ view: 'amount', icon: Coins, label: labels.amount, summary: summaries.amount },
]
@@ -447,6 +452,7 @@ function buildLabels(
payee: t('payees.payee'),
group: t('splitGroups.group'),
type: t('transactions.type'),
+ status: t('transactions.status'),
date: t('transactions.filtersBar.date'),
amount: t('transactions.filtersBar.amount'),
}
@@ -477,6 +483,10 @@ function MobileFilterDetail({
const options = [allOption, { value: 'credit', label: t('transactions.income') }, { value: 'debit', label: t('transactions.expense') }]
return <MobileSelectionView options={options} selectedValue={menu.type} onChange={menu.onTypeChange} />
}
+ if (menu.view === 'status') {
+ const options = [allOption, { value: 'pending', label: t('transactions.statusPending') }, { value: 'posted', label: t('transactions.statusPosted') }]
+ return <MobileSelectionView options={options} selectedValue={menu.status} onChange={menu.onStatusChange} />
+ }
if (menu.view === 'date') {
return <MobileDateView from={menu.from} to={menu.to} presets={menu.datePresets} onChange={menu.onDateRangeChange} onOpenCustomRange={menu.onOpenCustomRange} />
}
diff --git a/frontend/src/components/transaction-dialog.tsx b/frontend/src/components/transaction-dialog.tsx
index 1baae33a..41c16795 100644
--- a/frontend/src/components/transaction-dialog.tsx
+++ b/frontend/src/components/transaction-dialog.tsx
@@ -360,6 +360,7 @@ function TransactionForm({
const [amount, setAmount] = useState(seed?.amount?.toString() ?? '')
const [date, setDate] = useState(seed?.date ?? localDateString())
const [type, setType] = useState<'debit' | 'credit'>(seed?.type ?? 'debit')
+ const [status, setStatus] = useState<'posted' | 'pending'>(seed?.status ?? 'posted')
const [currency, setCurrency] = useState(seed?.currency ?? userCurrency)
const [categoryId, setCategoryId] = useState(seed?.category_id ?? '')
const [payeeId, setPayeeId] = useState(seed?.payee_id ?? '')
@@ -673,6 +674,9 @@ function TransactionForm({
account_id: accountId || undefined,
notes: notes.trim() || null,
is_ignored: isIgnored,
+ // Creation defaults to "posted" server-side; the user can
+ // override to "pending" right in the form (date & status row).
+ status,
...fxFields,
...overridePayload,
...splitsPayload,
@@ -689,7 +693,7 @@ function TransactionForm({
hasPreview && 'mt-4'
)}
>
- <div className="space-y-4 overflow-y-auto flex-1 min-h-0 pb-2 pr-3">
+ <div className="space-y-4 overflow-y-auto flex-1 min-h-0 pb-2 sm:pr-3">
{error && (
<div className="p-3 text-sm text-destructive bg-destructive/10 rounded-md">
{error}
@@ -784,13 +788,14 @@ function TransactionForm({
value={description}
onChange={(e) => setDescription(e.target.value)}
required
+ className="bg-card"
/>
)}
{isSynced && transaction?.payee && transaction.payee !== transaction.description && (
<p className="text-xs text-muted-foreground">{transaction.payee}</p>
)}
</div>
- <div className="grid grid-cols-3 gap-4">
+ <div className="grid grid-cols-2 gap-3 sm:gap-4">
<div className="space-y-2">
<div className="flex items-center justify-between min-h-5">
<Label>{t('transactions.amount')}</Label>
@@ -822,13 +827,14 @@ function TransactionForm({
onChange={(e) => handleAmountChange(e.target.value)}
required
disabled={isSynced}
+ className="bg-card"
/>
)}
</div>
<div className="space-y-2">
<Label>{t('transactions.currency')}</Label>
<select
- className="w-full border border-border rounded-md px-3 py-2 text-sm bg-background h-9 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card h-9 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
value={currency}
onChange={(e) => handleCurrencyChange(e.target.value)}
disabled={isSynced}
@@ -838,6 +844,8 @@ function TransactionForm({
))}
</select>
</div>
+ </div>
+ <div className="grid grid-cols-2 gap-3 sm:gap-4">
<div className="space-y-2">
<Label>{t('transactions.date')}</Label>
<DatePickerInput
@@ -847,6 +855,18 @@ function TransactionForm({
className="w-full justify-start"
/>
</div>
+ <div className="space-y-2">
+ <Label>{t('transactions.colStatus')}</Label>
+ <select
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card h-9 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ value={status}
+ onChange={(e) => setStatus(e.target.value as 'posted' | 'pending')}
+ disabled={isSynced}
+ >
+ <option value="posted">{t('transactions.statusPosted')}</option>
+ <option value="pending">{t('transactions.statusPending')}</option>
+ </select>
+ </div>
</div>
{showConversion && (
<div className="border border-border rounded-md p-3 space-y-2">
@@ -878,6 +898,7 @@ function TransactionForm({
value={convertedAmount}
onChange={(e) => handleConvertedAmountChange(e.target.value)}
placeholder={t('transactions.autoCalculated')}
+ className="bg-card"
/>
)}
</div>
@@ -889,6 +910,7 @@ function TransactionForm({
value={fxRate}
onChange={(e) => handleFxRateChange(e.target.value)}
placeholder={t('transactions.autoCalculated')}
+ className="bg-card"
/>
</div>
</div>
@@ -898,7 +920,7 @@ function TransactionForm({
<div className="space-y-2">
<Label>{t('transactions.type')}</Label>
<select
- className="w-full border border-border rounded-md px-3 py-2 text-sm bg-background disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
value={type}
onChange={(e) => setType(e.target.value as 'debit' | 'credit')}
disabled={isSynced}
@@ -915,6 +937,7 @@ function TransactionForm({
categories={categories}
groups={categoryGroups}
allowNone={true}
+ className="bg-card"
/>
</div>
</div>
@@ -922,7 +945,7 @@ function TransactionForm({
<div className="space-y-2">
<Label>{t('payees.payee')}</Label>
<select
- className="w-full border border-border rounded-md px-3 py-2 text-sm bg-background focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
value={payeeId}
onChange={(e) => setPayeeId(e.target.value)}
>
@@ -939,7 +962,7 @@ function TransactionForm({
<div className="space-y-2">
<Label>{t('transactions.account')}</Label>
<select
- className="w-full border border-border rounded-md px-3 py-2 text-sm bg-background focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
value={accountId}
onChange={(e) => setAccountId(e.target.value)}
required
@@ -955,7 +978,7 @@ function TransactionForm({
<div className="space-y-2">
<Label>{t('transactions.notes')} <span className="text-muted-foreground font-normal text-xs">({t('transactions.notesHint')})</span></Label>
<textarea
- className="w-full border border-input rounded-md px-3 py-2 text-sm bg-background resize-none focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0"
+ className="w-full border border-input rounded-md px-3 py-2 text-sm bg-card resize-none focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0"
rows={2}
value={notes}
onChange={(e) => setNotes(e.target.value)}
@@ -1051,7 +1074,7 @@ function TransactionForm({
<div className="space-y-2">
<Label>{t('recurring.frequency')}</Label>
<select
- className="w-full border border-border rounded-md px-3 py-2 text-sm bg-background focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
+ className="w-full border border-border rounded-md px-3 py-2 text-sm bg-card focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"
value={frequency}
onChange={(e) => setFrequency(e.target.value as RecurringTransaction['frequency'])}
>
@@ -1083,7 +1106,7 @@ function TransactionForm({
)}>
<div className="flex min-w-0 flex-wrap gap-2 items-center">
{onDelete && (
- <Button type="button" variant="destructive" onClick={onDelete} disabled={loading} className="whitespace-nowrap">
+ <Button type="button" variant="destructive" onClick={onDelete} disabled={loading} className="whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9">
{t('common.delete')}
</Button>
)}
@@ -1094,9 +1117,9 @@ function TransactionForm({
onClick={handleToggleIgnore}
disabled={loading || togglingIgnore}
title={t('transactions.ignoreTransferHint')}
- className="gap-1.5 whitespace-nowrap"
+ className="gap-1.5 whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9"
>
- {isIgnored ? <Eye size={16} /> : <EyeClosed size={16} />}
+ {isIgnored ? <Eye size={14} /> : <EyeClosed size={14} />}
{isIgnored ? t('transactions.unignoreAction') : t('transactions.ignoreAction')}
</Button>
)}
@@ -1106,10 +1129,10 @@ function TransactionForm({
type="button"
variant="outline"
onClick={() => onCreateRule(transaction)}
- className="gap-1.5 rounded-r-none whitespace-nowrap"
+ className="gap-1.5 rounded-r-none whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9"
title={t('transactions.createRule')}
>
- <SlidersHorizontal size={16} />
+ <SlidersHorizontal size={14} />
{t('transactions.createRule')}
</Button>
<DropdownMenu>
@@ -1118,10 +1141,10 @@ function TransactionForm({
type="button"
variant="outline"
aria-label={t('transactions.ruleActions')}
- className="rounded-l-none border-l-0 px-2 has-[>svg]:px-2"
+ className="rounded-l-none border-l-0 px-1.5 sm:px-2 has-[>svg]:px-1.5 sm:has-[>svg]:px-2 h-8 sm:h-9"
disabled={extendRuleMutation.isPending}
>
- <ChevronDown />
+ <ChevronDown size={14} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-56">
@@ -1135,7 +1158,7 @@ function TransactionForm({
)}
</div>
<div className="flex flex-wrap gap-2 justify-end sm:ml-auto">
- <Button type="button" variant="outline" onClick={onCancel} className="whitespace-nowrap">
+ <Button type="button" variant="outline" onClick={onCancel} className="whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9">
{t('common.cancel')}
</Button>
{showSaveVariants ? (
@@ -1143,7 +1166,7 @@ function TransactionForm({
<Button
type="submit"
disabled={loading || !splitsValid}
- className="rounded-r-none whitespace-nowrap"
+ className="rounded-r-none whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9"
>
{loading ? t('common.loading') : t('common.save')}
</Button>
@@ -1153,9 +1176,9 @@ function TransactionForm({
type="button"
disabled={loading || !splitsValid}
aria-label={t('transactions.moreSaveOptions')}
- className="rounded-l-none border-l border-l-primary-foreground/20 px-2 has-[>svg]:px-2"
+ className="rounded-l-none border-l border-l-primary-foreground/20 px-1.5 sm:px-2 has-[>svg]:px-1.5 sm:has-[>svg]:px-2 h-8 sm:h-9"
>
- <ChevronDown />
+ <ChevronDown size={14} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -1169,7 +1192,7 @@ function TransactionForm({
</DropdownMenu>
</div>
) : (
- <Button type="submit" disabled={loading || !splitsValid} className="whitespace-nowrap">
+ <Button type="submit" disabled={loading || !splitsValid} className="whitespace-nowrap text-xs sm:text-sm h-8 sm:h-9">
{loading ? t('common.loading') : t('common.save')}
</Button>
)}
diff --git a/frontend/src/components/transactions-filter-bar.tsx b/frontend/src/components/transactions-filter-bar.tsx
index 68e7f263..df7d0b4e 100644
--- a/frontend/src/components/transactions-filter-bar.tsx
+++ b/frontend/src/components/transactions-filter-bar.tsx
@@ -9,6 +9,7 @@ import {
Check,
ChevronRight,
Coins,
+ ListChecks,
ListFilter,
Search,
Store,
@@ -65,6 +66,8 @@ interface TransactionsFilterBarProps {
onGroupIdChange: (value: string) => void
filterType: string
onTypeChange: (value: string) => void
+ filterStatus: string
+ onStatusChange: (value: string) => void
filterFrom: string
filterTo: string
onDateRangeChange: (from: string, to: string) => void
@@ -100,6 +103,8 @@ export function TransactionsFilterBar({
onGroupIdChange,
filterType,
onTypeChange,
+ filterStatus,
+ onStatusChange,
filterFrom,
filterTo,
onDateRangeChange,
@@ -190,6 +195,7 @@ export function TransactionsFilterBar({
!!filterPayee ||
!!filterGroupId ||
!!filterType ||
+ !!filterStatus ||
!!filterFrom ||
!!filterTo ||
!!filterMinAmount ||
@@ -203,6 +209,13 @@ export function TransactionsFilterBar({
? t('transactions.expense')
: ''
+ const statusLabel =
+ filterStatus === 'pending'
+ ? t('transactions.statusPending')
+ : filterStatus === 'posted'
+ ? t('transactions.statusPosted')
+ : ''
+
const dateLabel = useMemo(() => {
if (!filterFrom && !filterTo) return null
const fmt = (iso: string) =>
@@ -411,6 +424,7 @@ export function TransactionsFilterBar({
payee: selectedPayee?.name,
group: selectedGroup?.name,
type: typeLabel,
+ status: statusLabel,
date: dateLabel,
amount: amountLabel,
}}
@@ -422,6 +436,8 @@ export function TransactionsFilterBar({
onPayeeChange={onPayeeChange}
onGroupIdChange={onGroupIdChange}
onTypeChange={onTypeChange}
+ status={filterStatus}
+ onStatusChange={onStatusChange}
onDateRangeChange={onDateRangeChange}
onAmountRangeChange={onAmountRangeChange}
onApplyAmountRange={applyAmountRange}
@@ -737,6 +753,48 @@ export function TransactionsFilterBar({
</DropdownMenuPortal>
</DropdownMenuSub>
+ {/* Status submenu (single — posted vs pending) */}
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger className="gap-2 text-[13px]">
+ <ListChecks size={14} className="text-muted-foreground" />
+ <span className="flex-1">{t('transactions.status')}</span>
+ {statusLabel && (
+ <span className="max-w-[90px] truncate text-[11px] text-muted-foreground">
+ {statusLabel}
+ </span>
+ )}
+ </DropdownMenuSubTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuSubContent
+ sideOffset={8}
+ className="w-[200px] p-1"
+ >
+ {[
+ { value: '', label: t('transactions.all') },
+ { value: 'pending', label: t('transactions.statusPending') },
+ { value: 'posted', label: t('transactions.statusPosted') },
+ ].map((opt) => (
+ <DropdownMenuItem
+ key={opt.value || 'all'}
+ onSelect={() => onStatusChange(opt.value)}
+ className={cn(
+ 'gap-2 rounded-sm px-2 py-1.5 text-[13px]',
+ filterStatus === opt.value && 'bg-primary/5',
+ )}
+ >
+ <span className="size-2.5 shrink-0" />
+ <span className="min-w-0 flex-1 truncate text-left">
+ {opt.label}
+ </span>
+ {filterStatus === opt.value && (
+ <Check size={13} className="text-primary" />
+ )}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuSubContent>
+ </DropdownMenuPortal>
+ </DropdownMenuSub>
+
{/* Date range submenu with presets */}
<DropdownMenuSub>
<DropdownMenuSubTrigger className="gap-2 text-[13px]">
@@ -931,6 +989,7 @@ export function TransactionsFilterBar({
filterUncategorized ||
!!selectedPayee ||
!!typeLabel ||
+ !!statusLabel ||
!!dateLabel ||
!!amountLabel) && (
<div className="flex flex-wrap items-center gap-1 border-t border-border/60 px-2 py-1.5">
@@ -991,6 +1050,14 @@ export function TransactionsFilterBar({
onRemove={() => onTypeChange('')}
/>
)}
+ {statusLabel && (
+ <FilterChip
+ icon={<ListChecks size={12} />}
+ label={t('transactions.status')}
+ value={statusLabel}
+ onRemove={() => onStatusChange('')}
+ />
+ )}
{dateLabel && (
<FilterChip
icon={<CalendarIcon size={12} />}
diff --git a/frontend/src/hooks/use-mobile.ts b/frontend/src/hooks/use-mobile.ts
new file mode 100644
index 00000000..4946f229
--- /dev/null
+++ b/frontend/src/hooks/use-mobile.ts
@@ -0,0 +1,19 @@
+import { useEffect, useState } from 'react'
+
+const MOBILE_BREAKPOINT = 768 // md breakpoint in Tailwind
+
+export function useIsMobile(): boolean {
+ const [isMobile, setIsMobile] = useState(() =>
+ typeof window !== 'undefined' ? window.innerWidth < MOBILE_BREAKPOINT : false,
+ )
+
+ useEffect(() => {
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
+ const handler = (e: MediaQueryListEvent | MediaQueryList) => setIsMobile(e.matches)
+ handler(mql)
+ mql.addEventListener('change', handler)
+ return () => mql.removeEventListener('change', handler)
+ }, [])
+
+ return isMobile
+}
diff --git a/frontend/src/lib/account-utils.ts b/frontend/src/lib/account-utils.ts
index 7efcf07b..a7d9c246 100644
--- a/frontend/src/lib/account-utils.ts
+++ b/frontend/src/lib/account-utils.ts
@@ -17,16 +17,18 @@ export function formatAccountMask(account: { masked_number?: string | null }): s
/**
* Account name with its mask appended, e.g. "Checking •••• 1234", for compact
* single-line surfaces such as the account <select> options, where there is no
- * room for a secondary line. Unparenthesized so callers that already append
- * their own parenthetical (the transfer dialog appends the currency) don't end
- * up with two of them.
+ * room for a secondary line. When the account has an explicit display_name, the
+ * mask is omitted since the user-chosen label already distinguishes it.
*/
export function getAccountLabel(account: {
name: string
display_name?: string | null
masked_number?: string | null
}): string {
- const mask = formatAccountMask(account)
const name = getAccountName(account)
+ // When the account has an explicit display_name the user set, it already
+ // distinguishes this account from others so the mask suffix is redundant.
+ if (account.display_name) return name
+ const mask = formatAccountMask(account)
return mask ? `${name} ${mask}` : name
}
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 5da2916a..5082f353 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -430,6 +430,7 @@ export const transactions = {
payee_id?: string
uncategorized?: boolean
type?: string
+ status?: string
from?: string
to?: string
bill_id?: string
@@ -614,6 +615,7 @@ export const transactions = {
payee_id?: string
uncategorized?: boolean
type?: string
+ status?: string
from?: string
to?: string
q?: string
diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx
index 6a0ee133..e856ab88 100644
--- a/frontend/src/pages/dashboard.tsx
+++ b/frontend/src/pages/dashboard.tsx
@@ -46,6 +46,7 @@ import { TransactionDrillDown, type DrillDownFilter } from '@/components/transac
import { TransactionDialog, extractApiError } from '@/components/transaction-dialog'
import { RuleDialog, type RuleDialogInitialData } from '@/components/rule-dialog'
import { usePrivacyMode } from '@/hooks/use-privacy-mode'
+import { useIsMobile } from '@/hooks/use-mobile'
import { useAuth } from '@/contexts/auth-context'
import { useCollectionFilter } from '@/contexts/collection-filter-context'
import { resolveDateFnsLocale } from '@/lib/date-fns-locale'
@@ -91,6 +92,7 @@ export default function DashboardPage() {
const { t, i18n } = useTranslation()
const navigate = useNavigate()
const { mask, privacyMode, MASK } = usePrivacyMode()
+ const isMobile = useIsMobile()
const { user } = useAuth()
const userCurrency = user?.preferences?.currency_display ?? 'USD'
const displayName = user?.preferences?.display_name || ''
@@ -1053,6 +1055,96 @@ export default function DashboardPage() {
</div>
) : pagedRows.length > 0 ? (
<>
+ {isMobile ? (
+ <div>
+ {pagedRows.map((row) => (
+ <div
+ key={row.key}
+ className={`flex items-center gap-3 pl-3 pr-3 py-3 border-b border-border last:border-0 bg-card ${
+ row.isProjected ? '' : 'cursor-pointer active:bg-muted/60'
+ }`}
+ onClick={() => {
+ if (row.isProjected) return
+ if (row.isShared) {
+ if (row.groupId) navigate(`/groups/${row.groupId}`)
+ return
+ }
+ const tx = currentMonthTxs?.items.find((t) => t.id === row.key)
+ if (tx) { setEditingTx(tx); setDialogOpen(true) }
+ }}
+ >
+ {/* Category Icon */}
+ <div className="shrink-0">
+ <CategoryIcon icon={row.categoryIcon} color={row.categoryColor} size="md" />
+ </div>
+
+ {/* Content */}
+ <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">{row.description}</p>
+ {row.groupId && (
+ <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">
+ {row.isShared && row.parentOwnerName
+ ? t('splitGroups.sharedShortBadgeAuthor', { author: row.parentOwnerName })
+ : row.groupName ?? t('splitGroups.sharedShortBadge')}
+ </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">
+ {t('transactions.recurringBadge')}
+ </span>
+ )}
+ {row.isIgnored && (
+ <EyeClosed className="h-3 w-3 text-gray-500 shrink-0" />
+ )}
+ {row.attachmentCount > 0 && (
+ <Paperclip size={11} className="text-muted-foreground shrink-0" />
+ )}
+ </div>
+ {row.accountId && (() => {
+ const acc = accountsList?.find((a) => a.id === row.accountId)
+ if (!acc) return null
+ return (
+ <div className="flex items-center gap-1.5 mt-0.5">
+ <AccountIcon account={acc} size="xs" />
+ <span className="text-xs text-muted-foreground truncate">{getAccountName(acc)}</span>
+ </div>
+ )
+ })()}
+ {!row.accountId && (
+ <p className="text-xs text-muted-foreground mt-0.5">{formatDate(row.date, dateLocale)}</p>
+ )}
+ </div>
+
+ {/* Amount */}
+ <div className="shrink-0 text-right">
+ <span className={`text-sm font-bold tabular-nums ${row.isIgnored ? 'text-gray-500' : row.type === 'credit' ? 'text-emerald-600' : 'text-rose-500'}`}>
+ {mask(`${row.isIgnored ? ' ' : row.type === 'credit' ? '+' : '\u2212'}${formatCurrency(Math.abs(row.amount), row.currency, locale)}`)}
+ </span>
+ {row.isShared && row.parentTotal != null && (
+ <div className="text-[10px] text-muted-foreground tabular-nums mt-0.5">
+ {t('splitGroups.sharedRowParent', {
+ total: formatCurrency(Math.abs(row.parentTotal), row.currency, locale),
+ })}
+ </div>
+ )}
+ {!row.isShared && row.ownerShare != null && (
+ <div className="text-[10px] text-muted-foreground tabular-nums mt-0.5">
+ {t('splitGroups.ownerRowYourShare', {
+ share: formatCurrency(Math.abs(row.ownerShare), row.currency, locale),
+ })}
+ </div>
+ )}
+ {!row.isShared && row.currency !== userCurrency && row.amountPrimary != null && (
+ <div className="text-[10px] text-muted-foreground tabular-nums mt-0.5">
+ {mask(formatCurrency(Math.abs(row.amountPrimary), userCurrency, locale))}
+ </div>
+ )}
+ </div>
+ </div>
+ ))}
+ </div>
+ ) : (
<Table>
<TableHeader>
<TableRow className="border-b border-border hover:bg-transparent">
@@ -1163,6 +1255,7 @@ export default function DashboardPage() {
))}
</TableBody>
</Table>
+ )}
{allDisplayRows.length > 10 && (
<div className="flex flex-col sm:flex-row items-center justify-between gap-4 px-5 py-4 border-t border-border">
<div className="hidden sm:block w-32" />
diff --git a/frontend/src/pages/transactions.tsx b/frontend/src/pages/transactions.tsx
index fcd22d62..d088bc30 100644
--- a/frontend/src/pages/transactions.tsx
+++ b/frontend/src/pages/transactions.tsx
@@ -52,6 +52,8 @@ import { BulkAddToGroupDialog, type BulkAddToGroupSubmission } from '@/component
import { TransactionsFilterBar } from '@/components/transactions-filter-bar'
import { TransactionCalendarView } from '@/components/transaction-calendar-view'
import { usePrivacyMode } from '@/hooks/use-privacy-mode'
+import { useIsMobile } from '@/hooks/use-mobile'
+import { MobileTransactionRow } from '@/components/mobile-transaction-row'
import { useAuth } from '@/contexts/auth-context'
import { useWorkspace } from '@/contexts/workspace-context'
import { useCollectionFilter } from '@/contexts/collection-filter-context'
@@ -82,6 +84,7 @@ export default function TransactionsPage() {
const locale = useDisplayLocale()
const dateLocale = useDateLocale()
const { mask } = usePrivacyMode()
+ const isMobile = useIsMobile()
const { user } = useAuth()
const { activeAccountIds } = useCollectionFilter()
const { canWrite } = useWorkspace()
@@ -142,6 +145,7 @@ export default function TransactionsPage() {
const [filterPayee, setFilterPayee] = useState<string>(searchParams.get('payee_id') ?? '')
const [filterGroupId, setFilterGroupId] = useState<string>(searchParams.get('group_id') ?? '')
const [filterType, setFilterType] = useState<string>(searchParams.get('type') ?? '')
+ const [filterStatus, setFilterStatus] = useState<string>(searchParams.get('status') ?? '')
const [filterMinAmount, setFilterMinAmount] = useState<string>(searchParams.get('min_amount') ?? '')
const [filterMaxAmount, setFilterMaxAmount] = useState<string>(searchParams.get('max_amount') ?? '')
const [tagFilters, setTagFilters] = useState<string[]>([])
@@ -219,6 +223,7 @@ export default function TransactionsPage() {
setFilterPayee(searchParams.get('payee_id') ?? '')
setFilterGroupId(searchParams.get('group_id') ?? '')
setFilterType(searchParams.get('type') ?? '')
+ setFilterStatus(searchParams.get('status') ?? '')
const categories = searchParams.get('category_id');
setFilterCategoryIds(categories ? categories.split(',') : []);
setFilterUncategorized(searchParams.get('uncategorized') === '1');
@@ -253,6 +258,7 @@ export default function TransactionsPage() {
['payee_id', filterPayee],
['group_id', filterGroupId],
['type', filterType],
+ ['status', filterStatus],
['category_id', filterCategoryIds.join(',')],
['uncategorized', filterUncategorized ? '1' : ''],
['account_id', filterAccountIds.join(',')],
@@ -276,6 +282,7 @@ export default function TransactionsPage() {
filterPayee,
filterGroupId,
filterType,
+ filterStatus,
filterCategoryIds,
filterUncategorized,
filterAccountIds,
@@ -299,7 +306,7 @@ export default function TransactionsPage() {
setSelectedIds(new Set())
setLastSelectedId(null)
setBulkCategory('')
- }, [page, filterAccountIds, filterCategoryIds, filterUncategorized, filterPayee, filterType, filterFrom, filterTo, filterMinAmount, filterMaxAmount, searchQuery])
+ }, [page, filterAccountIds, filterCategoryIds, filterUncategorized, filterPayee, filterType, filterStatus, filterFrom, filterTo, filterMinAmount, filterMaxAmount, searchQuery])
useEffect(() => {
if (viewMode === 'calendar') {
@@ -349,7 +356,7 @@ export default function TransactionsPage() {
&& activeAccountIds !== null && activeAccountIds.length === 0
const { data, isLoading } = useQuery({
- queryKey: ['transactions', page, limit, effectiveAccountIds, filterCategoryIds, filterUncategorized, filterPayee, filterGroupId, filterType, filterFrom, filterTo, filterMinAmount, filterMaxAmount, searchQuery, tagFilters, grid.sortBy, grid.sortDir],
+ queryKey: ['transactions', page, limit, effectiveAccountIds, filterCategoryIds, filterUncategorized, filterPayee, filterGroupId, filterType, filterStatus, filterFrom, filterTo, filterMinAmount, filterMaxAmount, searchQuery, tagFilters, isMobile ? 'date' : grid.sortBy, isMobile ? 'desc' : grid.sortDir],
enabled: !noAccounts,
queryFn: () =>
transactions.list({
@@ -360,6 +367,7 @@ export default function TransactionsPage() {
payee_id: filterPayee || undefined,
group_id: filterGroupId || undefined,
type: filterType || undefined,
+ status: filterStatus || undefined,
uncategorized: filterUncategorized ? true : undefined,
from: filterFrom || undefined,
to: filterTo || undefined,
@@ -367,7 +375,9 @@ export default function TransactionsPage() {
max_amount: filterMaxAmount ? Number(filterMaxAmount) : undefined,
q: searchQuery || undefined,
tags: tagFilters.length > 0 ? tagFilters : undefined,
- ...grid.apiSort,
+ // Mobile has no column headers to change sort; force date-desc so
+ // the date grouping always works correctly.
+ ...(isMobile ? { sort_by: 'date', sort_dir: 'desc' as const } : grid.apiSort),
}),
})
@@ -393,6 +403,7 @@ export default function TransactionsPage() {
payee_id: filterPayee || undefined,
group_id: filterGroupId || undefined,
type: filterType || undefined,
+ status: filterStatus || undefined,
uncategorized: filterUncategorized || undefined,
from: filterFrom || undefined,
to: filterTo || undefined,
@@ -705,6 +716,36 @@ export default function TransactionsPage() {
const filteredItems = data?.items ?? []
const selectableItems = filteredItems.filter(tx => !tx.is_shared)
+ // Group transactions by date for the mobile card view
+ const groupedByDate = useMemo(() => {
+ const groups: { date: string; label: string; items: Transaction[] }[] = []
+ let current: { date: string; label: string; items: Transaction[] } | null = null
+ for (const tx of filteredItems) {
+ 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
+ }, [filteredItems, dateLocale])
+
+ // Pre-resolve accounts into a Map for O(1) lookup in the mobile card view
+ const accountById = useMemo(() => {
+ const map = new Map<string, typeof accountsList extends (infer T)[] | undefined ? T : never>()
+ for (const a of accountsList ?? []) map.set(a.id, a)
+ return map
+ }, [accountsList])
+
const toggleSelectAll = () => {
if (!selectableItems.length) return
const allSelected = selectableItems.every(tx => selectedIds.has(tx.id))
@@ -851,6 +892,7 @@ export default function TransactionsPage() {
category_ids: filterCategoryIds.length > 0 ? filterCategoryIds : undefined,
payee_id: filterPayee || undefined,
type: filterType || undefined,
+ status: filterStatus || undefined,
uncategorized: filterUncategorized ? true : undefined,
from: filterFrom || undefined,
to: filterTo || undefined,
@@ -1269,6 +1311,8 @@ export default function TransactionsPage() {
onGroupIdChange={(v) => { setFilterGroupId(v); setPage(1) }}
filterType={filterType}
onTypeChange={(v) => { setFilterType(v); setPage(1) }}
+ filterStatus={filterStatus}
+ onStatusChange={(v) => { setFilterStatus(v); setPage(1) }}
filterFrom={filterFrom}
filterTo={filterTo}
onDateRangeChange={(from, to) => { setFilterFrom(from); setFilterTo(to); setPage(1) }}
@@ -1284,6 +1328,7 @@ export default function TransactionsPage() {
setFilterPayee('')
setFilterGroupId('')
setFilterType('')
+ setFilterStatus('')
setFilterMinAmount('')
setFilterMaxAmount('')
setSearchInput('')
@@ -1350,7 +1395,7 @@ export default function TransactionsPage() {
/>
)}
- {/* Table */}
+ {/* Table / Mobile Cards */}
{viewMode === 'list' && (
<div className="bg-card rounded-xl border border-border shadow-sm overflow-hidden mb-4">
{isLoading ? (
@@ -1359,7 +1404,50 @@ export default function TransactionsPage() {
<Skeleton key={i} className="h-14 w-full" />
))}
</div>
+ ) : isMobile ? (
+ /* ── Mobile card view: grouped by date ── */
+ <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={tx.account_id ? accountById.get(tx.account_id) : undefined}
+ groupName={tx.group_id ? groupNameById.get(tx.group_id) : undefined}
+ selected={selectedIds.has(tx.id)}
+ selectable={canWrite && !tx.is_shared}
+ canWrite={canWrite}
+ highlighted={tx.id === highlightId}
+ highlightedRowRef={tx.id === highlightId ? highlightedRowRef : undefined}
+ locale={locale}
+ userCurrency={userCurrency}
+ onSelect={toggleSelect}
+ onClick={(t) => {
+ if (t.is_shared) {
+ if (t.group_id) navigate(`/groups/${t.group_id}`)
+ return
+ }
+ setEditingTx(t)
+ setDialogOpen(true)
+ }}
+ />
+ ))}
+ </div>
+ ))}
+ {filteredItems.length === 0 && (
+ <div className="text-center py-16 text-muted-foreground">
+ {t('transactions.noResults')}
+ </div>
+ )}
+ </div>
) : (
+ /* ── Desktop table view ── */
<div className="overflow-x-auto">
<Table style={{ tableLayout: 'fixed' }}>
<TableHeader>
@@ -1431,33 +1519,72 @@ export default function TransactionsPage() {
{/* Filtered summary (issue #185): income / expenses / net across
ALL rows matching the active filters — not just this page. */}
{!isLoading && data?.summary && filteredItems.length > 0 && (
- <div className="flex flex-wrap items-center gap-x-5 gap-y-1 border-t border-border bg-muted/30 px-4 py-2.5">
- <span className="mr-auto text-xs text-muted-foreground">
+ <div className="flex flex-col sm:flex-row flex-wrap sm:items-center gap-x-5 gap-y-1 border-t border-border bg-muted/30 px-4 py-2.5">
+ {/* Mobile: count + saldo on first line */}
+ <div className="flex items-center justify-between sm:hidden">
+ <span className="text-xs text-muted-foreground">
+ {t('transactions.summaryCount', { count: data.total })}
+ </span>
+ <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="text-muted-foreground">{t('transactions.summaryNet')}</span>
+ <span
+ className={`text-sm font-bold tabular-nums ${
+ data.summary.net >= 0 ? 'text-emerald-600' : 'text-rose-500'
+ }`}
+ >
+ {mask(formatCurrency(data.summary.net, data.summary.currency, locale))}
+ </span>
+ </span>
+ </div>
+ {/* Mobile: receitas + despesas on second line */}
+ <div className="flex items-center justify-between sm:hidden">
+ <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="text-muted-foreground">{t('transactions.summaryIncome')}</span>
+ <span className="text-sm font-semibold tabular-nums text-emerald-600">
+ {mask(formatCurrency(data.summary.income, data.summary.currency, locale))}
+ </span>
+ </span>
+ <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="text-muted-foreground">{t('transactions.summaryExpenses')}</span>
+ <span className="text-sm font-semibold tabular-nums text-rose-500">
+ {mask(formatCurrency(data.summary.expense, data.summary.currency, locale))}
+ </span>
+ </span>
+ </div>
+ {/* Mobile: excluido on third line */}
+ {data.summary.excluded > 0 && (
+ <span className="flex items-baseline gap-1.5 text-xs sm:hidden">
+ <span className="text-muted-foreground">{t('transactions.summaryExcluded')}</span>
+ <span className="text-sm font-semibold tabular-nums text-muted-foreground">
+ {mask(formatCurrency(data.summary.excluded, data.summary.currency, locale))}
+ </span>
+ </span>
+ )}
+ {/* Desktop: original horizontal layout */}
+ <span className="mr-auto text-xs text-muted-foreground hidden sm:inline">
{t('transactions.summaryCount', { count: data.total })}
</span>
- {/* Excluded (#242): transfers / investments / ignored, kept out of
- income/expense. Hidden when nothing was excluded in range. */}
{data.summary.excluded > 0 && (
- <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="hidden sm:flex items-baseline gap-1.5 text-xs">
<span className="text-muted-foreground">{t('transactions.summaryExcluded')}</span>
<span className="text-sm font-semibold tabular-nums text-muted-foreground">
{mask(formatCurrency(data.summary.excluded, data.summary.currency, locale))}
</span>
</span>
)}
- <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="hidden sm:flex items-baseline gap-1.5 text-xs">
<span className="text-muted-foreground">{t('transactions.summaryIncome')}</span>
<span className="text-sm font-semibold tabular-nums text-emerald-600">
{mask(formatCurrency(data.summary.income, data.summary.currency, locale))}
</span>
</span>
- <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="hidden sm:flex items-baseline gap-1.5 text-xs">
<span className="text-muted-foreground">{t('transactions.summaryExpenses')}</span>
<span className="text-sm font-semibold tabular-nums text-rose-500">
{mask(formatCurrency(data.summary.expense, data.summary.currency, locale))}
</span>
</span>
- <span className="flex items-baseline gap-1.5 text-xs">
+ <span className="hidden sm:flex items-baseline gap-1.5 text-xs">
<span className="text-muted-foreground">{t('transactions.summaryNet')}</span>
<span
className={`text-sm font-bold tabular-nums ${