From 175d77f107505b1c310e5d84470f087c8089171a Mon Sep 17 00:00:00 2001 From: afn Date: Thu, 16 Mar 2023 17:19:27 -0400 Subject: [PATCH] fix: revert roundabout and tweak dialogues --- src/lib/components/atoms/Button.svelte | 10 +- src/lib/components/atoms/Dialogue.svelte | 3 +- src/lib/components/atoms/LogoOption.svelte | 8 +- src/routes/poll/+page.svelte | 167 ++++++++++----------- 4 files changed, 89 insertions(+), 99 deletions(-) diff --git a/src/lib/components/atoms/Button.svelte b/src/lib/components/atoms/Button.svelte index 1842fbb..efeccf6 100644 --- a/src/lib/components/atoms/Button.svelte +++ b/src/lib/components/atoms/Button.svelte @@ -29,7 +29,8 @@ button, .button-secondary, - .button-circle { + .button-circle, + .button-text { min-width: max-content; font-size: 1rem; color: #ffd9e1; @@ -47,6 +48,12 @@ gap: 0.5rem; } + .button-text { + background-color: transparent; + padding: 0; + color: #ef96ac; + } + .button-icon { background-color: transparent; height: 24px; @@ -54,6 +61,7 @@ padding: 0; } + .button-primary { background-color: #ffb1c5; box-shadow: 0px 0px 32px 1px var(--accent-color-glow); diff --git a/src/lib/components/atoms/Dialogue.svelte b/src/lib/components/atoms/Dialogue.svelte index 1f7d758..f0ab5f3 100644 --- a/src/lib/components/atoms/Dialogue.svelte +++ b/src/lib/components/atoms/Dialogue.svelte @@ -67,14 +67,13 @@ display: flex; flex-direction: column; align-items: center; - margin-bottom: 20px; + margin-bottom: 16px; } .title { position: sticky; display: flex; flex-direction: column; - align-items: center; gap: 1rem; top: 0; left: 0; diff --git a/src/lib/components/atoms/LogoOption.svelte b/src/lib/components/atoms/LogoOption.svelte index b56dca7..ce8f90b 100644 --- a/src/lib/components/atoms/LogoOption.svelte +++ b/src/lib/components/atoms/LogoOption.svelte @@ -101,11 +101,6 @@
- {#if !hideDetails} -
-

{name}

-
- {/if}
{#if !hideDetails}
@@ -146,6 +141,7 @@ .row { display: flex; align-items: center; + justify-content: center; padding: 1.25rem; gap: 1.5rem; cursor: pointer; @@ -160,7 +156,7 @@ border-radius: 0 0 16px 16px; justify-content: space-between; pointer-events: none; - } + } .action-buttons { display: flex; diff --git a/src/routes/poll/+page.svelte b/src/routes/poll/+page.svelte index 3e3f8cb..145d10f 100644 --- a/src/routes/poll/+page.svelte +++ b/src/routes/poll/+page.svelte @@ -16,7 +16,8 @@ [key: string]: string[]; } - let modalOpen = false; + let helpModal = false; + let clearModal = false; let selected: Selected = {}; function calc_ui_selected_count(v: Selected) { let n = 0; @@ -41,8 +42,7 @@ let max = logoAmount; let token = ''; let submit = false; - let allowReviewSelections = false; - $: finalPage = false; + $: finalPage = currentPage >= logoPages; $: min = currentPage * logoAmount; $: max = min + logoAmount; @@ -100,56 +100,35 @@ // update ui logos = logos; - if (location.hash !== '') { - try { - await exchange_token(location.hash.substring(1)); - } catch (err) { - alert(`Could not exchange the token: ${err}`); - } - } else if (localStorage.getItem('killswitch') === null) { - await goto('/poll/unauthorized/'); - } else { - alert('Warning: no token!'); - } + // if (location.hash !== '') { + // try { + // await exchange_token(location.hash.substring(1)); + // } catch (err) { + // alert(`Could not exchange the token: ${err}`); + // } + // } else if (localStorage.getItem('killswitch') === null) { + // await goto('/poll/unauthorized/'); + // } else { + // alert('Warning: no token!'); + // } }); - function previousPage() { - if (currentPage <= 0) { - if (allowReviewSelections) { - // If the current page is 0 and the user has reached the final page beforehand, go to the final page - currentPage = logoPages - 1; - } else { - // If the current page is 0 and the user has not reached the final page beforehand, return - return; - } - } else { - // If the current page is not 0, go to the previous page - currentPage--; - } - submit = false; - transitionDirection = -5; - } - function preloadImage(url: string) { var img = new Image(); img.src = url; } + function previousPage() { + if (currentPage <= 0) return null; + currentPage--; + submit = false; + transitionDirection = -5; + } + function nextPage() { let nextPage = currentPage + 1; - - // If the current page is the last page, set the current page to the first page - if (currentPage >= logoPages - 1) { - currentPage = 0; - } else { - currentPage++; - - // If the current page is now the last page, allow review selections and set the current page to the first page - if (currentPage >= logoPages - 1) { - allowReviewSelections = true; - nextPage = 0; - } - } + if (currentPage >= logoPages || submit) return null; + currentPage++; const nextMin = nextPage * logoAmount; const nextMax = nextMin + logoAmount; @@ -160,17 +139,6 @@ transitionDirection = 5; } - function stopReview() { - finalPage = false; - submit = false; - } - - function reviewSelections() { - if (allowReviewSelections) { - finalPage = true; - } - } - function submitSelection() { if (ui_selected_count < 1) return null; submit = true; @@ -226,12 +194,12 @@

ReVanced

{finalPage ? 'Review selected logos' : 'Select logos'}

- {ui_selected_count}/{logos.length} selected · Page {currentPage + 1}/{logoPages} + {ui_selected_count}/{logos.length} selected · Page {currentPage + 1}/{logoPages + 1}

- - +
@@ -274,38 +242,30 @@ {#if submit} Submit -
- {#await submitBallot()} -
- Submitting your vote... -
- {:then _} -
- Your vote has been casted. -
- {:catch err} -
- An error occured. Try again later. -
- {err} -
- {/await} -
+ +
+ {#await submitBallot()} +
+ Submitting your vote... +
+ {:then _} +
+ Your vote has been casted. +
+ {:catch err} +
+ An error occurred. Try again later. +
+ {err} +
+ {/await} +
+
{/if}
- {#if !finalPage} - - {/if} - + OK +
+ + + + +
+
+ Deselect all logos? +
+
+
+
+ +
@@ -382,6 +368,7 @@ .buttons { display: flex; justify-content: flex-end; + gap: 1.5rem; } @media screen and (orientation: landscape) and (min-width: 1500px) and (min-height: 950px) { @@ -420,7 +407,7 @@ justify-content: space-between; } - .top-container-text{ + .top-container-text { display: flex; flex-direction: column; gap: 0.5rem;