diff --git a/src/components/EventDetailViewer.tsx b/src/components/EventDetailViewer.tsx index d9b58e9..2e3e6b0 100644 --- a/src/components/EventDetailViewer.tsx +++ b/src/components/EventDetailViewer.tsx @@ -16,7 +16,7 @@ import { Wifi, Circle, } from "lucide-react"; -import { nip19 } from "nostr-tools"; +import { nip19, kinds } from "nostr-tools"; import { useCopy } from "../hooks/useCopy"; import { getSeenRelays } from "applesauce-core/helpers/relays"; @@ -173,13 +173,13 @@ export function EventDetailViewer({ pointer }: EventDetailViewerProps) { {/* Rendered Content - Focus Here */}
d-tag
- >
- )}
+ {kind >= PARAMETERIZED_REPLACEABLE_START &&
+ kind < PARAMETERIZED_REPLACEABLE_END && (
+ <>
+ d-tag
+ >
+ )}
{kindInfo.nip && (
<>
@@ -106,9 +116,15 @@ function getKindCategory(kind: number): string {
if (kind >= 20 && kind <= 39) return "Media & Content";
if (kind >= 40 && kind <= 49) return "Channels";
if (kind >= 1000 && kind <= 9999) return "Application Specific";
- if (kind >= 10000 && kind <= 19999) return "Regular Lists";
- if (kind >= 20000 && kind <= 29999) return "Ephemeral Events";
- if (kind >= 30000 && kind <= 39999) return "Parameterized Replaceable";
+ if (kind >= REPLACEABLE_START && kind < REPLACEABLE_END)
+ return "Regular Lists";
+ if (kind >= EPHEMERAL_START && kind < EPHEMERAL_END)
+ return "Ephemeral Events";
+ if (
+ kind >= PARAMETERIZED_REPLACEABLE_START &&
+ kind < PARAMETERIZED_REPLACEABLE_END
+ )
+ return "Parameterized Replaceable";
if (kind >= 40000) return "Custom/Experimental";
return "Other";
}
@@ -117,13 +133,20 @@ function getKindCategory(kind: number): string {
* Determine the replaceability of an event kind
*/
function getEventType(kind: number): string {
- if (kind === 0 || kind === 3 || (kind >= 10000 && kind < 20000)) {
+ if (
+ kind === kinds.Metadata ||
+ kind === kinds.Contacts ||
+ (kind >= REPLACEABLE_START && kind < REPLACEABLE_END)
+ ) {
return "Replaceable";
}
- if (kind >= 30000 && kind < 40000) {
+ if (
+ kind >= PARAMETERIZED_REPLACEABLE_START &&
+ kind < PARAMETERIZED_REPLACEABLE_END
+ ) {
return "Parameterized Replaceable";
}
- if (kind >= 20000 && kind < 30000) {
+ if (kind >= EPHEMERAL_START && kind < EPHEMERAL_END) {
return "Ephemeral";
}
return "Regular";
diff --git a/src/components/nostr/kinds/BaseEventRenderer.tsx b/src/components/nostr/kinds/BaseEventRenderer.tsx
index a889fe7..bb7e4a1 100644
--- a/src/components/nostr/kinds/BaseEventRenderer.tsx
+++ b/src/components/nostr/kinds/BaseEventRenderer.tsx
@@ -16,6 +16,12 @@ import { useCopy } from "@/hooks/useCopy";
import { JsonViewer } from "@/components/JsonViewer";
import { formatTimestamp } from "@/hooks/useLocale";
+// NIP-01 Kind ranges
+const REPLACEABLE_START = 10000;
+const REPLACEABLE_END = 20000;
+const PARAMETERIZED_REPLACEABLE_START = 30000;
+const PARAMETERIZED_REPLACEABLE_END = 40000;
+
/**
* Universal event properties and utilities shared across all kind renderers
*/
@@ -45,10 +51,10 @@ export function EventMenu({ event }: { event: NostrEvent }) {
const openEventDetail = () => {
// For replaceable/parameterized replaceable events, use AddressPointer
- // Replaceable: 10000-19999, Parameterized: 30000-39999
const isAddressable =
- (event.kind >= 10000 && event.kind < 20000) ||
- (event.kind >= 30000 && event.kind < 40000);
+ (event.kind >= REPLACEABLE_START && event.kind < REPLACEABLE_END) ||
+ (event.kind >= PARAMETERIZED_REPLACEABLE_START &&
+ event.kind < PARAMETERIZED_REPLACEABLE_END);
let pointer;
if (isAddressable) {