From 112b391a7e42788086a0138f214ff2c79ce094e6 Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 19 Sep 2025 00:19:26 +0200 Subject: [PATCH] Refactor WalletPage.vue to streamline layout and enhance user experience - Removed unused tab components and associated state management to simplify the codebase. - Improved button and QR code display elements for better interaction and visibility. - Adjusted layout for transaction history to enhance readability and organization. - Cleaned up commented-out code and unnecessary variables, improving overall code clarity. These changes contribute to a more efficient and user-friendly wallet interface. --- src/modules/wallet/views/WalletPage.vue | 425 ++++++++---------------- 1 file changed, 142 insertions(+), 283 deletions(-) diff --git a/src/modules/wallet/views/WalletPage.vue b/src/modules/wallet/views/WalletPage.vue index 4fa4706..d4864e8 100644 --- a/src/modules/wallet/views/WalletPage.vue +++ b/src/modules/wallet/views/WalletPage.vue @@ -3,7 +3,6 @@ import { ref, computed, onMounted } from 'vue' import { injectService, SERVICE_TOKENS } from '@/core/di-container' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Badge } from '@/components/ui/badge' import { ScrollArea } from '@/components/ui/scroll-area' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog' @@ -25,7 +24,6 @@ const showReceiveDialog = ref(false) const showSendDialog = ref(false) const showQRScanner = ref(false) const scannedDestination = ref('') -const selectedTab = ref('transactions') const defaultQrCode = ref(null) const isGeneratingQR = ref(false) const copiedField = ref(null) @@ -37,16 +35,9 @@ const error = computed(() => walletService?.error?.value) // Use PaymentService for centralized balance calculation const totalBalance = computed(() => paymentService?.totalBalance || 0) +// TODO: clean up; assuming we only ever give the user one auto-generated paylink const payLinks = computed(() => walletService?.payLinks?.value || []) const firstPayLink = computed(() => payLinks.value[0] || null) -const baseDomain = computed(() => { - try { - const baseUrl = paymentService?.config?.baseUrl || 'http://localhost' - return new URL(baseUrl).hostname - } catch { - return 'localhost' - } -}) // Get transactions grouped by date const groupedTransactions = computed(() => { @@ -190,12 +181,7 @@ onMounted(async () => { Wallet - @@ -213,34 +199,25 @@ onMounted(async () => {
- {{ Math.floor(totalBalance / 1000).toLocaleString() }} sats + {{ Math.floor(totalBalance / 1000).toLocaleString() }} sats
- - -
@@ -261,16 +238,14 @@ onMounted(async () => {
-
+
-
- LNURL QR Code +
+ LNURL QR Code
@@ -293,13 +268,9 @@ onMounted(async () => {
{{ firstPayLink.lnaddress }}
- @@ -311,251 +282,142 @@ onMounted(async () => { - - - - Transaction History - Receive Addresses - + + + + Recent Transactions + Your payment history + + +
+ {{ error }} +
- - - - - Recent Transactions - Your payment history - - -
- {{ error }} -
+
+ +

No transactions yet

+

Your transaction history will appear here

+
-
- -

No transactions yet

-

Your transaction history will appear here

-
+ +
+
{{ date }}
- -
-
{{ date }}
- -
-
- - - {{ tx.tag }} - - -
- -
-
-
- -
- {{ - (() => { - try { - if (tx.timestamp instanceof Date && !isNaN(tx.timestamp.getTime())) { - return format(tx.timestamp, 'HH:mm') - } else if (tx.timestamp) { - // Try to parse as string or number - const date = new Date(tx.timestamp) - if (!isNaN(date.getTime())) { - return format(date, 'HH:mm') - } - } - return '--:--' - } catch (error) { - console.warn('Failed to format timestamp:', tx.timestamp, error) - return '--:--' +
+
+ + + {{ tx.tag }} + + +
+ +
+
+
+ +
+ {{ + (() => { + try { + if (tx.timestamp instanceof Date && !isNaN(tx.timestamp.getTime())) { + return format(tx.timestamp, 'HH:mm') + } else if (tx.timestamp) { + // Try to parse as string or number + const date = new Date(tx.timestamp) + if (!isNaN(date.getTime())) { + return format(date, 'HH:mm') } - })() - }} -
- -
-

- {{ tx.type === 'received' ? '+' : '-' }}{{ tx.amount.toLocaleString() }} -

-

sats

-
-
- - -
-

{{ tx.description }}

-
- - -
- - Fee: {{ tx.fee }} sats - -
-
- - - + +
+

+ {{ tx.type === 'received' ? '+' : '-' }}{{ tx.amount.toLocaleString() }} +

+

sats

+
+
+ + +
+

{{ tx.description }}

+
+ + +
+ + Fee: {{ tx.fee }} sats + +
+
+ + +
- - - - - - - - - -
-
- Receive Addresses - Your LNURL and Lightning addresses for receiving payments -
-
-
- -
- -

No receive addresses created

-

Create an address to start receiving payments

- -
- -
-
-
-
-

{{ link.description }}

-
- {{ link.min }}-{{ link.max }} sats - - {{ link.username }}@{{ baseDomain }} - -
- -
-
- Lightning Address: - {{ link.lnaddress }} -
-
-
- - -
-
-
-
-
-
- +
+ + + - - - + + + @@ -570,10 +432,7 @@ onMounted(async () => { - +