From 4cae2bee41663417dd6f3488fd0c2556cb356021 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Jan 2026 09:11:38 +0000 Subject: [PATCH] fix: ensure $hashtags alias works with kind 777 spells - Pass needsInterestList prop to ReqViewer in WindowRenderer - Add HashtagsPlaceholder component to SpellRenderer for visual representation of $hashtags in spell filters (similar to MePlaceholder and ContactsPlaceholder) --- src/components/WindowRenderer.tsx | 1 + src/components/nostr/kinds/SpellRenderer.tsx | 63 +++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) 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 (