diff --git a/src/components/NIPBadge.tsx b/src/components/NIPBadge.tsx index cb9c439..c642787 100644 --- a/src/components/NIPBadge.tsx +++ b/src/components/NIPBadge.tsx @@ -1,5 +1,6 @@ import { getNIPInfo } from "../lib/nip-icons"; import { useGrimoire } from "@/core/state"; +import { isNipDeprecated } from "@/constants/nips"; export interface NIPBadgeProps { nipNumber: string; @@ -23,6 +24,7 @@ export function NIPBadge({ const name = nipInfo?.name || `NIP-${nipNumber}`; const description = nipInfo?.description || `Nostr Implementation Possibility ${nipNumber}`; + const isDeprecated = isNipDeprecated(nipNumber); const openNIP = () => { const paddedNum = nipNumber.toString().padStart(2, "0"); @@ -36,8 +38,10 @@ export function NIPBadge({ return ( + )} + + + + {/* NIP List */} + {filteredNips.length > 0 ? ( +
+ {filteredNips.map((nipId) => ( + + ))} +
+ ) : ( +
+

No NIPs match "{search}"

+

Try searching for a different term

+
+ )} + + + ); +} diff --git a/src/components/WindowRenderer.tsx b/src/components/WindowRenderer.tsx index 42e5767..8827168 100644 --- a/src/components/WindowRenderer.tsx +++ b/src/components/WindowRenderer.tsx @@ -12,6 +12,7 @@ import DecodeViewer from "./DecodeViewer"; import { RelayViewer } from "./RelayViewer"; import KindRenderer from "./KindRenderer"; import KindsViewer from "./KindsViewer"; +import NipsViewer from "./NipsViewer"; import { DebugViewer } from "./DebugViewer"; import ConnViewer from "./ConnViewer"; @@ -98,6 +99,9 @@ export function WindowRenderer({ window, onClose }: WindowRendererProps) { case "kinds": content = ; break; + case "nips": + content = ; + break; case "man": content = ; break; diff --git a/src/constants/nips.ts b/src/constants/nips.ts index f495bd9..4d87190 100644 --- a/src/constants/nips.ts +++ b/src/constants/nips.ts @@ -2,6 +2,11 @@ * List of valid NIPs from https://github.com/nostr-protocol/nips * Includes both numeric (01-99) and hexadecimal (7D, A0, etc.) identifiers */ +/** + * Deprecated NIPs that are no longer recommended for use + */ +export const DEPRECATED_NIPS = ["04", "08", "26", "96"] as const; + export const VALID_NIPS = [ // Numeric NIPs "01", @@ -201,3 +206,7 @@ export function getNipUrl(nipId: string): string { export function getNipTitle(nipId: string): string { return NIP_TITLES[nipId] || `NIP-${nipId}`; } + +export function isNipDeprecated(nipId: string): boolean { + return DEPRECATED_NIPS.includes(nipId as any); +} diff --git a/src/lib/nip-icons.ts b/src/lib/nip-icons.ts index eec6567..1f0b0c3 100644 --- a/src/lib/nip-icons.ts +++ b/src/lib/nip-icons.ts @@ -42,6 +42,7 @@ import { Compass, Gamepad2, type LucideIcon, + Signature, } from "lucide-react"; export interface NIPInfo { @@ -54,51 +55,57 @@ export interface NIPInfo { export const NIP_METADATA: Record = { // Core Protocol - 1: { + "01": { number: 1, name: "Basic Protocol", description: "Basic protocol flow description", icon: FileText, }, - 2: { + "02": { number: 2, name: "Follow List", description: "Contact list and petnames", icon: Users, }, - 4: { + "03": { + number: 3, + name: "OpenTimestamps Attestations for Events", + description: "A proof of any event", + icon: Signature, + }, + "04": { number: 4, name: "Encrypted DMs", description: "Encrypted direct messages", icon: Mail, deprecated: true, }, - 5: { + "05": { number: 5, name: "Mapping Nostr keys to DNS", description: "Mapping Nostr keys to DNS-based internet identifiers", icon: Globe, }, - 6: { + "06": { number: 6, name: "Key Derivation", description: "Basic key derivation from mnemonic seed phrase", icon: Key, }, - 7: { + "07": { number: 7, name: "window.nostr", description: "window.nostr capability for web browsers", icon: Globe, }, - 8: { + "08": { number: 8, name: "Mentions", description: "Handling mentions", icon: Tag, deprecated: true, }, - 9: { + "09": { number: 9, name: "Event Deletion", description: "Event deletion", diff --git a/src/types/app.ts b/src/types/app.ts index 3cbad4f..d7ee761 100644 --- a/src/types/app.ts +++ b/src/types/app.ts @@ -3,7 +3,7 @@ import type { GlobalRelayState } from "./relay-state"; export type AppId = | "nip" - //| "nips" + | "nips" | "kind" | "kinds" | "man" diff --git a/src/types/man.ts b/src/types/man.ts index 4b8da44..61e5706 100644 --- a/src/types/man.ts +++ b/src/types/man.ts @@ -100,6 +100,18 @@ export const manPages: Record = { category: "System", defaultProps: {}, }, + nips: { + name: "nips", + section: "1", + synopsis: "nips", + description: + "Display all Nostr Implementation Possibilities (NIPs). Shows NIP numbers and titles, with links to view each specification document.", + examples: ["nips View all NIPs"], + seeAlso: ["nip", "kinds", "man"], + appId: "nips", + category: "Documentation", + defaultProps: {}, + }, // debug: { // name: "debug", // section: "1",