Compare commits
2 commits
b697199a8b
...
eb4f8f7e53
| Author | SHA1 | Date | |
|---|---|---|---|
| eb4f8f7e53 | |||
| 0d28d221cd |
4 changed files with 33 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -43,3 +43,4 @@ certs
|
||||||
.obsidian
|
.obsidian
|
||||||
|
|
||||||
.claude/
|
.claude/
|
||||||
|
.playwright-mcp/
|
||||||
|
|
|
||||||
12
.mcp.json
Normal file
12
.mcp.json
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"playwright": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"@playwright/mcp@latest",
|
||||||
|
"--caps",
|
||||||
|
"devtools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,9 +17,14 @@ const expensesAPI = injectService<ExpensesAPI>(SERVICE_TOKENS.EXPENSES_API)
|
||||||
|
|
||||||
const balance = ref<number | null>(null)
|
const balance = ref<number | null>(null)
|
||||||
const balanceCurrency = ref<string>('sats')
|
const balanceCurrency = ref<string>('sats')
|
||||||
|
const fiatBalances = ref<Record<string, number>>({})
|
||||||
const pendingTransactions = ref<Transaction[]>([])
|
const pendingTransactions = ref<Transaction[]>([])
|
||||||
const isLoading = ref(true)
|
const isLoading = ref(true)
|
||||||
|
|
||||||
|
const fiatBalanceEntries = computed(() =>
|
||||||
|
Object.entries(fiatBalances.value).filter(([, amount]) => Math.abs(amount) > 0.005)
|
||||||
|
)
|
||||||
|
|
||||||
const walletKey = computed(() => user.value?.wallets?.[0]?.inkey)
|
const walletKey = computed(() => user.value?.wallets?.[0]?.inkey)
|
||||||
const budgetsEnabled = computed(() => import.meta.env.VITE_LIBRA_BUDGETS_ENABLED === 'true')
|
const budgetsEnabled = computed(() => import.meta.env.VITE_LIBRA_BUDGETS_ENABLED === 'true')
|
||||||
|
|
||||||
|
|
@ -55,6 +60,7 @@ async function loadData() {
|
||||||
|
|
||||||
balance.value = balanceData.balance
|
balance.value = balanceData.balance
|
||||||
balanceCurrency.value = balanceData.currency || 'sats'
|
balanceCurrency.value = balanceData.currency || 'sats'
|
||||||
|
fiatBalances.value = balanceData.fiat_balances || {}
|
||||||
|
|
||||||
// Filter for pending transactions (flag = '!')
|
// Filter for pending transactions (flag = '!')
|
||||||
pendingTransactions.value = txData.entries.filter(tx => tx.flag === '!')
|
pendingTransactions.value = txData.entries.filter(tx => tx.flag === '!')
|
||||||
|
|
@ -112,6 +118,15 @@ function formatFiat(amount: number, currency: string): string {
|
||||||
</span>
|
</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">
|
||||||
|
<span
|
||||||
|
v-for="[currency, amount] in fiatBalanceEntries"
|
||||||
|
:key="currency"
|
||||||
|
class="text-base text-muted-foreground"
|
||||||
|
>
|
||||||
|
{{ formatFiat(Math.abs(amount), currency) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<p class="text-sm" :class="libraOwesUser ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'">
|
<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') }}
|
{{ libraOwesUser ? t('libra.balance.owedToYou') : t('libra.balance.youOwe') }}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,11 @@ export class ExpensesAPI extends BaseService {
|
||||||
/**
|
/**
|
||||||
* Get user's balance with libra
|
* Get user's balance with libra
|
||||||
*/
|
*/
|
||||||
async getUserBalance(walletKey: string): Promise<{ balance: number; currency: string }> {
|
async getUserBalance(walletKey: string): Promise<{
|
||||||
|
balance: number
|
||||||
|
currency: string
|
||||||
|
fiat_balances?: Record<string, number>
|
||||||
|
}> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}/libra/api/v1/balance`, {
|
const response = await fetch(`${this.baseUrl}/libra/api/v1/balance`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue