import { useSeoMeta } from '@unhead/react';
import { Layout } from '@/components/Layout';
import { WalletModal } from '@/components/WalletModal';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
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 { LightningPrivacyTips } from '@/components/wallet/LightningPrivacyTips';
import { WalletComparisonGuide } from '@/components/wallet/WalletComparisonGuide';
import {
Wallet,
Zap,
Settings,
CheckCircle,
XCircle,
ExternalLink,
Globe,
WalletMinimal,
Info,
Nut,
ChevronRight,
Bitcoin,
} from 'lucide-react';
// ─── Wallet Status Card ───────────────────────────────────────────────────────
function WalletStatusCard() {
const { webln } = useWallet();
const { connections } = useNWC();
const { totalBalance: cashuBalance, isInitialized: hasCashu } = useCashu();
const cashuUsd = useSatsToUsd(cashuBalance);
const hasNWC = connections.length > 0 && connections.some(c => c.isConnected);
const isReady = webln || hasNWC || hasCashu;
return (
Wallet Status
{isReady ? '✓ Ready' : 'Not Connected'}
{isReady
? 'Your wallet is connected and ready to send zaps!'
: 'Connect a wallet to enable Lightning zaps'}
{/* Cashu */}
Cashu Wallet
{hasCashu && cashuBalance > 0
? `${cashuBalance.toLocaleString()} sats${cashuUsd ? ` · $${cashuUsd.toFixed(2)}` : ''}`
: 'Built-in ecash wallet'}
{hasCashu
?
:
}
{/* WebLN */}
WebLN
Browser extension wallet
{webln
?
:
}
{/* NWC */}
Nostr Wallet Connect
{connections.length > 0
? `${connections.length} wallet${connections.length !== 1 ? 's' : ''} connected`
: 'Remote wallet connection'}
{hasNWC
?
:
}
Manage Wallets
);
}
// ─── Zaps Info Card ───────────────────────────────────────────────────────────
function ZapsInfoCard() {
const items = [
{ emoji: '⚡', title: 'Instant', desc: 'Payments settle in seconds over Lightning' },
{ emoji: '🔐', title: 'Flexible custody', desc: 'Use your own wallet or a custodial service' },
{ emoji: '🥜', title: 'NutZaps for privacy', desc: "Cashu ecash — mints can't see who pays whom" },
{ emoji: '💜', title: 'Value for value', desc: 'Support creators directly' },
];
return (
What are Zaps?
Zaps are Lightning micropayments — send sats instantly to any skater, spot creator, or coach. No middleman, no platform cut.
{items.map((item) => (
))}
);
}
// ─── Recommended Wallets ──────────────────────────────────────────────────────
function WalletResourcesCard() {
const wallets = [
{ name: 'Alby', desc: 'Browser extension · WebLN + NWC', url: 'https://getalby.com', type: 'WebLN', color: 'text-yellow-400' },
{ name: 'Minibits', desc: 'Mobile Cashu wallet · NWC', url: 'https://www.minibits.cash', type: 'NWC', color: 'text-orange-400' },
{ name: 'Zeus', desc: 'Self-custodial mobile Lightning', url: 'https://zeusln.com', type: 'NWC', color: 'text-blue-400' },
{ name: 'Coinos', desc: 'Web-based · works everywhere', url: 'https://coinos.io', type: 'NWC', color: 'text-green-400' },
];
return (
Recommended Wallets
Get started with one of these Lightning wallets
{wallets.map((w) => (
{w.name}
{w.type}
{w.desc}
))}
Learn more at Plan B Academy
);
}
// ─── Not Logged In ────────────────────────────────────────────────────────────
function NotLoggedInCard() {
return (
Login Required
Log in with your Nostr account to connect your Lightning wallet and start zapping.
);
}
// ─── Balance Hero Banner ──────────────────────────────────────────────────────
function BalanceHero() {
const { totalBalance: cashuBalance, isInitialized: hasCashu } = useCashu();
const cashuUsd = useSatsToUsd(cashuBalance);
const { webln } = useWallet();
const { connections } = useNWC();
const hasNWC = connections.length > 0 && connections.some(c => c.isConnected);
return (
{/* Background glow */}
Cashu Balance
{hasCashu ? cashuBalance.toLocaleString() : '—'}
sats
{cashuUsd !== null && cashuBalance > 0 && (
≈ ${cashuUsd.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
)}
{/* Wallet status pills */}
{hasCashu && (
Cashu
)}
{webln && (
WebLN
)}
{hasNWC && (
NWC
)}
{!hasCashu && !webln && !hasNWC && (
No wallet connected
)}
{/* Manage button */}
Manage
);
}
// ─── 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();
return (
{/* Header */}
Wallet
Bitcoin Lightning payments & zaps
{user ? (
{/* Balance hero — always at top for logged-in users */}
{/* Quick Guide — collapsed by default */}
{/* Tab pills — full width, thumb-friendly height */}
Cashu
Lightning
{/* Cashu tab */}
{/* Lightning tab */}
) : (
)}
);
}