forked from Kieran/snort
filtering moved to ProfilePage
This commit is contained in:
parent
b68693d7c2
commit
f61630619a
@ -18,7 +18,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.filter(ev => ev.kind === EventKind.TextNote).map(ev => ev.pubkey))];
|
return [...new Set(bookmarks.map(ev => ev.pubkey))];
|
||||||
}, [bookmarks]);
|
}, [bookmarks]);
|
||||||
|
|
||||||
function renderOption(p: HexKey) {
|
function renderOption(p: HexKey) {
|
||||||
@ -42,19 +42,14 @@ const Bookmarks = ({ pubkey, bookmarks, related }: BookmarksProps) => {
|
|||||||
{bookmarks
|
{bookmarks
|
||||||
.filter(b => (onlyPubkey === "all" ? true : b.pubkey === onlyPubkey))
|
.filter(b => (onlyPubkey === "all" ? true : b.pubkey === onlyPubkey))
|
||||||
.map(n => {
|
.map(n => {
|
||||||
switch (n.kind) {
|
return (
|
||||||
case EventKind.TextNote:
|
<Note
|
||||||
return (
|
key={n.id}
|
||||||
<Note
|
data={n}
|
||||||
key={n.id}
|
related={related}
|
||||||
data={n}
|
options={{ showTime: false, showBookmarked: true, canUnbookmark: loginPubKey === pubkey }}
|
||||||
related={related}
|
/>
|
||||||
options={{ showTime: false, showBookmarked: true, canUnbookmark: loginPubKey === pubkey }}
|
);
|
||||||
/>
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -91,7 +91,13 @@ function RelaysTab({ id }: { id: HexKey }) {
|
|||||||
|
|
||||||
function BookMarksTab({ id }: { id: HexKey }) {
|
function BookMarksTab({ id }: { id: HexKey }) {
|
||||||
const bookmarks = useBookmarkFeed(id);
|
const bookmarks = useBookmarkFeed(id);
|
||||||
return <Bookmarks pubkey={id} bookmarks={bookmarks} related={bookmarks} />;
|
return (
|
||||||
|
<Bookmarks
|
||||||
|
pubkey={id}
|
||||||
|
bookmarks={bookmarks.filter(e => e.kind === EventKind.TextNote)}
|
||||||
|
related={bookmarks.filter(e => e.kind !== EventKind.TextNote)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ProfilePage() {
|
export default function ProfilePage() {
|
||||||
|
Loading…
Reference in New Issue
Block a user