From 9ee581c4e31e9e4ac552b6a6e432240d3b820d7a Mon Sep 17 00:00:00 2001 From: orosmatthew Date: Mon, 22 Jan 2024 21:38:58 -0500 Subject: [PATCH] [web] Improve confirm modals --- .../admin/contests/[contestId]/+page.svelte | 65 +++++++++++++------ 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/web/src/routes/admin/contests/[contestId]/+page.svelte b/web/src/routes/admin/contests/[contestId]/+page.svelte index 682fcd6..d94f3ed 100644 --- a/web/src/routes/admin/contests/[contestId]/+page.svelte +++ b/web/src/routes/admin/contests/[contestId]/+page.svelte @@ -8,6 +8,17 @@ export let data: PageData; let confirmModal: ConfirmModal; + + function enhanceConfirm(form: HTMLFormElement, text: string) { + enhance(form, async ({ cancel }) => { + if ((await confirmModal.prompt(text)) !== true) { + cancel(); + } + return async ({ update }) => { + await update(); + }; + }); + } @@ -29,25 +40,41 @@ All Contests
-
{ - if ((await confirmModal.prompt('Are you sure?')) !== true) { - cancel(); - } - return async ({ update }) => { - await update(); - }; - }} - > - {#if data.activeTeams === 0} - - - - {:else} - - {/if} -
+ {#if data.activeTeams === 0} +
+ +
+
+ +
+
+ +
+ {:else} +
+ +
+ {/if}