diff --git a/src/components/nostr/kinds/SpellRenderer.tsx b/src/components/nostr/kinds/SpellRenderer.tsx index 92eca03..0207d4a 100644 --- a/src/components/nostr/kinds/SpellRenderer.tsx +++ b/src/components/nostr/kinds/SpellRenderer.tsx @@ -223,7 +223,14 @@ export function SpellDetailRenderer({ event }: BaseEventProps) { return (
- {spell.name &&

{spell.name}

} + {spell.name && ( + + {spell.name} + + )} {spell.description && (

{spell.description}

)} diff --git a/src/components/nostr/kinds/SpellbookRenderer.tsx b/src/components/nostr/kinds/SpellbookRenderer.tsx index 0c7aa68..b3c29bd 100644 --- a/src/components/nostr/kinds/SpellbookRenderer.tsx +++ b/src/components/nostr/kinds/SpellbookRenderer.tsx @@ -5,7 +5,7 @@ import { ClickableEventTitle, } from "./BaseEventRenderer"; import { parseSpellbook } from "@/lib/spellbook-manager"; -import { SpellbookEvent } from "@/types/spell"; +import { SpellbookEvent, ParsedSpellbook } from "@/types/spell"; import { NostrEvent } from "@/types/nostr"; import { BookHeart, Layout, ExternalLink, Play, Eye, Share2 } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -14,6 +14,23 @@ import { toast } from "sonner"; import { useProfile } from "@/hooks/useProfile"; import { nip19 } from "nostr-tools"; import { useNavigate } from "react-router"; +import { KindBadge } from "@/components/KindBadge"; +import { WindowInstance } from "@/types/app"; + +/** + * Helper to extract all unique event kinds from a spellbook's windows + */ +function getSpellbookKinds(spellbook: ParsedSpellbook): number[] { + const kinds = new Set(); + Object.values(spellbook.content.windows).forEach((w) => { + const window = w as WindowInstance; + // If it's a req window, extract kinds from filter + if (window.appId === "req" && window.props?.filter?.kinds) { + window.props.filter.kinds.forEach((k: number) => kinds.add(k)); + } + }); + return Array.from(kinds).sort((a, b) => a - b); +} /** * Preview Button Component @@ -100,6 +117,22 @@ export function SpellbookRenderer({ event }: BaseEventProps) {
+ {/* Kind Badges */} + {getSpellbookKinds(spellbook).length > 0 && ( +
+ {getSpellbookKinds(spellbook).map((kind) => ( + + ))} +
+ )} + {/* Stats */}
@@ -167,8 +200,27 @@ export function SpellbookDetailRenderer({ event }: { event: NostrEvent }) {
-

{spellbook.title}

+ + {spellbook.title} +
+ + {getSpellbookKinds(spellbook).length > 0 && ( +
+ {getSpellbookKinds(spellbook).map((kind) => ( + + ))} +
+ )} + {spellbook.description && (

{spellbook.description}