Enhance DCA dashboard: Add excitement to sat formatting for larger amounts, implement refresh functionality with notifications for data loading errors, and introduce stacking milestones and DCA tips sections for improved user engagement and insights.

This commit is contained in:
padreug 2025-06-22 20:13:41 +02:00
parent 1730c5cd81
commit 272041f8bb
2 changed files with 351 additions and 107 deletions

View file

@ -94,7 +94,12 @@ window.app = Vue.createApp({
formatSats(amount) {
if (!amount) return '0 sats'
return new Intl.NumberFormat('en-US').format(amount) + ' sats'
const formatted = new Intl.NumberFormat('en-US').format(amount)
// Add some excitement for larger amounts
if (amount >= 1000000) return formatted + ' sats 💎'
if (amount >= 100000) return formatted + ' sats 🚀'
if (amount >= 10000) return formatted + ' sats ⚡'
return formatted + ' sats'
},
async loadDashboardData() {
@ -126,7 +131,46 @@ window.app = Vue.createApp({
})
} catch (error) {
console.error('Error loading transactions:', error)
this.$q.notify({
type: 'negative',
message: 'Failed to load transactions',
position: 'top'
})
}
},
async refreshAllData() {
try {
this.loading = true
await Promise.all([
this.loadDashboardData(),
this.loadTransactions()
])
this.$q.notify({
type: 'positive',
message: 'Dashboard refreshed!',
icon: 'refresh',
position: 'top'
})
} catch (error) {
console.error('Error refreshing data:', error)
this.$q.notify({
type: 'negative',
message: 'Failed to refresh data',
position: 'top'
})
} finally {
this.loading = false
}
},
getSatsMilestoneProgress() {
if (!this.dashboardData) return 0
const sats = this.dashboardData.total_sats_accumulated
if (sats >= 1000000) return 100
if (sats >= 100000) return 75
if (sats >= 10000) return 50
return Math.min((sats / 10000) * 50, 50)
}
},