format and bundle

This commit is contained in:
Arc 2024-12-18 23:28:42 +00:00
parent fb5659de2a
commit 5997fd74fa
5 changed files with 58 additions and 57 deletions

View File

@ -684,13 +684,13 @@ async def m029_create_audit_table(db: Connection):
);
"""
)
async def m030_add_currency_to_wallet(db: Connection):
"""
Setting currency to default is heavy, so easier just to add a trigger.
"""
await db.execute(
"""
CREATE TRIGGER IF NOT EXISTS set_default_currency
AFTER INSERT ON wallets
@ -702,4 +702,4 @@ async def m030_add_currency_to_wallet(db: Connection):
WHERE id = NEW.id;
END;
"""
)
)

View File

@ -55,7 +55,7 @@
v-if="!isPrioritySwapped"
style="height: 90px"
>
<div class="col-7" >
<div class="col-7">
<div class="row">
<div class="col-auto">
<div class="text-h3 q-my-none text-no-wrap">
@ -100,9 +100,7 @@
v-if="update.currency"
class="text-h3 q-my-none text-no-wrap"
>
<strong
v-text="formattedFiatAmount"
></strong>
<strong v-text="formattedFiatAmount"></strong>
</div>
</div>
<div class="col-auto">
@ -125,10 +123,11 @@
</div>
</div>
<div class="absolute-right q-pa-md" v-if="$q.screen.gt.md && update.currency">
<div class="text-bold text-italic">
BTC Price
</div>
<div
class="absolute-right q-pa-md"
v-if="$q.screen.gt.md && update.currency"
>
<div class="text-bold text-italic">BTC Price</div>
<span
class="text-bold text-italic"
v-text="formattedExchange"
@ -150,8 +149,7 @@
</div>
</q-card-section>
<div class="row q-pb-md q-px-md q-col-gutter-md gt-sm">
<div class="col">
<div class="col">
<q-btn
unelevated
color="primary"
@ -166,24 +164,21 @@
@click="showReceiveDialog"
:label="$t('create_invoice')"
></q-btn>
<q-btn
unelevated
color="secondary"
icon="qr_code_scanner"
>
<q-btn unelevated color="secondary" icon="qr_code_scanner">
<q-tooltip
><span v-text="$t('camera_tooltip')"></span
></q-tooltip>
</q-btn>
<lnbits-update-balance
v-if="$q.screen.gt.md"
:wallet_id="this.g.wallet.id"
:callback="updateBalanceCallback"
:small_btn="false"
></lnbits-update-balance>
</div></div>
v-if="$q.screen.gt.md"
:wallet_id="this.g.wallet.id"
:callback="updateBalanceCallback"
:small_btn="false"
></lnbits-update-balance>
</div>
</div>
</q-card>
<q-card
:style="
$q.screen.lt.md
@ -302,18 +297,18 @@
v-model="fiatTracking"
color="primary"
@update:model-value="handleFiatTracking"
></q-toggle>
></q-toggle>
</div>
<div class="col">
<q-select
filled
dense
v-model="update.currency"
type="text"
:label="!fiatTracking ? 'Disabled' : $t('currency')"
:options="receive.units.filter((u) => u !== 'sat')"
:disable="!fiatTracking"
></q-select>
filled
dense
v-model="update.currency"
type="text"
:label="!fiatTracking ? 'Disabled' : $t('currency')"
:options="receive.units.filter((u) => u !== 'sat')"
:disable="!fiatTracking"
></q-select>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -101,9 +101,9 @@ window.app = Vue.createApp({
currency
)
this.formattedExchange = LNbits.utils.formatCurrency(
this.exchangeRate,
currency
)
this.exchangeRate,
currency
)
},
msatoshiFormat(value) {
return LNbits.utils.formatSat(value / 1000)
@ -554,15 +554,15 @@ window.app = Vue.createApp({
this.formatFiatAmount(this.fiatBalance, currency)
// make api call
LNbits.api
.request('GET', `/api/v1/rate/` + currency, null)
.request('GET', `/api/v1/rate/` + currency, null)
.then(response => {
this.fiatBalance =
(response.data.price / 100000000) *
(this.balance || this.g.wallet.sat)
this.exchangeRate = response.data.price.toFixed(2)
this.fiatTracking = true
this.formatFiatAmount(this.fiatBalance, currency)
this.$q.localStorage.set('lnbits.exchangeRate', this.exchangeRate)
(response.data.price / 100000000) *
(this.balance || this.g.wallet.sat)
this.exchangeRate = response.data.price.toFixed(2)
this.fiatTracking = true
this.formatFiatAmount(this.fiatBalance, currency)
this.$q.localStorage.set('lnbits.exchangeRate', this.exchangeRate)
})
.catch(e => console.error(e))
},
@ -678,10 +678,7 @@ window.app = Vue.createApp({
handleFiatTracking() {
if (this.fiatTracking === false) {
this.update.currency = ''
this.$q.localStorage.setItem(
'lnbits.isPrioritySwapped',
false
)
this.$q.localStorage.setItem('lnbits.isPrioritySwapped', false)
this.$q.localStorage.remove(`lnbits.exchangeRate`)
}
}
@ -700,7 +697,7 @@ window.app = Vue.createApp({
setTimeout(() => {
this.ignoreWatcher = false
}, 3000)
if(this.g.wallet.currency){
if (this.g.wallet.currency) {
this.fiatTracking = true
this.updateFiatBalance(this.g.wallet.currency)
}
@ -718,7 +715,7 @@ window.app = Vue.createApp({
},
'update.currency'(newValue) {
if (this.ignoreWatcher) return
this.updateWallet({ currency: newValue })
this.updateWallet({currency: newValue})
this.updateFiatBalance(newValue)
}
},
@ -729,8 +726,10 @@ window.app = Vue.createApp({
this.$q.localStorage.set('lnbits.disclaimerShown', true)
}
// check blanace priority
if (this.$q.localStorage.getItem('lnbits.isPrioritySwapped')){
this.isPrioritySwapped = this.$q.localStorage.getItem('lnbits.isPrioritySwapped')
if (this.$q.localStorage.getItem('lnbits.isPrioritySwapped')) {
this.isPrioritySwapped = this.$q.localStorage.getItem(
'lnbits.isPrioritySwapped'
)
} else {
this.isPrioritySwapped = false
this.$q.localStorage.setItem('lnbits.isPrioritySwapped', false)

View File

@ -506,7 +506,14 @@
</template>
<template id="lnbits-update-balance">
<q-btn v-if="admin && small_btn" flat round color="primary" size="sm" icon="add">
<q-btn
v-if="admin && small_btn"
flat
round
color="primary"
size="sm"
icon="add"
>
<q-popup-edit class="bg-accent text-white" v-slot="scope" v-model="credit">
<q-input
filled
@ -523,14 +530,14 @@
</q-popup-edit>
<q-tooltip v-text="$t('credit_hint')"></q-tooltip>
</q-btn>
<q-btn
<q-btn
v-if="admin && !small_btn"
color="primary"
:label="$t('credit_debit')"
class="float-right q-mt-sm"
size="sm"
>
>
<q-popup-edit class="bg-accent text-white" v-slot="scope" v-model="credit">
<q-input
filled