chore: fix more warnings
This commit is contained in:
parent
13f4ec3f30
commit
0442c3512c
@ -130,3 +130,4 @@ export const Markdown = forwardRef<HTMLDivElement, MarkdownProps>((props: Markdo
|
||||
</div>
|
||||
);
|
||||
});
|
||||
Markdown.displayName = "Markdown";
|
@ -325,3 +325,4 @@ const AsyncFooterIcon = forwardRef((props: AsyncIconProps & { value: number }, r
|
||||
</AsyncIcon>
|
||||
);
|
||||
});
|
||||
AsyncFooterIcon.displayName = "AsyncFooterIcon";
|
@ -21,6 +21,7 @@ export default function NoteReaction(props: NoteReactionProps) {
|
||||
const { isMuted } = useModeration();
|
||||
const { inView, ref } = useInView({ triggerOnce: true, rootMargin: "2000px" });
|
||||
const profile = useUserProfile(inView ? ev.pubkey : "");
|
||||
const root = useMemo(() => extractRoot(), [ev, props.root, inView]);
|
||||
|
||||
const refEvent = useMemo(() => {
|
||||
if (ev) {
|
||||
@ -62,8 +63,6 @@ export default function NoteReaction(props: NoteReactionProps) {
|
||||
return props.root;
|
||||
}
|
||||
|
||||
const root = useMemo(() => extractRoot(), [ev, props.root, inView]);
|
||||
|
||||
if (!inView) {
|
||||
return <div className="card reaction" ref={ref}></div>;
|
||||
}
|
||||
@ -72,6 +71,7 @@ export default function NoteReaction(props: NoteReactionProps) {
|
||||
const opt = {
|
||||
showHeader: ev?.kind === EventKind.Repost || ev?.kind === EventKind.TextNote,
|
||||
showFooter: false,
|
||||
truncate: true
|
||||
};
|
||||
|
||||
return shouldNotBeRendered ? null : (
|
||||
@ -86,7 +86,7 @@ export default function NoteReaction(props: NoteReactionProps) {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{root ? <Note truncate={true} data={root} options={opt} related={[]} depth={props.depth} /> : null}
|
||||
{root ? <Note data={root} options={opt} related={[]} depth={props.depth} /> : null}
|
||||
{!root && refEvent ? (
|
||||
<p>
|
||||
<Link to={eventLink(refEvent[1] ?? "", refEvent[2])}>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import useImgProxy from "@/Hooks/useImgProxy";
|
||||
import React, { HTMLProps, ReactNode, forwardRef, useState, useMemo, useEffect } from "react";
|
||||
import { HTMLProps, ReactNode, forwardRef, useState, useMemo, useEffect } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { getUrlHostname } from "@/SnortUtils";
|
||||
|
||||
@ -12,7 +12,7 @@ type ProxyImgProps = HTMLProps<HTMLImageElement> & {
|
||||
};
|
||||
|
||||
export const ProxyImg = forwardRef<HTMLImageElement, ProxyImgProps>(
|
||||
({ size, className, promptToLoadDirectly, missingImageElement, sha256, ...props }: ProxyImgProps, ref) => {
|
||||
function ProxyImg({ size, className, promptToLoadDirectly, missingImageElement, sha256, ...props }: ProxyImgProps, ref) {
|
||||
const { proxy } = useImgProxy();
|
||||
const [loadFailed, setLoadFailed] = useState(false);
|
||||
const [bypass, setBypass] = useState(CONFIG.media.bypassImgProxyError);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { EventExt, NostrEvent, NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||
import { NostrEvent, NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||
import { useReactions } from "@snort/system-react";
|
||||
|
||||
import PageSpinner from "@/Element/PageSpinner";
|
||||
@ -16,6 +16,7 @@ import { SpotlightThreadModal } from "@/Element/Spotlight/SpotlightThreadModal";
|
||||
import useLogin from "@/Hooks/useLogin";
|
||||
import useCachedFetch from "@/Hooks/useCachedFetch";
|
||||
import { System } from "@/index";
|
||||
import { removeUndefined } from "@snort/shared";
|
||||
|
||||
export default function TrendingNotes({ count = Infinity, small = false }: { count: number, small: boolean }) {
|
||||
const api = new NostrBandApi();
|
||||
@ -28,7 +29,7 @@ export default function TrendingNotes({ count = Infinity, small = false }: { cou
|
||||
isLoading,
|
||||
error,
|
||||
} = useCachedFetch<{ notes: Array<{ event: NostrEvent }> }, Array<NostrEvent>>(trendingNotesUrl, storageKey, data => {
|
||||
return data.notes.map(a => {
|
||||
return removeUndefined(data.notes.map(a => {
|
||||
const ev = a.event;
|
||||
if (!System.Optimizer.schnorrVerify(ev)) {
|
||||
console.error(`Event with invalid sig\n\n${ev}\n\nfrom ${trendingNotesUrl}`);
|
||||
@ -36,7 +37,7 @@ export default function TrendingNotes({ count = Infinity, small = false }: { cou
|
||||
}
|
||||
System.HandleEvent(ev as TaggedNostrEvent);
|
||||
return ev;
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
const login = useLogin();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
const useCachedFetch = <T, R>(url: string, storageKey: string, dataProcessor?: (data: T) => R) => {
|
||||
const cachedData = useMemo(() => {
|
||||
const cachedData = useMemo<{ data: R; timestamp: number }>(() => {
|
||||
const cached = localStorage.getItem(storageKey);
|
||||
return cached ? JSON.parse(cached) : null;
|
||||
}, [storageKey]);
|
||||
|
Loading…
Reference in New Issue
Block a user