This commit is contained in:
parent
e65845af6d
commit
985827ba22
@ -1,4 +1,3 @@
|
|||||||
import { removeUndefined } from "@snort/shared";
|
|
||||||
import { EventKind, NostrLink, NoteCollection, RequestBuilder } from "@snort/system";
|
import { EventKind, NostrLink, NoteCollection, RequestBuilder } from "@snort/system";
|
||||||
import { useEventsFeed, useRequestBuilder } from "@snort/system-react";
|
import { useEventsFeed, useRequestBuilder } from "@snort/system-react";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
@ -16,19 +15,9 @@ export function useLinkList(id: string, fn: (rb: RequestBuilder) => void) {
|
|||||||
const listStore = useRequestBuilder(NoteCollection, sub);
|
const listStore = useRequestBuilder(NoteCollection, sub);
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
if (listStore.data && listStore.data.length > 0) {
|
if (listStore.data && listStore.data.length > 0) {
|
||||||
return removeUndefined(
|
return listStore.data
|
||||||
listStore.data
|
.map(e => NostrLink.fromTags(e.tags))
|
||||||
.map(e =>
|
.flat();
|
||||||
e.tags.map(a => {
|
|
||||||
try {
|
|
||||||
return NostrLink.fromTag(a);
|
|
||||||
} catch {
|
|
||||||
// ignored, skipped
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.flat(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}, [listStore.data]);
|
}, [listStore.data]);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import { EventKind, HexKey, NostrLink, NostrPrefix } from "@snort/system";
|
import { HexKey, NostrLink, NostrPrefix } from "@snort/system";
|
||||||
|
import { useReactions } from "@snort/system-react";
|
||||||
|
|
||||||
import useZapsFeed from "Feed/ZapsFeed";
|
import useZapsFeed from "Feed/ZapsFeed";
|
||||||
import { formatShort } from "Number";
|
import { formatShort } from "Number";
|
||||||
@ -60,11 +61,12 @@ export function RelaysTab({ id }: { id: HexKey }) {
|
|||||||
|
|
||||||
export function BookMarksTab({ id }: { id: HexKey }) {
|
export function BookMarksTab({ id }: { id: HexKey }) {
|
||||||
const bookmarks = useCategorizedBookmarks(id, "bookmark");
|
const bookmarks = useCategorizedBookmarks(id, "bookmark");
|
||||||
|
const reactions = useReactions(`bookmark:reactions:{id}`, bookmarks.map(NostrLink.fromEvent));
|
||||||
return (
|
return (
|
||||||
<Bookmarks
|
<Bookmarks
|
||||||
pubkey={id}
|
pubkey={id}
|
||||||
bookmarks={bookmarks.filter(e => e.kind === EventKind.TextNote)}
|
bookmarks={bookmarks}
|
||||||
related={bookmarks.filter(e => e.kind !== EventKind.TextNote)}
|
related={reactions.data ?? []}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user