From f0eadf307bf7d4eeda064a57602c53ba7e0e1219 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 23 Jul 2026 19:29:52 +0700 Subject: [PATCH] wallet: remove duplicate balance hero, single CashuWalletCard as source of truth Co-authored-by: shakespeare.diy --- src/pages/WalletPage.tsx | 169 ++++++++++++--------------------------- 1 file changed, 50 insertions(+), 119 deletions(-) diff --git a/src/pages/WalletPage.tsx b/src/pages/WalletPage.tsx index 21142ad..ef391b3 100644 --- a/src/pages/WalletPage.tsx +++ b/src/pages/WalletPage.tsx @@ -7,7 +7,6 @@ import { useWallet } from '@/hooks/useWallet'; import { useNWC } from '@/hooks/useNWCContext'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useCashu } from '@/hooks/wallet/useCashu'; -import { useSatsToUsd } from '@/hooks/useExchangeRate'; import { LoginArea } from '@/components/auth/LoginArea'; import { CashuWalletCard } from '@/components/wallet/CashuWalletCard'; import { cn } from '@/lib/utils'; @@ -24,115 +23,43 @@ import { ChevronDown, ChevronUp, Wallet, - Bitcoin, } from 'lucide-react'; -// ─── Balance Hero ───────────────────────────────────────────────────────────── +// ─── Wallet status bar ──────────────────────────────────────────────────────── -function BalanceHero() { - const { totalBalance: cashuBalance, isInitialized: hasCashu } = useCashu(); - const cashuUsd = useSatsToUsd(cashuBalance); +function WalletStatusBar() { const { webln } = useWallet(); const { connections } = useNWC(); + const { isInitialized: hasCashu } = useCashu(); const hasNWC = connections.length > 0 && connections.some((c) => c.isConnected); const isReady = webln || hasNWC || hasCashu; return ( -
- {/* Background glows */} -
-
- -
- {/* Balance */} -
-

Cashu Balance

-
- - {hasCashu ? cashuBalance.toLocaleString() : '0'} - - sats -
- {cashuUsd !== null && cashuBalance > 0 ? ( -

- ≈ ${cashuUsd.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} -

- ) : ( -

no balance yet

- )} -
- - {/* Wallet status — compact icon row */} -
- - - -
- - {/* Primary action buttons — scroll down to Cashu card to act */} -
- - -
- - {/* Manage wallets */} - - - +
+ {/* Status pills */} +
+ + +
+ + {/* Manage wallets */} + + +
); } -function WalletStatusPill({ - icon: Icon, - label, - active, - color, - activeBg, +function StatusPill({ + icon: Icon, label, active, color, activeBg, }: { icon: React.ComponentType<{ className?: string }>; label: string; @@ -142,22 +69,22 @@ function WalletStatusPill({ }) { return (
- + {label} {active - ? - : + ? + : }
); } -// ─── Recommended Wallets (collapsible) ─────────────────────────────────────── +// ─── Get a wallet (collapsible) ─────────────────────────────────────────────── -function RecommendedWallets() { +function GetAWallet() { const [open, setOpen] = useState(false); const wallets = [ @@ -177,7 +104,10 @@ function RecommendedWallets() { Get a Wallet
- {open ? : } + {open + ? + : + } {open && ( @@ -188,7 +118,7 @@ function RecommendedWallets() { href={w.url} target="_blank" rel="noopener noreferrer" - className="flex items-center justify-between px-4 py-3 hover:bg-white/5 active:scale-[0.99] transition-all group" + className="flex items-center justify-between px-4 py-3 hover:bg-white/5 active:scale-[0.99] transition-all" >

{w.name}

@@ -214,7 +144,7 @@ function RecommendedWallets() { ); } -// ─── Zaps explainer (collapsible, hidden once wallet connected) ─────────────── +// ─── What are zaps (collapsible, hidden once wallet connected) ──────────────── function WhatAreZaps({ walletConnected }: { walletConnected: boolean }) { const [open, setOpen] = useState(!walletConnected); @@ -223,7 +153,7 @@ function WhatAreZaps({ walletConnected }: { walletConnected: boolean }) { return (
- {open ? : } + {open + ? + : + } {open && (

- Zaps are instant Bitcoin Lightning payments. Send sats to any skater, spot creator, or coach — no middleman, no platform cut. + Instant Bitcoin Lightning payments. Send sats to any skater, spot creator, or coach — no middleman, no platform cut.

{[ @@ -308,7 +241,7 @@ export default function WalletPage() {
{/* Header */} -
+

WALLET

@@ -317,18 +250,16 @@ export default function WalletPage() { {user ? (
- {/* 1. Balance hero — always first */} - + {/* Status bar + manage — compact single row */} + - {/* 2. Cashu wallet card — the main interactive section */} -
- -
+ {/* Cashu wallet — the one and only balance + send/receive UI */} + - {/* 3. Get a wallet — collapsed by default */} - + {/* Get a wallet — collapsed by default */} + - {/* 4. Zaps explainer — auto-collapsed once wallet is connected */} + {/* What are zaps — auto-collapses once wallet connected */}
) : (