From 2569f0dd0d7bc838c9cc00b8c693e6c23758971d Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Sun, 12 Oct 2025 13:57:31 -0700 Subject: [PATCH] transaction history formatting --- src/components/wallet/TransactionHistory.tsx | 51 ++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/src/components/wallet/TransactionHistory.tsx b/src/components/wallet/TransactionHistory.tsx index 02086d0..48a234a 100644 --- a/src/components/wallet/TransactionHistory.tsx +++ b/src/components/wallet/TransactionHistory.tsx @@ -1,7 +1,7 @@ import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; -import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp } from 'lucide-react'; +import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react'; import type { HistoryEntry } from '@/hooks/useCashu'; interface TransactionHistoryProps { @@ -12,27 +12,40 @@ interface TransactionHistoryProps { } export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpanded }: TransactionHistoryProps) { - const getHistoryIcon = (type: string) => { + // Icon indicating transaction type (Lightning vs Cashu) + const getTransactionTypeIcon = (type: string) => { switch (type) { case 'mint': - return ; case 'melt': - return ; + return ; case 'send': - return ; case 'receive': - return ; + return ; default: return ; } }; + // Arrow indicating direction (next to amount) + const getDirectionIcon = (type: string) => { + switch (type) { + case 'mint': + case 'receive': + return ; + case 'melt': + case 'send': + return ; + default: + return null; + } + }; + const getHistoryLabel = (type: string) => { switch (type) { case 'mint': - return 'Mint (Lightning → Tokens)'; + return 'Mint Tokens'; case 'melt': - return 'Melt (Tokens → Lightning)'; + return 'Melt Tokens'; case 'send': return 'Send Tokens'; case 'receive': @@ -109,14 +122,14 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand
- {getHistoryIcon(entry.type)} + {getTransactionTypeIcon(entry.type)}
{getHistoryLabel(entry.type)} - {entry.state && ( + {entry.state && entry.type !== 'mint' && entry.type !== 'melt' && (
-
-
- {entry.type === 'send' || entry.type === 'melt' ? '-' : '+'} - {entry.amount.toLocaleString()} {entry.unit} +
+
+
+ {entry.type === 'send' || entry.type === 'melt' ? '-' : '+'} + {entry.amount.toLocaleString()} {entry.unit} +
+ {entry.type === 'melt' && ( +
+ + fees +
+ )} +
+
+ {getDirectionIcon(entry.type)}