fix bugs and simplify
This commit is contained in:
parent
02eef1464c
commit
90842371ca
@ -20,7 +20,7 @@ const Bookmarks = ({ pubkey, bookmarks, related }: BookmarksProps) => {
|
|||||||
const [onlyPubkey, setOnlyPubkey] = useState<HexKey | "all">("all");
|
const [onlyPubkey, setOnlyPubkey] = useState<HexKey | "all">("all");
|
||||||
const loginPubKey = useSelector((s: RootState) => s.login.publicKey);
|
const loginPubKey = useSelector((s: RootState) => s.login.publicKey);
|
||||||
const ps = useMemo(() => {
|
const ps = useMemo(() => {
|
||||||
return [...new Set(bookmarks.map(ev => ev.pubkey))];
|
return [...new Set(bookmarks.filter(ev => ev.kind === EventKind.TextNote).map(ev => ev.pubkey))];
|
||||||
}, [bookmarks]);
|
}, [bookmarks]);
|
||||||
|
|
||||||
function renderOption(p: HexKey) {
|
function renderOption(p: HexKey) {
|
||||||
@ -45,11 +45,7 @@ const Bookmarks = ({ pubkey, bookmarks, related }: BookmarksProps) => {
|
|||||||
.filter(b => (onlyPubkey === "all" ? true : b.pubkey === onlyPubkey))
|
.filter(b => (onlyPubkey === "all" ? true : b.pubkey === onlyPubkey))
|
||||||
.map(n => {
|
.map(n => {
|
||||||
switch (n.kind) {
|
switch (n.kind) {
|
||||||
case EventKind.Reaction:
|
case EventKind.TextNote:
|
||||||
case EventKind.Repost:
|
|
||||||
case EventKind.ZapReceipt:
|
|
||||||
return <NoteReaction data={n} key={n.id} />;
|
|
||||||
default:
|
|
||||||
return (
|
return (
|
||||||
<Note
|
<Note
|
||||||
key={n.id}
|
key={n.id}
|
||||||
@ -58,6 +54,8 @@ const Bookmarks = ({ pubkey, bookmarks, related }: BookmarksProps) => {
|
|||||||
options={{ showTime: false, showBookmarked: true, canUnbookmark: loginPubKey === pubkey }}
|
options={{ showTime: false, showBookmarked: true, canUnbookmark: loginPubKey === pubkey }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user