import { Link } from 'react-router-dom'; import { Zap, CheckCircle2, AlertCircle } from 'lucide-react'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useAuthor } from '@/hooks/useAuthor'; import { isValidLightningAddress, isValidSilentPayment } from '@/lib/types'; /** * Payment-readiness note for provider / Lab / crew forms. * * Lightning address (lud16) and Bitcoin Silent Payment live on the user's Nostr * profile (kind 0), NOT on each individual Lab event — so a single source of * truth never goes stale across a person's many profiles. This note simply * tells a provider whether that source is set up, and links them to Edit Profile * if it isn't, so they always have a clear path to "get paid". */ export function PaymentReadinessNote() { const { user } = useCurrentUser(); const author = useAuthor(user?.pubkey || ''); const metadata = author.data?.metadata; const lud16 = metadata?.lud16; const hasLightning = isValidLightningAddress(lud16) || !!metadata?.lud06; // Silent payment lives in a custom kind-0 field the app reads elsewhere. const rawSp = (metadata as Record | undefined)?.bitcoin_silent_payment; const hasSilentPayment = typeof rawSp === 'string' && isValidSilentPayment(rawSp); if (!user) return null; const ready = hasLightning; return (
{ready ? 'You can get paid' : 'Set up payments to get paid'}
{ready ? (

Your Lightning address{lud16 ? <> ({lud16}) : ''} is on your profile — people can zap and pay you directly. {hasSilentPayment && ' A Bitcoin Silent Payment address is set too.'}

) : (

Add a Lightning address (and optionally a Bitcoin Silent Payment address) to your{' '} Nostr profile {' '} so skaters can pay you. It's set once and works across every profile you have here.

)}
); }