import { NostrLink, TaggedNostrEvent } from "@snort/system"; import { useEventReactions, useReactions } from "@snort/system-react"; import React, { useMemo, useState } from "react"; import { FooterZapButton } from "@/Components/Event/Note/NoteFooter/FooterZapButton"; import { LikeButton } from "@/Components/Event/Note/NoteFooter/LikeButton"; import { PowIcon } from "@/Components/Event/Note/NoteFooter/PowIcon"; import { ReplyButton } from "@/Components/Event/Note/NoteFooter/ReplyButton"; import { RepostButton } from "@/Components/Event/Note/NoteFooter/RepostButton"; import ReactionsModal from "@/Components/Event/Note/ReactionsModal"; import useLogin from "@/Hooks/useLogin"; export interface NoteFooterProps { replyCount?: number; ev: TaggedNostrEvent; } export default function NoteFooter(props: NoteFooterProps) { const { ev } = props; const link = useMemo(() => NostrLink.fromEvent(ev), [ev.id]); const ids = useMemo(() => [link], [link]); const [showReactions, setShowReactions] = useState(false); const related = useReactions("reactions", ids, undefined, false); const { replies, reactions, zaps, reposts } = useEventReactions(link, related); const { positive } = reactions; const { preferences: prefs, readonly } = useLogin(s => ({ preferences: s.appData.json.preferences, publicKey: s.publicKey, readonly: s.readonly, })); return (
{prefs.enableReactions && } {CONFIG.showPowIcon && } setShowReactions(true)} /> {showReactions && setShowReactions(false)} event={ev} />}
); }