note content rendering fix

This commit is contained in:
Martti Malmi
2023-12-18 13:24:04 +02:00
parent e2e3c9e638
commit 63b3ad2d57

View File

@ -45,29 +45,32 @@ export interface NoteProps {
export default function Note(props: NoteProps) {
const { data: ev, className } = props;
let content;
if (ev.kind === EventKind.Repost) {
switch (ev.kind) {
case EventKind.Repost:
content = <NoteReaction data={ev} key={ev.id} root={undefined} depth={(props.depth ?? 0) + 1} />;
}
if (ev.kind === EventKind.FileHeader) {
break;
case EventKind.FileHeader:
content = <NostrFileElement ev={ev} />;
}
if (ev.kind === EventKind.ZapstrTrack) {
break;
case EventKind.ZapstrTrack:
content = <ZapstrEmbed ev={ev} />;
}
if (ev.kind === EventKind.FollowSet || ev.kind === EventKind.ContactList) {
break;
case EventKind.FollowSet:
case EventKind.ContactList:
content = <PubkeyList ev={ev} className={className} />;
}
if (ev.kind === EventKind.LiveEvent) {
break;
case EventKind.LiveEvent:
content = <LiveEvent ev={ev} />;
}
if (ev.kind === EventKind.SetMetadata) {
break;
case EventKind.SetMetadata:
content = <ProfilePreview actions={<></>} pubkey={ev.pubkey} />;
}
if (ev.kind === (9041 as EventKind)) {
break;
case 9041: // Assuming 9041 is a valid EventKind
content = <ZapGoal ev={ev} />;
}
if (ev.kind === EventKind.LongFormTextNote) {
break;
case EventKind.LongFormTextNote:
content = (
<LongFormText
ev={ev}
@ -77,8 +80,10 @@ export default function Note(props: NoteProps) {
truncate={props.options?.truncate}
/>
);
break;
default:
content = <NoteInner {...props} />;
}
content = <NoteInner {...props} />;
return <ErrorBoundary>{content}</ErrorBoundary>;
}