feat(libra): color-code income/expense entries in transaction history
Left green/red stripe on each card plus a matching tint on the income-entry / expense-entry tag badge — mirrors the Record page's red/green palette so the two screens read consistently.
This commit is contained in:
parent
31cefac183
commit
0390ecd4a0
1 changed files with 23 additions and 2 deletions
|
|
@ -30,6 +30,14 @@ const dateRangeType = ref<number | 'custom'>(15) // 15, 30, 60, or 'custom'
|
||||||
const customStartDate = ref<string>('')
|
const customStartDate = ref<string>('')
|
||||||
const customEndDate = ref<string>('')
|
const customEndDate = ref<string>('')
|
||||||
|
|
||||||
|
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)
|
const walletKey = computed(() => user.value?.wallets?.[0]?.inkey)
|
||||||
|
|
||||||
// Fuzzy search state and configuration
|
// Fuzzy search state and configuration
|
||||||
|
|
@ -281,7 +289,11 @@ onMounted(() => {
|
||||||
<div
|
<div
|
||||||
v-for="transaction in transactionsToDisplay"
|
v-for="transaction in transactionsToDisplay"
|
||||||
:key="transaction.id"
|
:key="transaction.id"
|
||||||
class="border-b md:border md:rounded-lg p-4 hover:bg-muted/50 transition-colors"
|
:class="[
|
||||||
|
'border-b md:border md:rounded-lg p-4 hover:bg-muted/50 transition-colors',
|
||||||
|
isIncome(transaction) && 'border-l-4 border-l-green-600',
|
||||||
|
isExpense(transaction) && 'border-l-4 border-l-red-600'
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<!-- Transaction Header -->
|
<!-- Transaction Header -->
|
||||||
<div class="flex items-start justify-between gap-3 mb-2">
|
<div class="flex items-start justify-between gap-3 mb-2">
|
||||||
|
|
@ -335,7 +347,16 @@ onMounted(() => {
|
||||||
|
|
||||||
<!-- Tags -->
|
<!-- Tags -->
|
||||||
<div v-if="transaction.tags && transaction.tags.length > 0" class="flex flex-wrap gap-1 mt-2">
|
<div v-if="transaction.tags && transaction.tags.length > 0" class="flex flex-wrap gap-1 mt-2">
|
||||||
<Badge v-for="tag in transaction.tags" :key="tag" variant="secondary" class="text-xs">
|
<Badge
|
||||||
|
v-for="tag in transaction.tags"
|
||||||
|
:key="tag"
|
||||||
|
variant="secondary"
|
||||||
|
:class="[
|
||||||
|
'text-xs',
|
||||||
|
tag === 'income-entry' && 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
|
||||||
|
tag === 'expense-entry' && 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300'
|
||||||
|
]"
|
||||||
|
>
|
||||||
{{ tag }}
|
{{ tag }}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue