diff --git a/src/components/WindowRenderer.tsx b/src/components/WindowRenderer.tsx index 576d35e..b319509 100644 --- a/src/components/WindowRenderer.tsx +++ b/src/components/WindowRenderer.tsx @@ -148,6 +148,7 @@ export function WindowRenderer({ window, onClose }: WindowRendererProps) { nip05Authors={window.props.nip05Authors} nip05PTags={window.props.nip05PTags} needsAccount={window.props.needsAccount} + needsInterestList={window.props.needsInterestList} /> ); break; diff --git a/src/components/nostr/kinds/SpellRenderer.tsx b/src/components/nostr/kinds/SpellRenderer.tsx index bc53344..90305c0 100644 --- a/src/components/nostr/kinds/SpellRenderer.tsx +++ b/src/components/nostr/kinds/SpellRenderer.tsx @@ -9,13 +9,13 @@ import { Badge } from "@/components/ui/badge"; import { KindBadge } from "@/components/KindBadge"; import { SpellEvent } from "@/types/spell"; import { CopyableJsonViewer } from "@/components/JsonViewer"; -import { User, Users } from "lucide-react"; +import { User, Users, Hash } from "lucide-react"; import { cn } from "@/lib/utils"; import { UserName } from "../UserName"; import { useGrimoire } from "@/core/state"; import { useProfile } from "@/hooks/useProfile"; import { useNostrEvent } from "@/hooks/useNostrEvent"; -import { getDisplayName } from "@/lib/nostr-utils"; +import { getDisplayName, getAllTagValues } from "@/lib/nostr-utils"; /** * Visual placeholder for $me @@ -109,6 +109,61 @@ export function ContactsPlaceholder({ ); } +/** + * Visual placeholder for $hashtags + */ +export function HashtagsPlaceholder({ + size = "sm", + className, + pubkey, +}: { + size?: "sm" | "md" | "lg"; + className?: string; + pubkey?: string; +}) { + const { addWindow } = useGrimoire(); + const interestList = useNostrEvent( + pubkey + ? { + kind: 10015, + pubkey, + identifier: "", + } + : undefined, + ); + + const hashtags = interestList ? getAllTagValues(interestList, "t") : []; + const count = hashtags.length; + const label = count > 0 ? `${count} interests` : "$hashtags"; + + const handleClick = (e: React.MouseEvent) => { + if (!pubkey) return; + e.stopPropagation(); + addWindow("open", { + pointer: { + kind: 10015, + pubkey, + identifier: "", + }, + }); + }; + + return ( + + + {label} + + ); +} + /** * Renderer for a list of identifiers (pubkeys or placeholders) */ @@ -130,6 +185,10 @@ function IdentifierList({ return ( ); + if (val === "$hashtags") + return ( + + ); return (