web/DialogHolder: fix typescript error, add a note

This commit is contained in:
wukko 2024-07-27 15:28:02 +06:00
parent 26eaac5742
commit b8eb708748
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -8,16 +8,18 @@
$: backdropVisible = $dialogs.length > 0; $: backdropVisible = $dialogs.length > 0;
</script> </script>
<!--
this is the cleanest way of passing props without typescript throwing a fit.
more info here: https://github.com/microsoft/TypeScript/issues/46680
-->
<div id="dialog-holder"> <div id="dialog-holder">
{#each $dialogs as dialog} {#each $dialogs as dialog}
{@const { type, ...data } = dialog} {#if dialog.type === "small"}
<SmallDialog {...dialog} />
{#if type === "small"} {:else if dialog.type === "picker"}
<SmallDialog {...data} /> <PickerDialog {...dialog} />
{:else if type === "picker"} {:else if dialog.type === "saving"}
<PickerDialog {...data} /> <SavingDialog {...dialog} />
{:else if type === "saving"}
<SavingDialog {...data} />
{/if} {/if}
{/each} {/each}
<div id="dialog-backdrop" class:visible={backdropVisible}></div> <div id="dialog-backdrop" class:visible={backdropVisible}></div>