From fce3fd2cb32e720452457c12a2897a9001de4d45 Mon Sep 17 00:00:00 2001 From: Ax333l Date: Mon, 16 Jan 2023 21:57:45 +0100 Subject: [PATCH] feat: fully implement variants --- src/lib/components/atoms/LogoOption.svelte | 13 +++++++++---- src/lib/components/atoms/Variants.svelte | 1 - src/routes/polling/+page.svelte | 13 +++++++------ 3 files changed, 16 insertions(+), 11 deletions(-) delete mode 100644 src/lib/components/atoms/Variants.svelte diff --git a/src/lib/components/atoms/LogoOption.svelte b/src/lib/components/atoms/LogoOption.svelte index c17083e..92bbde8 100644 --- a/src/lib/components/atoms/LogoOption.svelte +++ b/src/lib/components/atoms/LogoOption.svelte @@ -1,7 +1,6 @@ +{#if has_variants} {name} guhhhhhhhhhhhhhhhhhhhhh - + {#each variants as variant} + + + {/each} + +{/if} diff --git a/src/lib/components/atoms/Variants.svelte b/src/lib/components/atoms/Variants.svelte deleted file mode 100644 index 967ae64..0000000 --- a/src/lib/components/atoms/Variants.svelte +++ /dev/null @@ -1 +0,0 @@ - h diff --git a/src/routes/polling/+page.svelte b/src/routes/polling/+page.svelte index 366815c..a7a45ec 100644 --- a/src/routes/polling/+page.svelte +++ b/src/routes/polling/+page.svelte @@ -128,14 +128,15 @@ function calc_selected_logo_ids(v) { if (submit) { return; } - selected = []; + + logos.forEach((v => { + selected[v.name] = []; + })) } async function submitBallot() { - // console.log(token); - throw Error("This shit needs to be redone now hhhhhhh"); const data = { - votes: logos.map((logo) => ({ cid: logo.id, vote: selected.includes(logo.id) })) + votes: logo_ids.map((id) => ({ cid: id, vote: selected_logo_ids.includes(id) })) }; console.log(data); @@ -197,7 +198,7 @@ function calc_selected_logo_ids(v) { {#if selected[name].length != 0} - {#if finalPage && !selected.length} + {#if finalPage && !selected_logo_ids.length}
No logos have been selected.