diff --git a/src/app.css b/src/app.css index f4f2d8f..a3e1ace 100644 --- a/src/app.css +++ b/src/app.css @@ -47,6 +47,7 @@ body { --white: #fff; --accent-color: #9fd5ff; --accent-color-two: hsl(207, 65%, 90%); + --accent-low-opacity: #4b5f798a; --bg-color: hsl(240, 2%, 11%); --grey-one: #252b31; --grey-two: #28313b; diff --git a/src/lib/components/atoms/LogoOption.svelte b/src/lib/components/atoms/LogoOption.svelte index 3006387..eb001c4 100644 --- a/src/lib/components/atoms/LogoOption.svelte +++ b/src/lib/components/atoms/LogoOption.svelte @@ -17,7 +17,6 @@ selected = selected; } console.log(selected); - localStorage.setItem('selected', JSON.stringify(selected)); }; @@ -68,7 +67,7 @@ } .clicked { - background-color: var(--grey-three); + background-color: var(--accent-low-opacity); } .clicked h2, diff --git a/src/routes/polling/+page.svelte b/src/routes/polling/+page.svelte index c705eb0..de49469 100644 --- a/src/routes/polling/+page.svelte +++ b/src/routes/polling/+page.svelte @@ -15,15 +15,8 @@ let min = 0; let max = logoAmount; let token: string = ''; - let submit = false; - - // try { - // currentPage = Number(localStorage.getItem('currentPage')) || 0; - // selected = JSON.parse(localStorage.getItem('selected')) || []; - // } catch (err) { - // console.log(err); - // } + $: finalPage = currentPage >= logoPages; // TODO: catch blocks. async function exchange_token(bot_token: string) { @@ -45,7 +38,7 @@ // you will never see shittier code tm // will refactor later maybe idk - // Reply: don't think we need to refactor because nobody cares if this code is shit lol + // Reply: don't think we need to refactor because nobody cares if this code is shit lol onMount(async () => { window['use_token'] = exchange_token; window['submit_poll'] = submitBallot; @@ -87,9 +80,9 @@ }); function previousPage() { - if (currentPage <= 0 || submit) return null; + if (currentPage <= 0) return null; currentPage--; - // localStorage.setItem('currentPage', currentPage.toString()); + submit = false; min = currentPage * logoAmount; max = min + logoAmount; @@ -99,7 +92,6 @@ function nextPage() { if (currentPage >= logoPages || submit) return null; currentPage++; - // localStorage.setItem('currentPage', currentPage.toString()); min = currentPage * logoAmount; max = min + logoAmount; @@ -107,11 +99,10 @@ } function clearLogos() { - if (submit) { - return; - } + if (submit) { + return; + } selected = []; - // localStorage.setItem('selected', JSON.stringify(selected)); } async function submitBallot() { @@ -138,8 +129,6 @@ throw Error('Vote not cast.'); } } - - $: finalPage = currentPage >= logoPages; @@ -203,11 +192,29 @@
No logos have been selected.
{/if} + + {#if submit} +
+ {#await submitBallot()} +
+ Submitting... +
+ {:then _} +
+ Your vote has been cast. +
+ {:catch err} +
+ An error occured. Try again later. +
+ {err} +
+ {/await} +
+ {/if}
- +
- - {#if submit} -
- {#await submitBallot()} -
Submitting...
- {:then _} -
Your vote has been cast.
- {:catch err} -
- An error occured. Try again later. -
- {err} -
- {/await} -
- {/if}