import "./EventComponent.css"; import { EventKind, NostrEvent, TaggedNostrEvent } from "@snort/system"; import { memo, ReactNode } from "react"; import PubkeyList from "@/Components/Embed/PubkeyList"; import ZapstrEmbed from "@/Components/Embed/ZapstrEmbed"; import ErrorBoundary from "@/Components/ErrorBoundary"; import { NostrFileElement } from "@/Components/Event/NostrFileHeader"; import NoteReaction from "@/Components/Event/NoteReaction"; import { ZapGoal } from "@/Components/Event/ZapGoal"; import { LiveEvent } from "@/Components/LiveStream/LiveEvent"; import ProfilePreview from "@/Components/User/ProfilePreview"; import { LongFormText } from "./LongFormText"; import { Note } from "./Note/Note"; export interface NotePropsOptions { isRoot?: boolean; showHeader?: boolean; showContextMenu?: boolean; showProfileCard?: boolean; showTime?: boolean; showPinned?: boolean; showBookmarked?: boolean; showFooter?: boolean; showReactionsLink?: boolean; showMedia?: boolean; canUnpin?: boolean; canUnbookmark?: boolean; canClick?: boolean; showMediaSpotlight?: boolean; longFormPreview?: boolean; truncate?: boolean; } export interface NoteProps { data: TaggedNostrEvent; className?: string; highlight?: boolean; ignoreModeration?: boolean; onClick?: (e: TaggedNostrEvent) => void; depth?: number; searchedValue?: string; threadChains?: Map>; context?: ReactNode; options?: NotePropsOptions; waitUntilInView?: boolean; } export default memo(function EventComponent(props: NoteProps) { const { data: ev, className } = props; let content; switch (ev.kind) { case EventKind.Repost: content = ; break; case EventKind.FileHeader: content = ; break; case EventKind.ZapstrTrack: content = ; break; case EventKind.FollowSet: case EventKind.ContactList: content = ; break; case EventKind.LiveEvent: content = ; break; case EventKind.SetMetadata: content = } pubkey={ev.pubkey} />; break; case 9041: // Assuming 9041 is a valid EventKind content = ; break; case EventKind.LongFormTextNote: content = ( props.onClick?.(ev)} truncate={props.options?.truncate} /> ); break; default: content = ; } return {content}; });