all repos — underbbs @ 03f776e634b89b40ad8674834f28910f8b743b3c

decentralized social media client

placeholder for settings dialogue
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQT/foVVmI9pK13hPWFohAcXSWbK8wUCZiWwDgAKCRBohAcXSWbK
83XYAQD5nDPAa3kOagNeTK5JEC/uKY/nPS7usBSeZXHTRMYkuAEA9DURwuavpOtG
WFR02HvvWtgQED871P58aElOZ/jhNAw=
=Tpiu
-----END PGP SIGNATURE-----
commit

03f776e634b89b40ad8674834f28910f8b743b3c

parent

343cdbd3b5f9d55cc7fb19760879ca1bf50f8212

2 files changed, 37 insertions(+), 3 deletions(-)

jump to
M dist/index.htmldist/index.html

@@ -18,6 +18,7 @@ <div id="err_wrapper" style='display:none'><button id="err_close" onclick="closeErr()">x</button><div id="err_div"></div></div>

<nav> <ul> + <li><a href="#" onclick="showSettings()">settings</a></li> </ul> </nav> <main>
M src/index.jssrc/index.js

@@ -1,14 +1,18 @@

-import { createAdapter, toNostrAdapter } from "./adapter"; +import adapter from "./adapter"; let adapters = []; +function $(id) { + return document.getElementById(id); +} + function main() { - let settings = localStorage.getItem("settings"); + let settings = JSON.parse(localStorage.getItem("settings"));; if (settings != null) { for (let s of settings.adapters) { switch (s.protocol) { case "nostr": - let a = toNostrAdapter(createAdapter(), s); + let a = adapter.toNostrAdapter(adapter.createAdapter(), s); adapters.push(a); break; }

@@ -17,5 +21,34 @@ } else {

console.log("no settings exist for this client"); } }; + +function showSettings() { + // tab bar hidden + let tabbar = $("tabbar"); + tabbar.style.display = "none"; + + // tabcontent to show settings ui + let tabcontent = $("tabcontent"); + + tabcontent.innerHTML = "<p>this is our settings dialogue</p>"; + tabcontent.innerHTML += "<button onclick='saveSettings()'>save</button>"; + +} + +function saveSettings() { + if (window.settings) { + localStorage.setItem("settings", JSON.stringify(window.settings)); + } + // tab bar hidden + let tabbar = $("tabbar"); + tabbar.style.display = "block"; + + // tabcontent to show settings ui + let tabcontent = $("tabcontent"); + tabcontent.innerHTML = ""; +} + +window.showSettings = showSettings; +window.saveSettings = saveSettings; main();