diff --git a/src/components/SpellContent.tsx b/src/components/SpellContent.tsx index 7714366c..4832a458 100644 --- a/src/components/SpellContent.tsx +++ b/src/components/SpellContent.tsx @@ -1,6 +1,4 @@ import type { NostrEvent } from '@nostrify/nostrify'; -import { nip19 } from 'nostr-tools'; -import { useNavigate } from 'react-router-dom'; import { Badge } from '@/components/ui/badge'; import { Clock, Globe, Image, Languages, MessageSquareOff, Radio, Search, SortDesc, Terminal, Users, Video, WandSparkles } from 'lucide-react'; import { buildKindOptions } from '@/components/SavedFeedFiltersEditor'; @@ -35,21 +33,19 @@ function formatTimestamp(value: string): string { return value; } +/** Friendly display name for tag filter letters. */ +function tagFilterLabel(letter: string): string { + if (letter === 't') return 'Hashtags'; + return `#${letter}`; +} + interface SpellContentProps { event: NostrEvent; } export function SpellContent({ event }: SpellContentProps) { - const navigate = useNavigate(); const { tags } = event; - const neventId = nip19.neventEncode({ id: event.id, author: event.pubkey, kind: event.kind }); - - const handleRun = (e: React.MouseEvent) => { - e.stopPropagation(); - navigate(`/${neventId}`); - }; - const name = tags.find(([t]) => t === 'name')?.[1]; const cmd = tags.find(([t]) => t === 'cmd')?.[1]; const kinds = tags.filter(([t]) => t === 'k').map(([, v]) => v); @@ -71,16 +67,12 @@ export function SpellContent({ event }: SpellContentProps) { return (
- {/* Spell name — clickable to run the spell */} + {/* Spell name */} {name && ( - +
+ + {name} +
)} {/* Description from content */} @@ -91,7 +83,7 @@ export function SpellContent({ event }: SpellContentProps) { {/* Badge row */}
{cmd && ( - + {cmd} @@ -104,7 +96,7 @@ export function SpellContent({ event }: SpellContentProps) { {authors .filter((a) => a.startsWith('$')) .map((a) => ( - + {a} @@ -128,8 +120,8 @@ export function SpellContent({ event }: SpellContentProps) { )} {limit && ( - - limit:{limit} + + limit: {limit} )} {closeOnEose && ( @@ -137,6 +129,11 @@ export function SpellContent({ event }: SpellContentProps) { one-shot )} + {tagFilters.map(([, letter, ...values], i) => ( + + {tagFilterLabel(letter)}: {values.join(', ')} + + ))} {media && media !== 'all' && ( {media === 'images' ? : media === 'videos' || media === 'vines' ?
- {/* Tag filters */} - {tagFilters.length > 0 && ( -
- {tagFilters.map(([, letter, ...values], i) => ( - - #{letter}: {values.join(', ')} - - ))} -
- )} - {/* Target relays */} {relays.length > 0 && (