import { useState } from 'react';
import { useSeoMeta } from '@unhead/react';
import { Layout } from '@/components/Layout';
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 { cn } from '@/lib/utils';
import {
Zap,
Settings,
CheckCircle,
XCircle,
Globe,
WalletMinimal,
Nut,
ChevronRight,
ExternalLink,
ChevronDown,
ChevronUp,
Wallet,
} 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 */}
Manage
{isReady
? ON
:
}
);
}
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 (
setOpen((v) => !v)}
className="w-full flex items-center justify-between px-4 py-3.5 bg-white/3 hover:bg-white/5 transition-all"
>
Get a Wallet
{open
?
:
}
{open && (
{wallets.map((w) => (
))}
)}
);
}
// ─── What are zaps (collapsible, hidden once wallet connected) ────────────────
function WhatAreZaps({ walletConnected }: { walletConnected: boolean }) {
const [open, setOpen] = useState(!walletConnected);
if (walletConnected && !open) {
return (
setOpen(true)}
className="text-xs text-muted-foreground/40 hover:text-muted-foreground transition-colors flex items-center gap-1 mx-auto"
>
What are zaps?
);
}
return (
setOpen((v) => !v)}
className="w-full flex items-center justify-between px-4 py-3.5 bg-white/3 hover:bg-white/5 transition-all"
>
What are Zaps?
{open
?
:
}
{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) => (
))}
)}
);
}
// ─── 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 (
{/* Header */}
WALLET
Bitcoin Lightning + Cashu
{user ? (
{/* Status bar + manage — compact single row */}
{/* Cashu wallet — the one and only balance + send/receive UI */}
{/* Get a wallet — collapsed by default */}
{/* What are zaps — auto-collapses once wallet connected */}
) : (
)}
);
}