feat: application handler note render
This commit is contained in:
39
packages/app/src/Components/Event/Application.tsx
Normal file
39
packages/app/src/Components/Event/Application.tsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { mapEventToProfile, TaggedNostrEvent } from "@snort/system";
|
||||||
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
|
import KindName from "../kind-name";
|
||||||
|
import Avatar from "../User/Avatar";
|
||||||
|
import DisplayName from "../User/DisplayName";
|
||||||
|
import ProfileImage from "../User/ProfileImage";
|
||||||
|
|
||||||
|
export function ApplicationHandler({ ev }: { ev: TaggedNostrEvent }) {
|
||||||
|
const profile = mapEventToProfile(ev);
|
||||||
|
const kinds = ev.tags
|
||||||
|
.filter(a => a[0] === "k")
|
||||||
|
.map(a => Number(a[1]))
|
||||||
|
.sort((a, b) => a - b);
|
||||||
|
return (
|
||||||
|
<div className="p flex gap-2 flex-col">
|
||||||
|
<div className="flex items-center gap-2 text-xl">
|
||||||
|
<Avatar user={profile} pubkey={""} size={120} />
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<DisplayName user={profile} pubkey={""} />
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="text-gray-light">
|
||||||
|
<FormattedMessage defaultMessage="Published by" />
|
||||||
|
</div>
|
||||||
|
<ProfileImage className="inline" pubkey={ev.pubkey} size={30} link="" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<FormattedMessage defaultMessage="Supported Kinds:" />
|
||||||
|
<div className="flex flex-wrap">
|
||||||
|
{kinds.map(a => (
|
||||||
|
<div key={a} className="pill">
|
||||||
|
<KindName kind={a} />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -6,15 +6,15 @@ import { memo, ReactNode } from "react";
|
|||||||
import PubkeyList from "@/Components/Embed/PubkeyList";
|
import PubkeyList from "@/Components/Embed/PubkeyList";
|
||||||
import ZapstrEmbed from "@/Components/Embed/ZapstrEmbed";
|
import ZapstrEmbed from "@/Components/Embed/ZapstrEmbed";
|
||||||
import ErrorBoundary from "@/Components/ErrorBoundary";
|
import ErrorBoundary from "@/Components/ErrorBoundary";
|
||||||
|
import { ApplicationHandler } from "@/Components/Event/Application";
|
||||||
|
import { LongFormText } from "@/Components/Event/LongFormText";
|
||||||
import { NostrFileElement } from "@/Components/Event/NostrFileHeader";
|
import { NostrFileElement } from "@/Components/Event/NostrFileHeader";
|
||||||
|
import { Note } from "@/Components/Event/Note/Note";
|
||||||
import NoteReaction from "@/Components/Event/NoteReaction";
|
import NoteReaction from "@/Components/Event/NoteReaction";
|
||||||
import { ZapGoal } from "@/Components/Event/ZapGoal";
|
import { ZapGoal } from "@/Components/Event/ZapGoal";
|
||||||
import { LiveEvent } from "@/Components/LiveStream/LiveEvent";
|
import { LiveEvent } from "@/Components/LiveStream/LiveEvent";
|
||||||
import ProfilePreview from "@/Components/User/ProfilePreview";
|
import ProfilePreview from "@/Components/User/ProfilePreview";
|
||||||
|
|
||||||
import { LongFormText } from "./LongFormText";
|
|
||||||
import { Note } from "./Note/Note";
|
|
||||||
|
|
||||||
export interface NotePropsOptions {
|
export interface NotePropsOptions {
|
||||||
isRoot?: boolean;
|
isRoot?: boolean;
|
||||||
showHeader?: boolean;
|
showHeader?: boolean;
|
||||||
@ -75,6 +75,10 @@ export default memo(function EventComponent(props: NoteProps) {
|
|||||||
case 9041: // Assuming 9041 is a valid EventKind
|
case 9041: // Assuming 9041 is a valid EventKind
|
||||||
content = <ZapGoal ev={ev} />;
|
content = <ZapGoal ev={ev} />;
|
||||||
break;
|
break;
|
||||||
|
case EventKind.ApplicationHandler: {
|
||||||
|
content = <ApplicationHandler ev={ev} />;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case EventKind.Photo:
|
case EventKind.Photo:
|
||||||
case EventKind.Video:
|
case EventKind.Video:
|
||||||
case EventKind.ShortVideo: {
|
case EventKind.ShortVideo: {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable max-lines */
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
export default function KindName({ kind }: { kind: number }) {
|
export default function KindName({ kind }: { kind: number }) {
|
||||||
@ -222,5 +223,9 @@ export default function KindName({ kind }: { kind: number }) {
|
|||||||
return <FormattedMessage defaultMessage="Video View Event" />;
|
return <FormattedMessage defaultMessage="Video View Event" />;
|
||||||
case 34550:
|
case 34550:
|
||||||
return <FormattedMessage defaultMessage="Community Definition" />;
|
return <FormattedMessage defaultMessage="Community Definition" />;
|
||||||
|
case 31337:
|
||||||
|
return <FormattedMessage defaultMessage="Zapstr Track" />;
|
||||||
|
default:
|
||||||
|
return kind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,11 @@ export function Header() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else if (nostrLink) {
|
} else if (nostrLink) {
|
||||||
if (nostrLink.type === NostrPrefix.Event || nostrLink.type === NostrPrefix.Note) {
|
if (
|
||||||
|
nostrLink.type === NostrPrefix.Event ||
|
||||||
|
nostrLink.type === NostrPrefix.Note ||
|
||||||
|
nostrLink.type === NostrPrefix.Address
|
||||||
|
) {
|
||||||
title = <NoteTitle link={nostrLink} />;
|
title = <NoteTitle link={nostrLink} />;
|
||||||
} else if (nostrLink.type === NostrPrefix.PublicKey || nostrLink.type === NostrPrefix.Profile) {
|
} else if (nostrLink.type === NostrPrefix.PublicKey || nostrLink.type === NostrPrefix.Profile) {
|
||||||
try {
|
try {
|
||||||
|
@ -270,6 +270,9 @@
|
|||||||
"4emo2p": {
|
"4emo2p": {
|
||||||
"defaultMessage": "Missing Relays"
|
"defaultMessage": "Missing Relays"
|
||||||
},
|
},
|
||||||
|
"4oPRxH": {
|
||||||
|
"defaultMessage": "Supported Kinds:"
|
||||||
|
},
|
||||||
"4rYCjn": {
|
"4rYCjn": {
|
||||||
"defaultMessage": "Note to Self"
|
"defaultMessage": "Note to Self"
|
||||||
},
|
},
|
||||||
@ -1148,6 +1151,9 @@
|
|||||||
"QWhotP": {
|
"QWhotP": {
|
||||||
"defaultMessage": "Zap Pool only works if you use one of the supported wallet connections (WebLN, LNC, LNDHub or Nostr Wallet Connect)"
|
"defaultMessage": "Zap Pool only works if you use one of the supported wallet connections (WebLN, LNC, LNDHub or Nostr Wallet Connect)"
|
||||||
},
|
},
|
||||||
|
"QaGyuN": {
|
||||||
|
"defaultMessage": "Zapstr Track"
|
||||||
|
},
|
||||||
"QpaLA3": {
|
"QpaLA3": {
|
||||||
"defaultMessage": "Channel Message"
|
"defaultMessage": "Channel Message"
|
||||||
},
|
},
|
||||||
@ -1302,6 +1308,9 @@
|
|||||||
"ULXFfP": {
|
"ULXFfP": {
|
||||||
"defaultMessage": "Receive"
|
"defaultMessage": "Receive"
|
||||||
},
|
},
|
||||||
|
"ULsJTk": {
|
||||||
|
"defaultMessage": "Published by"
|
||||||
|
},
|
||||||
"UNjfWJ": {
|
"UNjfWJ": {
|
||||||
"defaultMessage": "Check all event signatures received from relays"
|
"defaultMessage": "Check all event signatures received from relays"
|
||||||
},
|
},
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
"4Vmpt4": "Nostr Plebs is one of the first NIP-05 providers in the space and offers a good collection of domains at reasonable prices",
|
"4Vmpt4": "Nostr Plebs is one of the first NIP-05 providers in the space and offers a good collection of domains at reasonable prices",
|
||||||
"4Z3t5i": "Use imgproxy to compress images",
|
"4Z3t5i": "Use imgproxy to compress images",
|
||||||
"4emo2p": "Missing Relays",
|
"4emo2p": "Missing Relays",
|
||||||
|
"4oPRxH": "Supported Kinds:",
|
||||||
"4rYCjn": "Note to Self",
|
"4rYCjn": "Note to Self",
|
||||||
"4wgYpI": "Recommended Application Handlers",
|
"4wgYpI": "Recommended Application Handlers",
|
||||||
"5BVs2e": "zap",
|
"5BVs2e": "zap",
|
||||||
@ -380,6 +381,7 @@
|
|||||||
"QDFTjG": "{n} Relays",
|
"QDFTjG": "{n} Relays",
|
||||||
"QJfhKt": "The private key is like a password, but it cannot be reset. Guard it carefully and never show it to anyone. Once someone has your private key, they will have access to your account forever.",
|
"QJfhKt": "The private key is like a password, but it cannot be reset. Guard it carefully and never show it to anyone. Once someone has your private key, they will have access to your account forever.",
|
||||||
"QWhotP": "Zap Pool only works if you use one of the supported wallet connections (WebLN, LNC, LNDHub or Nostr Wallet Connect)",
|
"QWhotP": "Zap Pool only works if you use one of the supported wallet connections (WebLN, LNC, LNDHub or Nostr Wallet Connect)",
|
||||||
|
"QaGyuN": "Zapstr Track",
|
||||||
"QpaLA3": "Channel Message",
|
"QpaLA3": "Channel Message",
|
||||||
"Qxv0B2": "You currently have {number} sats in your zap pool.",
|
"Qxv0B2": "You currently have {number} sats in your zap pool.",
|
||||||
"Qy6/Ft": "Private Direct Messages",
|
"Qy6/Ft": "Private Direct Messages",
|
||||||
@ -431,6 +433,7 @@
|
|||||||
"U30H69": "Community Definition",
|
"U30H69": "Community Definition",
|
||||||
"UJTWqI": "Remove from my relays",
|
"UJTWqI": "Remove from my relays",
|
||||||
"ULXFfP": "Receive",
|
"ULXFfP": "Receive",
|
||||||
|
"ULsJTk": "Published by",
|
||||||
"UNjfWJ": "Check all event signatures received from relays",
|
"UNjfWJ": "Check all event signatures received from relays",
|
||||||
"UT7Nkj": "New Chat",
|
"UT7Nkj": "New Chat",
|
||||||
"UUPFlt": "Users must accept the content warning to show the content of your note.",
|
"UUPFlt": "Users must accept the content warning to show the content of your note.",
|
||||||
|
@ -55,6 +55,7 @@ const enum EventKind {
|
|||||||
LiveEvent = 30311, // NIP-102
|
LiveEvent = 30311, // NIP-102
|
||||||
UserStatus = 30315, // NIP-38
|
UserStatus = 30315, // NIP-38
|
||||||
ZapstrTrack = 31337,
|
ZapstrTrack = 31337,
|
||||||
|
ApplicationHandler = 31_990,
|
||||||
SimpleChatMetadata = 39_000, // NIP-29
|
SimpleChatMetadata = 39_000, // NIP-29
|
||||||
ZapRequest = 9734, // NIP 57
|
ZapRequest = 9734, // NIP 57
|
||||||
ZapReceipt = 9735, // NIP 57
|
ZapReceipt = 9735, // NIP 57
|
||||||
|
Reference in New Issue
Block a user