feat: discover page

This commit is contained in:
2023-05-15 09:51:17 +01:00
parent 6fa242c5f9
commit 3e5b7ec4a6
9 changed files with 108 additions and 5 deletions

View File

@ -0,0 +1,36 @@
import { useEffect, useState } from "react";
import { HexKey, NostrPrefix } from "@snort/nostr";
import { FormattedMessage } from "react-intl";
import FollowListBase from "Element/FollowListBase";
import PageSpinner from "Element/PageSpinner";
import NostrBandApi from "External/NostrBand";
import useLogin from "Hooks/useLogin";
import { hexToBech32 } from "Util";
export default function SuggestedProfiles() {
const login = useLogin();
const [userList, setUserList] = useState<HexKey[]>();
async function loadSuggestedProfiles() {
const api = new NostrBandApi();
const users = await api.sugguestedFollows(hexToBech32(NostrPrefix.PublicKey, login.publicKey));
const keys = users.profiles.map(a => a.pubkey);
setUserList(keys);
}
useEffect(() => {
loadSuggestedProfiles().catch(console.error);
}, []);
if (!userList) return <PageSpinner />;
return (
<>
<h3>
<FormattedMessage defaultMessage="Suggested Follows" />
</h3>
<FollowListBase pubkeys={userList} showAbout={true} />
</>
);
}