Compare commits

..

No commits in common. "1fbf7b3d26998e8a0f514b090614e3ba85f6de99" and "4c704e5a4197b511a1d3b8a26dbf81cab3c6b1f7" have entirely different histories.

2 changed files with 15 additions and 42 deletions

View file

@ -98,11 +98,8 @@ async function loadData() {
totalIncomeSats.value = balanceData.total_income_sats || 0
totalIncomeFiat.value = balanceData.total_income_fiat || {}
// Filter for pending transactions (flag = '!'), excluding voided ones
// (libra convention: voided keeps '!' flag and carries a 'voided' tag).
pendingTransactions.value = txData.entries.filter(
tx => tx.flag === '!' && !tx.tags?.includes('voided')
)
// Filter for pending transactions (flag = '!')
pendingTransactions.value = txData.entries.filter(tx => tx.flag === '!')
} catch (error) {
console.error('[BalancePage] Error loading data:', error)
toast.error('Failed to load balance data')

View file

@ -46,10 +46,6 @@ function isExpense(t: Transaction): boolean {
return t.tags?.includes('expense-entry') ?? false
}
function isVoided(t: Transaction): boolean {
return t.tags?.includes('voided') ?? false
}
const walletKey = computed(() => user.value?.wallets?.[0]?.inkey)
// Fuzzy search state and configuration
@ -112,20 +108,17 @@ function formatAmount(amount: number): string {
return new Intl.NumberFormat('en-US').format(amount)
}
// Get status icon and color. Voided entries (per libra convention) keep
// flag='!' and carry a 'voided' tag surface that as the icon regardless
// of the underlying flag.
function getStatusInfo(transaction: Transaction) {
if (isVoided(transaction)) {
return { icon: XCircle, color: 'text-muted-foreground', label: 'Voided' }
}
switch (transaction.flag) {
// Get status icon and color based on flag
function getStatusInfo(flag?: string) {
switch (flag) {
case '*':
return { icon: CheckCircle2, color: 'text-green-600', label: 'Cleared' }
case '!':
return { icon: Clock, color: 'text-orange-600', label: 'Pending' }
case '#':
return { icon: Flag, color: 'text-red-600', label: 'Flagged' }
case 'x':
return { icon: XCircle, color: 'text-muted-foreground', label: 'Voided' }
default:
return null
}
@ -335,19 +328,14 @@ onMounted(() => {
<div class="flex items-center gap-2 mb-1">
<!-- Status Icon -->
<component
v-if="getStatusInfo(transaction)"
:is="getStatusInfo(transaction)!.icon"
v-if="getStatusInfo(transaction.flag)"
:is="getStatusInfo(transaction.flag)!.icon"
:class="[
'h-4 w-4 flex-shrink-0',
getStatusInfo(transaction)!.color
getStatusInfo(transaction.flag)!.color
]"
/>
<h3
:class="[
'font-medium text-sm sm:text-base truncate',
isVoided(transaction) && 'line-through text-muted-foreground'
]"
>
<h3 class="font-medium text-sm sm:text-base truncate">
{{ transaction.description }}
</h3>
</div>
@ -358,21 +346,10 @@ onMounted(() => {
<!-- Amount -->
<div class="text-right flex-shrink-0">
<p
:class="[
'font-semibold text-sm sm:text-base',
isVoided(transaction) && 'line-through text-muted-foreground'
]"
>
<p class="font-semibold text-sm sm:text-base">
{{ formatAmount(transaction.amount) }} sats
</p>
<p
v-if="transaction.fiat_amount"
:class="[
'text-xs text-muted-foreground',
isVoided(transaction) && 'line-through'
]"
>
<p v-if="transaction.fiat_amount" class="text-xs text-muted-foreground">
{{ transaction.fiat_amount.toFixed(2) }} {{ transaction.fiat_currency }}
</p>
</div>
@ -399,11 +376,10 @@ onMounted(() => {
: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 === 'voided' && 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300'
tag === 'expense-entry' && 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300'
]"
>
{{ tag === 'voided' ? 'Voided' : tag }}
{{ tag }}
</Badge>
</div>
</div>