Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/frontend/src/lib/components/app/core/Confirmation.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { createEventDispatcher, type Snippet } from 'svelte';

Check warning on line 2 in src/frontend/src/lib/components/app/core/Confirmation.svelte

View workflow job for this annotation

GitHub Actions / lint

'createEventDispatcher' is defined but never used. Allowed unused vars must match /^_/u
import { stopPropagation } from 'svelte/legacy';

Check warning on line 3 in src/frontend/src/lib/components/app/core/Confirmation.svelte

View workflow job for this annotation

GitHub Actions / lint

'stopPropagation' is defined but never used. Allowed unused vars must match /^_/u
import Popover from '$lib/components/ui/Popover.svelte';
import { isBusy } from '$lib/derived/app/busy.derived';
Expand All @@ -10,13 +10,18 @@
title?: Snippet;
children: Snippet;
size?: 'default' | 'wide';
onyes: () => Promise<void>;
onno: () => void;
}

let { visible = $bindable(false), title, children, size = 'default' }: Props = $props();

const dispatch = createEventDispatcher();
const yes = () => dispatch('junoYes');
const no = () => dispatch('junoNo');
let {
visible = $bindable(false),
title,
children,
size = 'default',
onyes,
onno
}: Props = $props();

let center = $derived(size === 'wide' ? ('wide' as const) : true);
</script>
Expand All @@ -27,11 +32,11 @@

{@render children()}

<button disabled={$isBusy} onclick={stopPropagation(no)} type="button">
<button disabled={$isBusy} onclick={onno} type="button">
{$i18n.core.no}
</button>

<button disabled={$isBusy} onclick={stopPropagation(yes)} type="button">
<button disabled={$isBusy} onclick={onyes} type="button">
{$i18n.core.yes}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
};
</script>

<Confirmation bind:visible on:junoYes={deleteController} on:junoNo={close}>
<Confirmation onno={close} onyes={deleteController} bind:visible>
{#snippet title()}
{$i18n.controllers.delete_question}
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<button class="menu" onclick={() => (visible = true)}><IconLinkOff /> {$i18n.core.detach}</button>

<Confirmation bind:visible on:junoYes={detach} on:junoNo={close}>
<Confirmation onno={close} onyes={detach} bind:visible>
{#snippet title()}
<Text key="canisters.detach_title" value={segment} />
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

<button class="menu" onclick={() => (visible = true)}><IconStart /> {$i18n.core.start}</button>

<Confirmation bind:visible on:junoYes={start} on:junoNo={close}>
<Confirmation onno={close} onyes={start} bind:visible>
{#snippet title()}
<Text key="canisters.start_tile" value={segment} />
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<button class="menu" onclick={() => (visible = true)}><IconStop /> {$i18n.core.stop}</button>

<Confirmation bind:visible on:junoYes={stop} on:junoNo={close}>
<Confirmation onno={close} onyes={stop} bind:visible>
{#snippet title()}
<Text key="canisters.stop_title" value={segment} />
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@
onaction={() => (visibleDelete = true)}
/>

<Confirmation
size="wide"
bind:visible={visibleDelete}
on:junoYes={deleteRepoConfig}
on:junoNo={close}
>
<Confirmation onno={close} onyes={deleteRepoConfig} size="wide" bind:visible={visibleDelete}>
{#snippet title()}
{$i18n.automation.delete_title}
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

<button onclick={() => (visible = true)} type="button">{$i18n.core.delete}</button>

<Confirmation bind:visible on:junoYes={deleteCollection} on:junoNo={close}>
<Confirmation onno={close} onyes={deleteCollection} bind:visible>
{#snippet title()}
{$i18n.collections.delete_question}
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
><IconDelete size="20px" /> {@render button?.()}</button
>

<Confirmation {children} {title} bind:visible on:junoYes={deleteSelectedData} on:junoNo={close} />
<Confirmation {children} onno={close} onyes={deleteSelectedData} {title} bind:visible />
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<button onclick={open}>{$i18n.hosting.switch_memory}</button>

<Confirmation bind:visible on:junoYes={switchMemory} on:junoNo={close}>
<Confirmation onno={close} onyes={switchMemory} bind:visible>
{#snippet title()}
{$i18n.hosting.switch_memory}
{/snippet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<button onclick={() => (visible = true)} type="button">{$i18n.core.export}</button>
{/if}

<Confirmation bind:visible on:junoYes={exportTransactions} on:junoNo={close}>
<Confirmation onno={close} onyes={exportTransactions} bind:visible>
{#snippet title()}
{$i18n.wallet.export_title}
{/snippet}
Expand Down