mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix confirm overlay bind
parent
22fffcc422
commit
b2f10e31f7
|
@ -12,6 +12,11 @@
|
||||||
export let confirm: ConfirmProps | null = null
|
export let confirm: ConfirmProps | null = null
|
||||||
export let error: string | null
|
export let error: string | null
|
||||||
export let loading: boolean = false
|
export let loading: boolean = false
|
||||||
|
|
||||||
|
function doConfirm(fn: () => void) {
|
||||||
|
confirm = null
|
||||||
|
fn()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if confirm}
|
{#if confirm}
|
||||||
|
@ -22,15 +27,9 @@
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
{#if confirm.cancel}
|
{#if confirm.cancel}
|
||||||
<!-- Svelte LSP is very annoying here -->
|
<button on:click={() => doConfirm(confirm!!.cancel!!)}>{t('action.cancel')}</button>
|
||||||
<button on:click={() => {
|
|
||||||
confirm && confirm.cancel && confirm.cancel()
|
|
||||||
|
|
||||||
// Set to null
|
|
||||||
confirm = null
|
|
||||||
}}>{t('action.cancel')}</button>
|
|
||||||
{/if}
|
{/if}
|
||||||
<button on:click={() => confirm && confirm.confirm()} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
<button on:click={() => doConfirm(confirm!!.confirm)} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
defaultGame()
|
defaultGame()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<StatusOverlays {confirm} {error} />
|
<StatusOverlays bind:confirm={confirm} {error} />
|
||||||
|
|
||||||
<main class="content">
|
<main class="content">
|
||||||
<div class="outer-title-options">
|
<div class="outer-title-options">
|
||||||
|
|
Loading…
Reference in New Issue