Compare commits

..

1 commit

Author SHA1 Message Date
996168d00c chore: add .mcp.json and ignore .playwright-mcp/
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:15:11 +02:00

View file

@ -25,24 +25,8 @@ const totalIncomeFiat = ref<Record<string, number>>({})
const pendingTransactions = ref<Transaction[]>([]) const pendingTransactions = ref<Transaction[]>([])
const isLoading = ref(true) const isLoading = ref(true)
// Per-currency split: sign convention from the user perspective: const fiatBalanceEntries = computed(() =>
// positive fiat_balance = user owes Libra, negative = Libra owes user. Object.entries(fiatBalances.value).filter(([, amount]) => Math.abs(amount) > 0.005)
// Distinct currencies can't be netted across each other (no spot rate),
// so we render them grouped by direction instead of one collapsed label.
const youOweFiatEntries = computed(() =>
Object.entries(fiatBalances.value)
.filter(([, amount]) => amount > 0.005)
.map(([currency, amount]) => [currency, amount] as [string, number])
)
const libraOwesFiatEntries = computed(() =>
Object.entries(fiatBalances.value)
.filter(([, amount]) => amount < -0.005)
.map(([currency, amount]) => [currency, Math.abs(amount)] as [string, number])
)
const hasAnyFiatBalance = computed(() =>
youOweFiatEntries.value.length > 0 || libraOwesFiatEntries.value.length > 0
) )
const expensesFiatEntries = computed(() => const expensesFiatEntries = computed(() =>
@ -142,64 +126,30 @@ function formatFiat(amount: number, currency: string): string {
<div class="rounded-xl border bg-card p-6 mb-6"> <div class="rounded-xl border bg-card p-6 mb-6">
<p class="text-sm text-muted-foreground mb-1">{{ t('libra.balance.netBalance') }}</p> <p class="text-sm text-muted-foreground mb-1">{{ t('libra.balance.netBalance') }}</p>
<div v-if="balance !== null" class="space-y-3"> <div v-if="balance !== null" class="space-y-1">
<!-- Fiat split by direction (real per-currency state) --> <div class="flex items-center gap-2">
<div v-if="hasAnyFiatBalance" class="space-y-2">
<div v-if="youOweFiatEntries.length > 0">
<p class="text-xs uppercase tracking-wide text-red-600 dark:text-red-400 font-medium mb-0.5">
{{ t('libra.balance.youOwe') }}
</p>
<div class="flex flex-wrap gap-x-3 gap-y-0.5">
<span
v-for="[currency, amount] in youOweFiatEntries"
:key="'yo-' + currency"
class="text-2xl font-bold text-foreground"
>
{{ formatFiat(amount, currency) }}
</span>
</div>
</div>
<div v-if="libraOwesFiatEntries.length > 0">
<p class="text-xs uppercase tracking-wide text-green-600 dark:text-green-400 font-medium mb-0.5">
{{ t('libra.balance.owedToYou') }}
</p>
<div class="flex flex-wrap gap-x-3 gap-y-0.5">
<span
v-for="[currency, amount] in libraOwesFiatEntries"
:key="'lo-' + currency"
class="text-2xl font-bold text-foreground"
>
{{ formatFiat(amount, currency) }}
</span>
</div>
</div>
</div>
<!-- Sats-only fallback when no fiat balances are present -->
<div v-else class="flex items-center gap-2">
<component <component
:is="libraOwesUser ? ArrowDown : ArrowUp" :is="libraOwesUser ? ArrowDown : ArrowUp"
class="w-5 h-5" class="w-5 h-5"
:class="libraOwesUser ? 'text-green-500' : 'text-red-500'" :class="libraOwesUser ? 'text-green-500' : 'text-red-500'"
/> />
<span class="text-3xl font-bold text-foreground">{{ formatAmount(balance) }}</span> <span class="text-3xl font-bold text-foreground">
{{ formatAmount(balance) }}
</span>
<span class="text-lg text-muted-foreground">{{ balanceCurrency }}</span> <span class="text-lg text-muted-foreground">{{ balanceCurrency }}</span>
</div> </div>
<div v-if="fiatBalanceEntries.length > 0" class="flex flex-wrap items-center gap-x-3 gap-y-1 pl-7">
<!-- Net sats caption (always shown when there's a balance; distinct <span
currencies can't be netted into a single fiat number, but sats v-for="[currency, amount] in fiatBalanceEntries"
can informational only, depends on current BTC rates) --> :key="currency"
<div class="flex items-center gap-1.5 text-xs text-muted-foreground"> class="text-base text-muted-foreground"
<component >
:is="libraOwesUser ? ArrowDown : ArrowUp" {{ formatFiat(Math.abs(amount), currency) }}
class="w-3 h-3"
:class="libraOwesUser ? 'text-green-500' : 'text-red-500'"
/>
<span>
Net at current rates: {{ formatAmount(balance) }} {{ balanceCurrency }}
({{ libraOwesUser ? t('libra.balance.owedToYou').toLowerCase() : t('libra.balance.youOwe').toLowerCase() }})
</span> </span>
</div> </div>
<p class="text-sm" :class="libraOwesUser ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'">
{{ libraOwesUser ? t('libra.balance.owedToYou') : t('libra.balance.youOwe') }}
</p>
</div> </div>
<div v-else class="text-muted-foreground"> <div v-else class="text-muted-foreground">