refactor: simplify useEventReactions hook

This commit is contained in:
2023-11-14 12:55:46 +00:00
parent c794a9e393
commit 7174ed2502
8 changed files with 14 additions and 28 deletions

View File

@ -1,7 +1,7 @@
import "./LongFormText.css";
import { CSSProperties, useCallback, useRef, useState } from "react";
import { FormattedMessage, FormattedNumber } from "react-intl";
import { TaggedNostrEvent } from "@snort/system";
import { NostrLink, TaggedNostrEvent } from "@snort/system";
import { useEventReactions } from "@snort/system-react";
import { findTag } from "SnortUtils";
@ -26,7 +26,7 @@ export function LongFormText(props: LongFormTextProps) {
const { proxy } = useImgProxy();
const [reading, setReading] = useState(false);
const ref = useRef<HTMLDivElement>(null);
const { reactions, reposts, zaps } = useEventReactions(props.ev, props.related);
const { reactions, reposts, zaps } = useEventReactions(NostrLink.fromEvent(props.ev), props.related);
function previewText() {
return (

View File

@ -36,7 +36,7 @@ export function NoteInner(props: NoteProps) {
const { isEventMuted } = useModeration();
const { ref, inView } = useInView({ triggerOnce: true });
const { reactions, reposts, deletions, zaps } = useEventReactions(ev, related);
const { reactions, reposts, deletions, zaps } = useEventReactions(NostrLink.fromEvent(ev), related);
const login = useLogin();
const { pinned, bookmarked } = login;
const { publisher, system } = useEventPublisher();