From ffb6d2da38fd12f82f9f274936c7ce19276835a4 Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 16 May 2026 23:20:09 +0200 Subject: [PATCH] feat(libra): color-code income/expense entries and add type filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Transaction History now shows a left green/red stripe on each card and tints the matching income-entry/expense-entry tag badge — mirrors the Record page's red/green palette so the two screens read consistently. Adds an All / Income / Expenses filter row (with Filter icon, aligned to the Calendar-iconed date range row above) that applies on top of search and date filtering. --- .../expenses/views/TransactionsPage.vue | 58 +++++++++++++++++-- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/src/modules/expenses/views/TransactionsPage.vue b/src/modules/expenses/views/TransactionsPage.vue index 416c645..ae0618d 100644 --- a/src/modules/expenses/views/TransactionsPage.vue +++ b/src/modules/expenses/views/TransactionsPage.vue @@ -17,7 +17,8 @@ import { Flag, XCircle, RefreshCw, - Calendar + Calendar, + Filter } from 'lucide-vue-next' const { user } = useAuth() @@ -29,6 +30,21 @@ const isLoading = ref(false) const dateRangeType = ref(15) // 15, 30, 60, or 'custom' const customStartDate = ref('') const customEndDate = ref('') +const typeFilter = ref<'all' | 'income' | 'expense'>('all') + +const typeFilterOptions = [ + { label: 'All', value: 'all' as const }, + { label: 'Income', value: 'income' as const }, + { label: 'Expenses', value: 'expense' as const } +] + +function isIncome(t: Transaction): boolean { + return t.tags?.includes('income-entry') ?? false +} + +function isExpense(t: Transaction): boolean { + return t.tags?.includes('expense-entry') ?? false +} const walletKey = computed(() => user.value?.wallets?.[0]?.inkey) @@ -55,9 +71,12 @@ const searchOptions: FuzzySearchOptions = { matchAllWhenSearchEmpty: true } -// Transactions to display (search results or all transactions) +// Transactions to display (search results or all transactions), filtered by type const transactionsToDisplay = computed(() => { - return searchResults.value.length > 0 ? searchResults.value : transactions.value + const base = searchResults.value.length > 0 ? searchResults.value : transactions.value + if (typeFilter.value === 'income') return base.filter(isIncome) + if (typeFilter.value === 'expense') return base.filter(isExpense) + return base }) // Handle search results @@ -205,6 +224,22 @@ onMounted(() => { + +
+ + +
+
@@ -281,7 +316,11 @@ onMounted(() => {
@@ -335,7 +374,16 @@ onMounted(() => {
- + {{ tag }}