diff --git a/components/dashboard/balance-card.tsx b/components/dashboard/balance-card.tsx index 5af728f..7741f62 100644 --- a/components/dashboard/balance-card.tsx +++ b/components/dashboard/balance-card.tsx @@ -8,9 +8,10 @@ import { TokenBalance } from '@/types/balance' interface BalanceCardProps { balance: TokenBalance + loading?: boolean } -export function BalanceCard({ balance }: BalanceCardProps) { +export function BalanceCard({ balance, loading = false }: BalanceCardProps) { const { symbol, amount, price, priceLoading, priceError, change, trend } = balance // Format amount with appropriate decimals @@ -33,6 +34,28 @@ export function BalanceCard({ balance }: BalanceCardProps) { const displayChange = change !== undefined ? `${change > 0 ? '+' : ''}${change.toFixed(2)}%` : null + if (loading) { + return ( + +
+ + +
+
+ +
+ + +
+
+
+ ) + } + return ( {/* Wallet Info Header */} - + {/* Total Balance */} {totalUsdValue > 0 && ( @@ -67,7 +67,7 @@ export function DashboardContent({ walletName, walletAddress }: DashboardContent {/* Balance Cards */}
{balances.map((balance) => ( - + ))}
@@ -86,7 +86,7 @@ export function DashboardContent({ walletName, walletAddress }: DashboardContent /> {/* Transaction History */} - + {/* Modals */} (items: T[], rowHeight: number, containerHeight: numbe return { visibleItems, totalHeight: items.length * rowHeight, setScrollTop } } -export function TransactionHistory() { +export function TransactionHistory({ loading = false }: { loading?: boolean } = {}) { const [quickFilter, setQuickFilter] = useState('all') const [statusFilter, setStatusFilter] = useState('all') const [periodFilter, setPeriodFilter] = useState('30d') @@ -566,7 +567,23 @@ export function TransactionHistory() { - {sortedTransactions.length === 0 && ( + {loading ? ( +
+ {Array.from({ length: 5 }).map((_, i) => ( +
+ +
+ + +
+
+ + +
+
+ ))} +
+ ) : sortedTransactions.length === 0 && (
@@ -581,7 +598,7 @@ export function TransactionHistory() {
)} - {sortedTransactions.length > 0 && (<> + {!loading && sortedTransactions.length > 0 && (<> {/* Desktop table — paginated (≤50) or virtualized (>50) */}
diff --git a/components/dashboard/wallet-info.tsx b/components/dashboard/wallet-info.tsx index 6739b1b..7a99507 100644 --- a/components/dashboard/wallet-info.tsx +++ b/components/dashboard/wallet-info.tsx @@ -3,14 +3,16 @@ import { motion } from 'framer-motion' import { Wallet, Copy, Check, ExternalLink, BadgeCheck } from 'lucide-react' import { Button } from '@/components/ui/button' +import { Skeleton } from '@/components/ui/skeleton' import { useState, useEffect } from 'react' interface WalletInfoProps { walletName: string walletAddress: string + loading?: boolean } -export function WalletInfo({ walletName, walletAddress }: WalletInfoProps) { +export function WalletInfo({ walletName, walletAddress, loading = false }: WalletInfoProps) { const [copied, setCopied] = useState(false) const [isVerified, setIsVerified] = useState(false) @@ -31,6 +33,27 @@ export function WalletInfo({ walletName, walletAddress }: WalletInfoProps) { setTimeout(() => setCopied(false), 2000) } + if (loading) { + return ( + +
+
+ +
+ + +
+
+ +
+
+ ) + } + return (