From b1d68ac307ed87d63e83820cbdf843fff0fd9f7f Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 11 Sep 2025 01:48:14 +0700 Subject: init --- front/src/pages/Settings.tsx | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 front/src/pages/Settings.tsx (limited to 'front/src/pages/Settings.tsx') diff --git a/front/src/pages/Settings.tsx b/front/src/pages/Settings.tsx new file mode 100644 index 0000000..e0f1da9 --- /dev/null +++ b/front/src/pages/Settings.tsx @@ -0,0 +1,92 @@ +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; -- cgit v1.2.3