import { useState } from 'react'; import { useSeoMeta } from '@unhead/react'; import { Link } from 'react-router-dom'; import { PageHeader } from '@/components/PageHeader'; import { WalletModal } from '@/components/WalletModal'; import { Badge } from '@/components/ui/badge'; import { useWallet } from '@/hooks/useWallet'; import { useNWC } from '@/hooks/useNWCContext'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useCashu } from '@/hooks/wallet/useCashu'; import { LoginArea } from '@/components/auth/LoginArea'; import { CashuWalletCard } from '@/components/wallet/CashuWalletCard'; import { EscrowKeyCard } from '@/components/wallet/EscrowKeyCard'; import { NwcWalletCard } from '@/components/wallet/NwcWalletCard'; import { cn } from '@/lib/utils'; import { Zap, Settings, CheckCircle, XCircle, Globe, WalletMinimal, Nut, ChevronRight, ExternalLink, ChevronDown, ChevronUp, Wallet, Coins, } from 'lucide-react'; // ─── Wallet status bar ──────────────────────────────────────────────────────── 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 (
{/* Status pills */}
{/* Manage wallets */}
); } function StatusPill({ icon: Icon, label, active, color, activeBg, }: { icon: React.ComponentType<{ className?: string }>; label: string; active: boolean; color: string; activeBg: string; }) { return (
{label} {active ? : }
); } // ─── Get a wallet (collapsible) ─────────────────────────────────────────────── function GetAWallet() { const [open, setOpen] = useState(false); const wallets = [ { name: 'Minibits', desc: 'Mobile Cashu · NWC', url: 'https://www.minibits.cash', color: 'text-orange-400' }, { name: 'Alby', desc: 'Browser extension · WebLN + NWC', url: 'https://getalby.com', color: 'text-yellow-400' }, { name: 'Zeus', desc: 'Self-custodial Lightning', url: 'https://zeusln.com', color: 'text-blue-400' }, { name: 'Coinos', desc: 'Web-based · works everywhere', url: 'https://coinos.io', color: 'text-green-400' }, ]; return (
{open && (
{wallets.map((w) => (

{w.name}

{w.desc}

))}
Learn more at Plan B Academy
)}
); } // ─── What are zaps (collapsible, hidden once wallet connected) ──────────────── function WhatAreZaps({ walletConnected }: { walletConnected: boolean }) { const [open, setOpen] = useState(!walletConnected); if (walletConnected && !open) { return ( ); } return (
{open && (

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

{[ { emoji: '⚡', title: 'Instant', desc: 'Settles in seconds' }, { emoji: '🔐', title: 'Flexible', desc: 'Your wallet, your keys' }, { emoji: '🥜', title: 'Private', desc: 'Cashu hides who pays' }, { emoji: '💜', title: 'Direct', desc: 'Value goes to creator' }, ].map((item) => (
{item.emoji}

{item.title}

{item.desc}

))}
)}
); } // ─── Not logged in ──────────────────────────────────────────────────────────── function NotLoggedIn() { return (

Login Required

Log in with your Nostr account to connect your Lightning wallet and start zapping.

); } // ─── Page ───────────────────────────────────────────────────────────────────── export default function WalletPage() { useSeoMeta({ title: 'Wallet - SkateSpots', description: 'Connect your Lightning wallet to send zaps to skaters and spot creators.', }); const { user } = useCurrentUser(); const { webln } = useWallet(); const { connections } = useNWC(); const { isInitialized: hasCashu } = useCashu(); const hasNWC = connections.length > 0 && connections.some((c) => c.isConnected); const walletConnected = !!(webln || hasNWC || hasCashu); return ( <>
{user ? (
{/* Status bar + manage — compact single row */} {/* Connected Lightning wallet (NIP-47) — balance / receive / send */} {/* Cashu wallet — native app, self-custodial ecash */} Browse Cashu mints {/* Get a wallet — collapsed by default */} {/* What are zaps — auto-collapses once wallet connected */}
) : ( )}
); }