diff --git a/src/components/wallet/TransactionHistory.tsx b/src/components/wallet/TransactionHistory.tsx index 74b6af7..b686ad4 100644 --- a/src/components/wallet/TransactionHistory.tsx +++ b/src/components/wallet/TransactionHistory.tsx @@ -1,5 +1,3 @@ -import { Button } from '@/components/ui/button'; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react'; import type { HistoryEntry } from 'coco-cashu-core'; @@ -52,97 +50,81 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand } }; + if (entries.length === 0 && !isLoading) { + return null; + } + return ( - - - -
- - Transaction History -
- {entries.length > 3 && ( - - )} -
- - View your recent transactions - -
- - {isLoading ? ( -
- - Loading history... -
- ) : entries.length === 0 ? ( -
- No transaction history yet -
+
+ {/* Collapsible Section Header */} + + + {/* Transactions List - Only shown when expanded */} + {isExpanded && ( +
+ {isLoading ? ( +
+ + Loading history... +
+ ) : ( + <> + {entries.map((entry) => ( +
+
+
+
+ {getTransactionTypeIcon(entry.type)}
-
- {new URL(entry.mintUrl).hostname} -
-
- {new Date(entry.createdAt).toLocaleString()} -
-
-
-
-
-
- {entry.type === 'send' || entry.type === 'melt' ? '-' : '+'} - {entry.amount.toLocaleString()} {entry.unit} -
- {entry.type === 'melt' && ( -
- + fees +
+
+ + {getHistoryLabel(entry.type)} +
- )} +
+ {new URL(entry.mintUrl).hostname} +
+
+ {new Date(entry.createdAt).toLocaleString()} +
+
-
- {getDirectionIcon(entry.type)} +
+
+
+ {entry.type === 'send' || entry.type === 'melt' ? '-' : '+'} + {entry.amount.toLocaleString()} {entry.unit} +
+ {entry.type === 'melt' && ( +
+ + fees +
+ )} +
+
+ {getDirectionIcon(entry.type)} +
-
- ))} -
- )} - - + ))} + + )} +
+ )} +
); }