fix chat zapper

This commit is contained in:
2023-07-05 16:05:28 +01:00
parent 89a3928d86
commit ec518f4f6f

View File

@ -11,7 +11,6 @@ import { Profile } from "./profile";
import { Text } from "./text"; import { Text } from "./text";
import { SendZapsDialog } from "./send-zap"; import { SendZapsDialog } from "./send-zap";
import { findTag } from "../utils"; import { findTag } from "../utils";
import { useInView } from "react-intersection-observer";
interface Emoji { interface Emoji {
id: string; id: string;
@ -38,16 +37,12 @@ export function ChatMessage({
reactions: readonly NostrEvent[]; reactions: readonly NostrEvent[];
}) { }) {
const ref = useRef(null); const ref = useRef(null);
const { inView } = useInView({
root: ref.current,
triggerOnce: true
});
const emojiRef = useRef(null); const emojiRef = useRef(null);
const isTablet = useMediaQuery("(max-width: 1020px)"); const isTablet = useMediaQuery("(max-width: 1020px)");
const isHovering = useHover(ref); const isHovering = useHover(ref);
const [showZapDialog, setShowZapDialog] = useState(false); const [showZapDialog, setShowZapDialog] = useState(false);
const [showEmojiPicker, setShowEmojiPicker] = useState(false); const [showEmojiPicker, setShowEmojiPicker] = useState(false);
const profile = useUserProfile(System, inView ? ev.pubkey : undefined); const profile = useUserProfile(System, ev.pubkey);
const zapTarget = profile?.lud16 ?? profile?.lud06; const zapTarget = profile?.lud16 ?? profile?.lud06;
const zaps = useMemo(() => { const zaps = useMemo(() => {
return reactions.filter(a => a.kind === EventKind.ZapReceipt) return reactions.filter(a => a.kind === EventKind.ZapReceipt)