From 705fac16a69cd97b3713b032954d785c184f2cde Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Mon, 22 Jul 2024 09:24:17 +0000 Subject: [PATCH] web/dialog: internal refactor --- web/src/components/dialog/DialogHolder.svelte | 19 ++++--------------- web/src/components/dialog/PickerDialog.svelte | 16 ++++------------ web/src/components/dialog/SmallDialog.svelte | 12 ++++++------ 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/web/src/components/dialog/DialogHolder.svelte b/web/src/components/dialog/DialogHolder.svelte index a77607c3..72941b1a 100644 --- a/web/src/components/dialog/DialogHolder.svelte +++ b/web/src/components/dialog/DialogHolder.svelte @@ -9,22 +9,11 @@
{#each $dialogs as dialog} - {#if dialog.type === "small"} - + {@const { type, ...data } = dialog} + {#if type === "small"} + {:else if dialog.type === "picker"} - + {/if} {/each}
diff --git a/web/src/components/dialog/PickerDialog.svelte b/web/src/components/dialog/PickerDialog.svelte index c1bb82a5..fe269cee 100644 --- a/web/src/components/dialog/PickerDialog.svelte +++ b/web/src/components/dialog/PickerDialog.svelte @@ -15,8 +15,8 @@ import IconBoxMultiple from "@tabler/icons-svelte/IconBoxMultiple.svelte"; export let id: string; - export let items: Optional; - export let buttons: Optional; + export let items: Optional = undefined; + export let buttons: Optional = undefined; let dialogDescription = "dialog.picker.description."; @@ -50,14 +50,6 @@ open = true; }); } - - // item id for alt text - let counter = 0; - - const itemNumber = () => { - counter++ - return counter - }
{#if items} - {#each items as item} - + {#each items as item, i} + {/each} {/if}
diff --git a/web/src/components/dialog/SmallDialog.svelte b/web/src/components/dialog/SmallDialog.svelte index b2951d62..d54f2b13 100644 --- a/web/src/components/dialog/SmallDialog.svelte +++ b/web/src/components/dialog/SmallDialog.svelte @@ -13,12 +13,12 @@ import IconAlertTriangle from "@tabler/icons-svelte/IconAlertTriangle.svelte"; export let id: string; - export let meowbalt: Optional; - export let icon: Optional; - export let title: string = ""; - export let bodyText: string = ""; - export let bodySubText: string = ""; - export let buttons: Optional; + export let meowbalt: Optional = undefined; + export let icon: Optional = undefined; + export let title = ""; + export let bodyText = ""; + export let bodySubText = ""; + export let buttons: Optional = undefined; let dialogParent: HTMLDialogElement;