From 10ab45383d958a02335a6080b01bba79a09762d7 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Sat, 26 Sep 2026 19:14:21 +0700 Subject: [PATCH] chore(ridercard): delete the unused AwardBadgeDialog showAwardDialog was never set true, so the dialog could never open; the inline AwardBadgeInline form is the live flow. Removes ~142 lines plus its now-unused Dialog imports, state and helper. --- src/pages/RiderCardPage.tsx | 154 +----------------------------------- 1 file changed, 1 insertion(+), 153 deletions(-) diff --git a/src/pages/RiderCardPage.tsx b/src/pages/RiderCardPage.tsx index c325080..5c494ca 100644 --- a/src/pages/RiderCardPage.tsx +++ b/src/pages/RiderCardPage.tsx @@ -28,9 +28,6 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { Switch } from '@/components/ui/switch'; import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar'; import { Badge } from '@/components/ui/badge'; -import { - Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, -} from '@/components/ui/dialog'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useAuthor } from '@/hooks/useAuthor'; @@ -874,148 +871,6 @@ function RiderCardFront({ d, printRef }: { d: CardData; printRef?: React.RefObje ); } -// ─── Award Badge Dialog ─────────────────────────────────────────────────────── -interface AwardBadgeDialogProps { - open: boolean; - onClose: () => void; - issuerPubkey: string; -} - -function AwardBadgeDialog({ open, onClose, issuerPubkey }: AwardBadgeDialogProps) { - const { mutate: publishEvent, isPending } = useNostrPublish(); - const { toast } = useToast(); - - const [recipientNpub, setRecipientNpub] = useState(''); - const [selectedSkills, setSelectedSkills] = useState([]); - const [spotName, setSpotName] = useState(''); - - const toggleSkill = (id: string) => - setSelectedSkills(prev => - prev.includes(id) ? prev.filter(s => s !== id) : [...prev, id] - ); - - const handleAward = () => { - if (!recipientNpub.trim() || selectedSkills.length === 0) { - toast({ title: 'Fill in rider npub + at least one skill', variant: 'destructive' }); - return; - } - - let recipientHex = ''; - try { - const decoded = nip19.decode(recipientNpub.trim()); - if (decoded.type !== 'npub') throw new Error('not npub'); - recipientHex = decoded.data; - } catch { - toast({ title: 'Invalid npub', description: 'Paste a valid npub1… address', variant: 'destructive' }); - return; - } - - const tags: string[][] = [ - ['p', recipientHex], - ['t', 'skill-badge'], - ['alt', `Skill badge awarded: ${selectedSkills.join(', ')}`], - ...selectedSkills.map(s => ['skill', s]), - ]; - if (spotName.trim()) tags.push(['spot', spotName.trim()]); - - publishEvent( - { kind: SKILL_BADGE_KIND, content: '', tags }, - { - onSuccess: () => { - toast({ title: '🏅 Badge awarded!', description: `${selectedSkills.join(', ')} sent to rider.` }); - setRecipientNpub(''); - setSelectedSkills([]); - setSpotName(''); - onClose(); - }, - onError: (e) => toast({ title: 'Failed', description: String(e), variant: 'destructive' }), - }, - ); - }; - - return ( - !v && onClose()}> - - - - - Award a Skill Badge - - - You saw it happen. Sign the proof on Nostr — it becomes part of their permanent record. - - - -
- {/* Recipient */} -
- - setRecipientNpub(e.target.value)} - placeholder="npub1…" - className="bg-black/50 border-gray-700 font-mono text-xs" - /> -
- - {/* Skills */} -
- -
- {SKILL_OPTIONS.map(s => ( - - ))} -
-
- - {/* Spot name */} -
- - setSpotName(e.target.value)} - placeholder="e.g. MACBA, The Berrics, Burnside…" - className="bg-black/50 border-gray-700 text-sm" - /> -
- -
- 🔐 Signed proof.{' '} - This badge is a signed message on the Nostr network — cryptographically tied to your key. - The rider can show it with your name as witness, and anyone can verify it's real. -
- - -
-
-
- ); -} - // ─── Received badges panel ──────────────────────────────────────────────────── function ReceivedBadgesPanel({ pubkey }: { pubkey: string }) { const { data: badgeEvents = [] } = useReceivedBadges(pubkey); @@ -1126,7 +981,6 @@ export default function RiderCardPage() { const [cardType, setCardType] = useState<'rider' | 'park'>('rider'); const [theme, setTheme] = useState('thug'); const [holographic, setHolographic] = useState(true); - const [showAwardDialog, setShowAwardDialog] = useState(false); // Rider fields const [style, setStyle] = useState('Street'); @@ -1636,13 +1490,7 @@ export default function RiderCardPage() { - setShowAwardDialog(false)} - issuerPubkey={user.pubkey} - /> - - {/* Inline award form — replaces the dialog on this tab */} + {/* Inline award form — the dialog was removed as dead code */} setPageTab('badges')} /> )}