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