Skip to content

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

fix: tighten transaction and rule frontend flows (#376)

Albert Dolkun4c3b8cc92342
diff --git a/frontend/src/components/import-review-table.tsx b/frontend/src/components/import-review-table.tsx
index c9cecbfb..75babd13 100644
--- a/frontend/src/components/import-review-table.tsx
+++ b/frontend/src/components/import-review-table.tsx
@@ -21,6 +21,14 @@ import {
SelectValue,
} from '@/components/ui/select'
+const ISO_DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/
+
+function formatLocalDate(date: string, locale: string) {
+ const match = ISO_DATE_RE.exec(date)
+ if (!match) return new Date(date).toLocaleDateString(locale)
+ return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])).toLocaleDateString(locale)
+}
+
interface ImportReviewTableProps {
transactions: ImportReviewTransaction[]
categories: Category[]
@@ -171,7 +179,7 @@ export function ImportReviewTable({
/>
</TableCell>
<TableCell className="py-2.5 text-xs text-muted-foreground whitespace-nowrap">
- {new Date(tx.date).toLocaleDateString(dateLocale)}
+ {formatLocalDate(tx.date, dateLocale)}
</TableCell>
<TableCell className={`py-2.5 text-sm ${tx.excluded ? 'line-through text-muted-foreground' : 'text-foreground'}`}>
{tx.description}
diff --git a/frontend/src/components/rule-dialog.tsx b/frontend/src/components/rule-dialog.tsx
index 6c36cbed..076a62d6 100644
--- a/frontend/src/components/rule-dialog.tsx
+++ b/frontend/src/components/rule-dialog.tsx
@@ -54,6 +54,10 @@ function getOpsForField(field: string) {
return STRING_OPS
}
+function defaultValueForField(field: string) {
+ return field === 'type' ? 'debit' : ''
+}
+
export interface RuleDialogInitialData {
name?: string
conditions?: RuleCondition[]
@@ -93,7 +97,16 @@ export function RuleDialog({
const selectClass = 'border border-border rounded-lg px-2 py-1.5 text-sm bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-primary'
function updateCondition(i: number, field: keyof RuleCondition, val: string | number) {
- setConditions(prev => prev.map((c, idx) => idx === i ? { ...c, [field]: val } : c))
+ setConditions(prev => prev.map((c, idx) => {
+ if (idx !== i) return c
+ if (field !== 'field') return { ...c, [field]: val }
+ return {
+ ...c,
+ field: String(val),
+ op: getOpsForField(String(val))[0].value,
+ value: defaultValueForField(String(val)),
+ }
+ }))
}
function removeCondition(i: number) {
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 6188cbf4..afbbf186 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -595,11 +595,13 @@ export const transactions = {
account_ids?: string[]
category_id?: string
category_ids?: string[]
+ payee_id?: string
uncategorized?: boolean
type?: string
from?: string
to?: string
q?: string
+ tags?: string[]
transaction_ids?: string[]
}): Promise<void> => {
const { data } = await api.get('/transactions/export', {
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index cc7c2a5e..ead5d743 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -377,6 +377,7 @@
"bulkAddToGroupSuccess": "{{count}} Transaktionen zur Gruppe hinzugefügt",
"bulkAddToGroupPartial": "{{added}} zur Gruppe hinzugefügt, {{skipped}} übersprungen (Umbuchungen oder bereits aufgeteilt)",
"bulkAddTags": "Tags hinzufügen",
+ "bulkRemoveTags": "Tags entfernen",
"addTagsPlaceholder": "#tag…",
"noResults": "Keine Transaktionen gefunden",
"previous": "Vorherige",
@@ -784,6 +785,7 @@
"duplicateName": "Eine Regel mit diesem Namen existiert bereits",
"sectionTitle": "Kategorisierungsregeln",
"reapplyAll": "Alle neu anwenden",
+ "confirmReapplyAll": "Alle Regeln erneut auf alle Transaktionen anwenden? Dadurch können bestehende Transaktionsfelder geändert werden.",
"add": "Hinzufügen",
"created": "Regel erstellt",
"createdAndApplied": "Regel erstellt und auf {{count}} Transaktionen angewendet",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index bd3ef40c..dbf8c441 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -377,6 +377,7 @@
"bulkAddToGroupSuccess": "{{count}} transactions added to group",
"bulkAddToGroupPartial": "{{added}} added to group, {{skipped}} skipped (transfers or already split)",
"bulkAddTags": "Add tags",
+ "bulkRemoveTags": "Remove tags",
"addTagsPlaceholder": "#tag…",
"noResults": "No transactions found",
"previous": "Previous",
@@ -784,6 +785,7 @@
"duplicateName": "A rule with this name already exists",
"sectionTitle": "Categorization Rules",
"reapplyAll": "Reapply all",
+ "confirmReapplyAll": "Reapply all rules to all transactions? This can change existing transaction fields.",
"add": "Add",
"created": "Rule created",
"createdAndApplied": "Rule created and applied to {{count}} transactions",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index 06b8bdd8..d84ca11a 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -487,6 +487,7 @@
}
},
"bulkAddTags": "Añadir etiquetas",
+ "bulkRemoveTags": "Eliminar etiquetas",
"addTagsPlaceholder": "#etiqueta…",
"clearOverride": "Borrar anulación"
},
@@ -784,6 +785,7 @@
"duplicateName": "Ya existe una regla con este nombre",
"sectionTitle": "Reglas de categorización",
"reapplyAll": "Reaplicar todo",
+ "confirmReapplyAll": "¿Reaplicar todas las reglas a todas las transacciones? Esto puede cambiar los campos existentes de las transacciones.",
"add": "Agregar",
"created": "Regla creada",
"createdAndApplied": "Regla creada y aplicada a {{count}} transacciones",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index bdc8f93b..69a4e064 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -487,6 +487,7 @@
}
},
"bulkAddTags": "Aggiungi tag",
+ "bulkRemoveTags": "Rimuovi tag",
"addTagsPlaceholder": "#tag…",
"clearOverride": "Rimuovi override"
},
@@ -784,6 +785,7 @@
"duplicateName": "Esiste già una regola con questo nome",
"sectionTitle": "Regole di categorizzazione",
"reapplyAll": "Riapplica tutte",
+ "confirmReapplyAll": "Riapplicare tutte le regole a tutte le transazioni? Questa operazione può modificare i campi esistenti delle transazioni.",
"add": "Aggiungi",
"created": "Regola creata",
"createdAndApplied": "Regola creata e applicata a {{count}} transazioni",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index 07113130..f7518e88 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -514,6 +514,7 @@
}
},
"bulkAddTags": "Dodaj tagi",
+ "bulkRemoveTags": "Usuń tagi",
"addTagsPlaceholder": "#tag…",
"clearOverride": "Wyczyść nadpisanie"
},
@@ -835,6 +836,7 @@
"duplicateName": "Reguła o tej nazwie już istnieje",
"sectionTitle": "Reguły kategoryzacji",
"reapplyAll": "Zastosuj ponownie wszystkie",
+ "confirmReapplyAll": "Zastosować ponownie wszystkie reguły do wszystkich transakcji? Może to zmienić istniejące pola transakcji.",
"add": "Dodaj",
"created": "Utworzono regułę",
"createdAndApplied": "Utworzono regułę i zastosowano do {{count}} transakcji",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index 6365a8be..eac9eff2 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -487,6 +487,7 @@
}
},
"bulkAddTags": "Adicionar tags",
+ "bulkRemoveTags": "Remover tags",
"addTagsPlaceholder": "#tag…",
"clearOverride": "Limpar substituição"
},
@@ -784,6 +785,7 @@
"duplicateName": "Já existe uma regra com este nome",
"sectionTitle": "Regras de Categorização",
"reapplyAll": "Reaplicar todas",
+ "confirmReapplyAll": "Reaplicar todas as regras a todas as transações? Isso pode alterar campos existentes das transações.",
"add": "Adicionar",
"created": "Regra criada",
"createdAndApplied": "Regra criada e aplicada a {{count}} transações",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index b70207ba..98661b80 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -377,6 +377,7 @@
"bulkAddToGroupSuccess": "{{count}} транзакций добавлены в группу",
"bulkAddToGroupPartial": "{{added}} добавлено в группу, {{skipped}} пропущено (переводы или уже разделены)",
"bulkAddTags": "Добавить теги",
+ "bulkRemoveTags": "Удалить теги",
"addTagsPlaceholder": "#тег…",
"noResults": "Транзакции не найдены",
"previous": "Предыдущая",
@@ -784,6 +785,7 @@
"duplicateName": "Правило с таким именем уже существует",
"sectionTitle": "Правила категоризации",
"reapplyAll": "Применить заново все",
+ "confirmReapplyAll": "Применить заново все правила ко всем транзакциям? Это может изменить существующие поля транзакций.",
"add": "Добавить",
"created": "Правило создано",
"createdAndApplied": "Правило создано и применено к {{count}} транзакциям",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index 76a578c3..c5eb3675 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -377,6 +377,7 @@
"bulkAddToGroupSuccess": "{{count}} транзакцій додано до групи",
"bulkAddToGroupPartial": "{{added}} додано до групи, {{skipped}} пропущено (перекази або вже розділені)",
"bulkAddTags": "Додати теги",
+ "bulkRemoveTags": "Видалити теги",
"addTagsPlaceholder": "#тег…",
"noResults": "Транзакції не знайдено",
"previous": "Попередня",
@@ -784,6 +785,7 @@
"duplicateName": "Правило з такою назвою вже існує",
"sectionTitle": "Правила категоризації",
"reapplyAll": "Застосувати заново всі",
+ "confirmReapplyAll": "Застосувати заново всі правила до всіх транзакцій? Це може змінити наявні поля транзакцій.",
"add": "Додати",
"created": "Правило створено",
"createdAndApplied": "Правило створено й застосовано до {{count}} транзакцій",
diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx
index da43b3cf..2d0e6438 100644
--- a/frontend/src/pages/dashboard.tsx
+++ b/frontend/src/pages/dashboard.tsx
@@ -1258,7 +1258,7 @@ export default function DashboardPage() {
}}
loading={updateMutation.isPending || deleteMutation.isPending || unlinkTransferMutation.isPending}
error={updateMutation.error ? extractApiError(updateMutation.error) : deleteMutation.error ? extractApiError(deleteMutation.error) : null}
- isSynced={!!editingTx?.external_id}
+ isSynced={editingTx?.source === 'sync'}
/>
<RuleDialog
diff --git a/frontend/src/pages/import.tsx b/frontend/src/pages/import.tsx
index 689aebcb..fb9a8fa5 100644
--- a/frontend/src/pages/import.tsx
+++ b/frontend/src/pages/import.tsx
@@ -556,7 +556,7 @@ export default function ImportPage() {
</button>
<Button
onClick={() => importMutation.mutate()}
- disabled={!selectedAccount || importMutation.isPending || reviewTransactions.length === 0}
+ disabled={!selectedAccount || importMutation.isPending || includedCount === 0}
className="gap-2"
>
<Upload size={14} />
diff --git a/frontend/src/pages/rules.tsx b/frontend/src/pages/rules.tsx
index 9d7a58bb..1a6800d3 100644
--- a/frontend/src/pages/rules.tsx
+++ b/frontend/src/pages/rules.tsx
@@ -344,7 +344,11 @@ export default function RulesPage() {
variant="outline"
size="sm"
className="gap-1.5 h-8"
- onClick={() => applyAllMutation.mutate()}
+ onClick={() => {
+ if (window.confirm(t('rules.confirmReapplyAll', 'Reapply all rules to all transactions? This can change existing transaction fields.'))) {
+ applyAllMutation.mutate()
+ }
+ }}
disabled={applyAllMutation.isPending}
>
<RefreshCw size={12} />
diff --git a/frontend/src/pages/transactions.tsx b/frontend/src/pages/transactions.tsx
index d5f418d7..e4943867 100644
--- a/frontend/src/pages/transactions.tsx
+++ b/frontend/src/pages/transactions.tsx
@@ -520,6 +520,20 @@ export default function TransactionsPage() {
},
})
+ const bulkRemoveTagsMutation = useMutation({
+ mutationFn: ({ ids, tags }: { ids: string[]; tags: string[] }) =>
+ transactions.bulkRemoveTags(ids, tags),
+ onSuccess: (result) => {
+ invalidateAfterTxMutation()
+ setSelectedIds(new Set())
+ setBulkTagInput('')
+ toast.success(t('transactions.bulkSuccess', { count: result.updated }))
+ },
+ onError: (error) => {
+ toast.error(extractApiError(error))
+ },
+ })
+
const bulkAddToGroupMutation = useMutation({
mutationFn: ({ ids, payload }: { ids: string[]; payload: BulkAddToGroupSubmission }) =>
transactions.bulkAddToGroup(ids, payload.groupId, {
@@ -790,10 +804,13 @@ export default function TransactionsPage() {
await transactions.export({
account_ids: effectiveAccountIds.length > 0 ? effectiveAccountIds : undefined,
category_ids: filterCategoryIds.length > 0 ? filterCategoryIds : undefined,
+ payee_id: filterPayee || undefined,
+ type: filterType || undefined,
uncategorized: filterUncategorized ? true : undefined,
from: filterFrom || undefined,
to: filterTo || undefined,
q: searchQuery || undefined,
+ tags: tagFilters.length > 0 ? tagFilters : undefined,
})
}
toast.success(t('transactions.exportSuccess'))
@@ -1122,6 +1139,11 @@ export default function TransactionsPage() {
const duplicableTx = selectedSingleTx && !selectedSingleTx.is_shared && !selectedSingleTx.transfer_pair_id
? selectedSingleTx
: null
+ const exportLabel = exporting
+ ? t('transactions.exporting')
+ : selectedIds.size > 0
+ ? t('transactions.exportSelected', { count: selectedIds.size })
+ : t('transactions.exportCsv')
return (
<div>
@@ -1148,11 +1170,7 @@ export default function TransactionsPage() {
<TransactionsColumnPicker state={grid} />
<Button variant="outline" disabled={exporting} onClick={handleExport}>
<Download size={16} className="mr-1.5" />
- {exporting
- ? t('transactions.exporting')
- : selectedIds.size > 0
- ? t('transactions.exportSelected', { count: selectedIds.size })
- : t('transactions.exportCsv')}
+ {exportLabel}
</Button>
{/* Duplicate (issue #158): single non-shared, non-transfer row
selected. Pre-fills Add Transaction from its fields. */}
@@ -1192,7 +1210,7 @@ export default function TransactionsPage() {
<DropdownMenuContent align="end">
<DropdownMenuItem disabled={exporting} onClick={handleExport}>
<Download size={16} className="mr-2" />
- {t('transactions.exportCsv')}
+ {exportLabel}
</DropdownMenuItem>
{duplicableTx && (
<DropdownMenuItem onClick={() => handleDuplicateTransaction(duplicableTx)}>
@@ -1593,6 +1611,20 @@ export default function TransactionsPage() {
>
<Check size={15} />
</Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={!bulkTagInput.trim() || bulkRemoveTagsMutation.isPending}
+ onClick={() => {
+ const tagList = bulkTagInput.trim().split(/[\s,]+/).filter(Boolean)
+ if (tagList.length === 0) return
+ bulkRemoveTagsMutation.mutate({ ids: Array.from(selectedIds), tags: tagList })
+ }}
+ className="h-8 w-8 px-0 shrink-0"
+ title={t('transactions.bulkRemoveTags', 'Remove tags')}
+ >
+ <X size={15} />
+ </Button>
</div>
<div className="w-px bg-border/60 self-stretch" />