Use QuotedEvent for event/address assertion subjects

Replace opaque hex IDs and kind:pubkey:d-tag strings with inline
QuotedEvent rendering for event assertions (30383) and address
assertions (30384). Feed renderer uses depth=2 (collapsible) and
detail renderer uses depth=1 (inline expanded).

https://claude.ai/code/session_01L4Kwg3Ad4C2S1cvkvwACH1
This commit is contained in:
Claude
2026-02-20 08:25:34 +00:00
parent dd6b30b82e
commit 619914a9be
2 changed files with 16 additions and 47 deletions

View File

@@ -1,5 +1,6 @@
import { NostrEvent } from "@/types/nostr";
import { UserName } from "../UserName";
import { QuotedEvent } from "../QuotedEvent";
import { ExternalIdentifierBlock } from "../ExternalIdentifierDisplay";
import {
getAssertionSubject,
@@ -11,12 +12,13 @@ import {
ASSERTION_KIND_LABELS,
ASSERTION_TAG_LABELS,
} from "@/lib/nip85-helpers";
import { parseReplaceableAddress } from "applesauce-core/helpers/pointers";
import {
getExternalIdentifierIcon,
getExternalTypeLabel,
} from "@/lib/nip73-helpers";
import { formatTimestamp } from "@/hooks/useLocale";
import { ShieldCheck, User, FileText, Hash } from "lucide-react";
import { ShieldCheck, User, Hash } from "lucide-react";
import { Progress } from "@/components/ui/progress";
import { cn } from "@/lib/utils";
@@ -119,32 +121,14 @@ function SubjectHeader({
);
}
// Kind 30384: addressable event (kind:pubkey:d-tag)
// Kind 30384: addressable event — quote the referenced event
if (event.kind === 30384) {
const parts = subject.split(":");
if (parts.length >= 3) {
return (
<div className="flex items-center gap-2 p-3 rounded-md bg-muted/50">
<FileText className="size-4 text-muted-foreground" />
<span className="font-mono text-sm">
Kind {parts[0]} by{" "}
<UserName pubkey={parts[1]} className="text-sm inline" />
{parts[2] && (
<span className="text-muted-foreground"> / {parts[2]}</span>
)}
</span>
</div>
);
}
const pointer = parseReplaceableAddress(subject);
if (pointer) return <QuotedEvent addressPointer={pointer} depth={1} />;
}
// Kind 30383: event ID
return (
<div className="flex items-center gap-2 p-3 rounded-md bg-muted/50">
<FileText className="size-4 text-muted-foreground" />
<span className="font-mono text-sm break-all">{subject}</span>
</div>
);
// Kind 30383: event ID — quote the referenced event
return <QuotedEvent eventPointer={{ id: subject }} depth={1} />;
}
/**

View File

@@ -5,6 +5,7 @@ import {
} from "./BaseEventRenderer";
import { Label } from "@/components/ui/label";
import { UserName } from "../UserName";
import { QuotedEvent } from "../QuotedEvent";
import { ExternalIdentifierInline } from "../ExternalIdentifierDisplay";
import {
getAssertionSubject,
@@ -16,6 +17,7 @@ import {
ASSERTION_KIND_LABELS,
ASSERTION_TAG_LABELS,
} from "@/lib/nip85-helpers";
import { parseReplaceableAddress } from "applesauce-core/helpers/pointers";
import { Progress } from "@/components/ui/progress";
import { cn } from "@/lib/utils";
@@ -47,7 +49,7 @@ function RankBar({ rank }: { rank: number }) {
}
/**
* Subject as the visual anchor — rendered as ClickableEventTitle
* Subject as the visual anchor — rendered as ClickableEventTitle or QuotedEvent
*/
function SubjectTitle({
event,
@@ -83,31 +85,14 @@ function SubjectTitle({
);
}
// Kind 30384: addressable event — quote inline
if (event.kind === 30384) {
const parts = subject.split(":");
const display =
parts.length >= 3
? `${parts[0]}:${parts[1].slice(0, 8)}...:${parts[2] || "*"}`
: subject;
return (
<ClickableEventTitle
event={event}
className="text-sm font-semibold font-mono text-foreground"
>
{display}
</ClickableEventTitle>
);
const pointer = parseReplaceableAddress(subject);
if (pointer) return <QuotedEvent addressPointer={pointer} depth={2} />;
}
// Event ID (30383)
return (
<ClickableEventTitle
event={event}
className="text-sm font-semibold font-mono text-foreground"
>
{subject.slice(0, 16)}...
</ClickableEventTitle>
);
// Kind 30383: event ID — quote inline
return <QuotedEvent eventPointer={{ id: subject }} depth={2} />;
}
/**