This commit is contained in:
Arc 2024-12-19 19:30:30 +00:00 committed by dni ⚡
parent 784f7f202a
commit 1f0deaeb2c
No known key found for this signature in database
GPG Key ID: D1F416F29AD26E87
3 changed files with 34 additions and 31 deletions

View File

@ -83,9 +83,7 @@
<small> {{LNBITS_DENOMINATION}}</small> <small> {{LNBITS_DENOMINATION}}</small>
</h6> </h6>
</div> </div>
</q-card-section> </q-card-section>
</q-card> </q-card>
</div> </div>
</q-scroll-area> </q-scroll-area>
@ -97,11 +95,14 @@
, width: $q.screen.lt.md && mobileSimple ? '90% !important': '' , width: $q.screen.lt.md && mobileSimple ? '90% !important': ''
} : ''" } : ''"
> >
<div v-show="$q.screen.gt.sm" style="width: 100%; height: 100%;" class="absolute float-left"> <div
<canvas ref="transactionChart"></canvas> v-show="$q.screen.gt.sm"
</div> style="width: 100%; height: 100%"
class="absolute float-left"
>
<canvas ref="transactionChart"></canvas>
</div>
<q-card-section> <q-card-section>
<h3 class="q-my-none text-no-wrap"> <h3 class="q-my-none text-no-wrap">
<strong v-text="formattedBalance"></strong> <strong v-text="formattedBalance"></strong>
<small> {{LNBITS_DENOMINATION}}</small> <small> {{LNBITS_DENOMINATION}}</small>

View File

@ -237,6 +237,5 @@ window.app.component('payment-list', {
}, },
created() { created() {
if (this.lazy === undefined) this.fetchPayments() if (this.lazy === undefined) this.fetchPayments()
} }
}) })

View File

@ -62,7 +62,7 @@ window.app = Vue.createApp({
primaryColor: this.$q.localStorage.getItem('lnbits.primaryColor'), primaryColor: this.$q.localStorage.getItem('lnbits.primaryColor'),
transactions: [], transactions: [],
transactionChart: null, transactionChart: null,
paymentsRef: null, paymentsRef: null
} }
}, },
computed: { computed: {
@ -101,45 +101,45 @@ window.app = Vue.createApp({
}, },
methods: { methods: {
computeCumulativeBalance(transactions) { computeCumulativeBalance(transactions) {
let balance = 0; let balance = 0
return transactions.map(amount => (balance += amount)); return transactions.map(amount => (balance += amount))
}, },
initCharts() { initCharts() {
this.transactionChart = new Chart( this.transactionChart = new Chart(
this.$refs.transactionChart.getContext('2d'), this.$refs.transactionChart.getContext('2d'),
{ {
type: 'line', type: 'line',
options: { options: {
responsive: true, responsive: true,
maintainAspectRatio: false, maintainAspectRatio: false,
layout: { layout: {
padding: 0, padding: 0,
margin: 0, // Remove padding around the chart margin: 0 // Remove padding around the chart
}, },
plugins: { plugins: {
legend: { legend: {
display: false, display: false
}, },
title: { title: {
display: false, display: false
}, }
}, },
elements: { elements: {
point: { point: {
radius: 0, radius: 0
}, }
}, },
scales: { scales: {
x: { x: {
display: false display: false
}, },
y: { y: {
display: false display: false
}, }
}, }
}, },
data: { data: {
labels: this.transactions.map((tx) => labels: this.transactions.map(tx =>
new Date(tx.date).toLocaleDateString() new Date(tx.date).toLocaleDateString()
), ),
datasets: [ datasets: [
@ -149,15 +149,15 @@ window.app = Vue.createApp({
backgroundColor: LNbits.utils.hexAlpha(this.primaryColor, 0.05), backgroundColor: LNbits.utils.hexAlpha(this.primaryColor, 0.05),
borderColor: this.primaryColor, borderColor: this.primaryColor,
borderWidth: 1, borderWidth: 1,
fill: true, fill: true,
tension: 0.2, tension: 0.2
}, }
], ]
}, }
} }
); )
}, },
msatoshiFormat(value) { msatoshiFormat(value) {
return LNbits.utils.formatSat(value / 1000) return LNbits.utils.formatSat(value / 1000)
}, },
@ -715,11 +715,14 @@ window.app = Vue.createApp({
}) })
}, },
handleWallet(wallet) { handleWallet(wallet) {
console.log('Wallet from child:', wallet); console.log('Wallet from child:', wallet)
}, },
fetchPayments() { fetchPayments() {
return LNbits.api return LNbits.api
.getPayments(this.g.wallet, "sortby=time&direction=asc&status[ne]=failed") .getPayments(
this.g.wallet,
'sortby=time&direction=asc&status[ne]=failed'
)
.then(response => { .then(response => {
console.log(response.data.data) console.log(response.data.data)
for (let payment of response.data.data) { for (let payment of response.data.data) {
@ -731,7 +734,7 @@ window.app = Vue.createApp({
this.paymentsTable.loading = false this.paymentsTable.loading = false
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
}) })
}, }
}, },
created() { created() {
const urlParams = new URLSearchParams(window.location.search) const urlParams = new URLSearchParams(window.location.search)