import useLocalState from "@/state/state"; import type { UserProfile } from "@/types/nostril"; import { useState } from "react"; function Settings() { const { UISettings, keys, profiles, relays, api } = useLocalState(); const [newRelay, setNewRelay] = useState(""); async function saveSetting( bucket: string, key: string, value: string | boolean | number | string[], ) { const json = { "put-entry": { desk: "trill", "bucket-key": bucket, "entry-key": key, value, }, }; // const res = await poke("settings", "settings-event", json); // if (res) refetchSettings(); } async function removeRelay(url: string) { console.log({ url }); } async function addNewRelay() { // // await addnr(newRelay); } async function removeProfile(pubkey: string) { api!.removeKey(pubkey); } async function createProfile() { // api!.createKey(); } return (

Settings

{keys.map((k) => { const profile = profiles.get(k); const profileDiv = !profile ? (
Pubkey: {k}

No profile set

)
) : (
{profile.picture && }
Name: {profile.name}
Pubkey: {k}
About: {profile.about}
); return (
{profileDiv}
); })}
{Object.keys(relays).map((r) => ( // TODO: add connect button to connect and disc to relay one by one
{r}
))}
setNewRelay(e.target.value)} />
); } export default Settings;