From 38dd237bf0dd21ad83e2b127a0f4054b065d7d49 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 11 Sep 2022 09:52:29 +0200 Subject: prefs in localStorage --- client-web/source/preferences/ui.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client-web/source/preferences/ui.ts') diff --git a/client-web/source/preferences/ui.ts b/client-web/source/preferences/ui.ts index 72d7792..634d945 100644 --- a/client-web/source/preferences/ui.ts +++ b/client-web/source/preferences/ui.ts @@ -4,8 +4,6 @@ import { change_pref, on_pref_changed, PrefDecl, PREFS } from "./mod.ts"; export class PrefUi extends OverlayUi { constructor() { - console.log(PREFS); - const rows = Object.entries(PREF_DECLS as Record>).filter(e => !e[1].hidden).map(([key_, decl]) => { const key = key_ as keyof typeof PREF_DECLS const id = `pref-${key}` @@ -77,14 +75,20 @@ export class PrefUi extends OverlayUi { const label = elabel(decl.description ?? `[${key}]`, { id }) return etr({ class: "pref" }, etd({}, label), etd({}, use_opt_ ?? ""), etd({}, prim_control ?? "")) }) + const notification_perm = Notification.permission == "granted" ? ediv() : ediv({}, espan("For keks-meet to send notifications, it needs you to grant permission: "), ebutton("Grant", { onclick: () => Notification.requestPermission() }), ) + const reset = ediv({}, + espan("Want to clear all settings? Use this:"), + ebutton("RESET", { onclick: () => { if (confirm("really clear all preferences?")) { localStorage.clear(); window.location.reload() } } }), + ) + const table = document.createElement("table") table.append(...rows) - super(ediv({ class: "prefs-overlay" }, notification_perm, ebr(), table)) + super(ediv({ class: "prefs-overlay" }, notification_perm, reset, ebr(), table)) } } -- cgit v1.2.3-70-g09d2