From 507b9c3f4cc27f8aec9cab8e8dece854c5cd9863 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 15 Dec 2024 00:32:11 +0100 Subject: [PATCH] feat(frontend): custom preference editor --- .../src/lib/components/IconButton.svelte | 18 +++- .../editor/CustomPreferenceEditor.svelte | 41 ++++++++ .../editor/PreferenceIconSelector.svelte | 80 +++++++++++++++ .../editor/PreferenceSizeEditor.svelte | 43 ++++++++ .../src/lib/i18n/locales/en.json | 16 ++- .../src/routes/settings/+layout.svelte | 6 ++ .../src/routes/settings/flags/+page.svelte | 2 +- .../routes/settings/members/[id]/+page.svelte | 2 +- .../src/routes/settings/prefs/+page.svelte | 99 +++++++++++++++++++ .../routes/settings/profile/bio/+page.svelte | 3 +- 10 files changed, 302 insertions(+), 8 deletions(-) create mode 100644 Foxnouns.Frontend/src/lib/components/editor/CustomPreferenceEditor.svelte create mode 100644 Foxnouns.Frontend/src/lib/components/editor/PreferenceIconSelector.svelte create mode 100644 Foxnouns.Frontend/src/lib/components/editor/PreferenceSizeEditor.svelte create mode 100644 Foxnouns.Frontend/src/routes/settings/prefs/+page.svelte diff --git a/Foxnouns.Frontend/src/lib/components/IconButton.svelte b/Foxnouns.Frontend/src/lib/components/IconButton.svelte index 1feedd9..a370002 100644 --- a/Foxnouns.Frontend/src/lib/components/IconButton.svelte +++ b/Foxnouns.Frontend/src/lib/components/IconButton.svelte @@ -11,15 +11,29 @@ id?: string; onclick?: MouseEventHandler; outline?: boolean; + active?: boolean; + class?: string; }; - let { icon, tooltip, color = "primary", type, id, onclick, outline }: Props = $props(); + let { + icon, + tooltip, + color = "primary", + type, + id, + onclick, + outline, + active, + class: className, + }: Props = $props(); + + + + + + +
+ {#each customPreferences as _, idx} + remove(idx)} /> + {/each} +
+ +
diff --git a/Foxnouns.Frontend/src/routes/settings/profile/bio/+page.svelte b/Foxnouns.Frontend/src/routes/settings/profile/bio/+page.svelte index 4ec8717..19e04fb 100644 --- a/Foxnouns.Frontend/src/routes/settings/profile/bio/+page.svelte +++ b/Foxnouns.Frontend/src/routes/settings/profile/bio/+page.svelte @@ -3,7 +3,6 @@ import type { ActionData, PageData } from "./$types"; import BioEditor from "$components/editor/BioEditor.svelte"; import { t } from "$lib/i18n"; - import { enhance } from "$app/forms"; type Props = { data: PageData; form: ActionData }; let { data, form }: Props = $props(); @@ -13,6 +12,6 @@

{$t("edit-profile.bio-tab")}

-
+