From 3d428719be2007610683c844747784cdcdfdf709 Mon Sep 17 00:00:00 2001 From: padreug Date: Mon, 15 Sep 2025 00:07:47 +0200 Subject: [PATCH] Refactor transaction display logic in WalletPage for improved status handling - Updated the getTransactionIcon and getTransactionColor functions to accept transaction status, allowing for dynamic icon and color changes based on transaction state. - Removed the getStatusColor function as its functionality is now integrated into the updated color logic. - Enhanced transaction display in the WalletPage to reflect pending status with appropriate styling, improving user visibility of transaction states. These changes enhance the clarity and responsiveness of transaction information presented in the wallet module. --- src/modules/wallet/views/WalletPage.vue | 42 +++++++++---------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/modules/wallet/views/WalletPage.vue b/src/modules/wallet/views/WalletPage.vue index c638700..d83559a 100644 --- a/src/modules/wallet/views/WalletPage.vue +++ b/src/modules/wallet/views/WalletPage.vue @@ -62,26 +62,20 @@ async function refresh() { await authService?.refresh() } -function getTransactionIcon(type: string) { +function getTransactionIcon(type: string, status: string) { + if (status === 'pending') { + return Clock + } return type === 'received' ? ArrowDownLeft : ArrowUpRight } -function getTransactionColor(type: string) { - return type === 'received' ? 'text-green-600' : 'text-orange-600' +function getTransactionColor(type: string, status: string) { + if (status === 'pending') { + return 'text-amber-500' + } + return type === 'received' ? 'text-green-600' : 'text-red-600' } -function getStatusColor(status: string) { - switch (status) { - case 'confirmed': - return 'default' - case 'pending': - return 'secondary' - case 'failed': - return 'destructive' - default: - return 'outline' - } -} // Initialize on mount onMounted(() => { @@ -191,10 +185,10 @@ onMounted(() => {
@@ -222,7 +216,7 @@ onMounted(() => {

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

@@ -237,9 +231,6 @@ onMounted(() => {
- - {{ tx.status }} - {{ tx.tag }} @@ -254,10 +245,10 @@ onMounted(() => {
@@ -284,9 +275,6 @@ onMounted(() => { } })() }} - - {{ tx.status }} - {{ tx.tag }} @@ -297,7 +285,7 @@ onMounted(() => {

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