From 6f6f30e3bbb9f88f81ac417cde3aa3e672e79a44 Mon Sep 17 00:00:00 2001 From: afn Date: Sun, 25 Dec 2022 16:56:38 -0500 Subject: [PATCH] feat: improved patches page ui --- src/app.scss | 13 +- src/layout/Navbar/NavButton.svelte | 2 +- src/layout/Navbar/NavHost.svelte | 53 ++++---- src/lib/components/FilterChip.svelte | 50 ++++++++ src/lib/components/Modal.svelte | 41 +++++- src/lib/components/Search.svelte | 51 ++++---- src/lib/components/Spinner.svelte | 17 ++- .../contributors/ContributorPerson.svelte | 4 +- .../contributors/ContributorSection.svelte | 3 +- src/routes/patches/+page.svelte | 119 ++++++++++++++---- .../patches/Package.svelte} | 36 +++--- .../patches/PackageMenu.svelte} | 16 ++- src/routes/patches/PatchItem.svelte | 61 ++++----- static/icons/check.svg | 1 + static/icons/search.svg | 2 +- 15 files changed, 314 insertions(+), 155 deletions(-) create mode 100644 src/lib/components/FilterChip.svelte rename src/{lib/components/TreeView/TreeMenuButton.svelte => routes/patches/Package.svelte} (76%) rename src/{lib/components/TreeView/TreeMenu.svelte => routes/patches/PackageMenu.svelte} (79%) create mode 100644 static/icons/check.svg diff --git a/src/app.scss b/src/app.scss index 275d04e..c7c0503 100644 --- a/src/app.scss +++ b/src/app.scss @@ -34,23 +34,24 @@ body { } :root { + /* TODO properly name these */ --main-font: "Manrope", sans-serif; --mono-font: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; --white: hsl(206, 100%, 94%); --accent-color: hsl(206, 100%, 81%); - --accent-color-two: hsl(208, 28%, 82%); - --accent-low-opacity: hsla(205, 100%, 81%, 0.1); + --accent-color-two: hsl(208, 75%, 82%); + --accent-low-opacity: hsla(205, 100%, 81%, 0.15); --bg-color: hsl(252, 10%, 11%); --grey-one: hsl(210, 14%, 17%); --grey-two: hsl(212, 19%, 19%); --grey-three: hsl(221, 17%, 26%); --grey-four: hsl(226, 48%, 18%); --grey-five: hsl(208, 30%, 75%); - --grey-six: hsl(230, 7%, 13%); + --grey-six: hsl(230, 9%, 13%); --grey-seven: hsl(240, 9%, 13.5%); --grey-eight: hsla(207, 30%, 75%, 0.577); --grey-nine: hsla(240, 6%, 7%, 0.3); - --grey-ten: hsl(230, 9.5%, 17%); + --grey-ten: hsl(230, 9.5%, 17.5%); --bezier-one: cubic-bezier(0.25, 0.46, 0.45, 0.94); } @@ -144,9 +145,9 @@ p { hr { display: block; - height: 1px; + height: 2px; border: 0; - border-top: 1px solid var(--grey-three); + border-top: 2px solid var(--grey-three); } input { diff --git a/src/layout/Navbar/NavButton.svelte b/src/layout/Navbar/NavButton.svelte index 851df0c..ec26d0b 100644 --- a/src/layout/Navbar/NavButton.svelte +++ b/src/layout/Navbar/NavButton.svelte @@ -59,7 +59,7 @@ @media (max-width: 768px) { li { - padding: 1rem 1.25rem; + padding: 0.75rem 1.25rem; text-align: left; justify-content: left; border-radius: 100px; diff --git a/src/layout/Navbar/NavHost.svelte b/src/layout/Navbar/NavHost.svelte index a2ceb18..029fe57 100644 --- a/src/layout/Navbar/NavHost.svelte +++ b/src/layout/Navbar/NavHost.svelte @@ -97,31 +97,34 @@ -
+
(menuOpen = !menuOpen)} + on:keypress={() => (menuOpen = !menuOpen)} + />
{/if} -
-

Settings

-

Configure the website's API. Defaults to ReVanced.

-
-
- - -
-
- - -
+ Settings + Configure the website's API. Defaults to ReVanced. +
+
+ + +
+
+ +
@@ -144,14 +147,6 @@ align-items: center; } - .settings-menu h3 { - text-align: center; - margin-bottom: 1rem; - } - .settings-menu p { - margin-bottom: 1.25rem; - } - .input-wrapper { margin-bottom: 0.75rem; display: flex; @@ -207,7 +202,7 @@ a { display: flex; } - + img { height: 22px; } @@ -228,7 +223,7 @@ left: 0; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, 0.3); + background-color: rgba(0, 0, 0, 0.5); z-index: 88; } diff --git a/src/lib/components/FilterChip.svelte b/src/lib/components/FilterChip.svelte new file mode 100644 index 0000000..d3d9dd1 --- /dev/null +++ b/src/lib/components/FilterChip.svelte @@ -0,0 +1,50 @@ + + + + + diff --git a/src/lib/components/Modal.svelte b/src/lib/components/Modal.svelte index a3b69e8..35900b6 100644 --- a/src/lib/components/Modal.svelte +++ b/src/lib/components/Modal.svelte @@ -17,7 +17,19 @@ aria-modal="true" transition:fade={{ easing: quadInOut, duration: 250 }} > - +
+

+ +

+
+ + {#if $$slots.description} +

+ +

+ {/if} + +
{/if} @@ -32,13 +44,30 @@ z-index: 999; } + h3 { + text-align: center; + } + + .title { + position: sticky; + padding-top: 46px; + padding-bottom: 20px; + top: 0; + width: 100%; + background-color: var(--grey-six); + } + p { + margin-bottom: 1rem; + } + .modal { position: fixed; width: min(85%, 425px); + max-height: 75%; + overflow-y: scroll; top: 50%; left: 50%; transform: translate(-50%, -50%); - padding: 46px 36px; border-radius: 26px; background-color: var(--grey-six); display: flex; @@ -52,4 +81,12 @@ box-shadow: 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12), 0px 2px 4px -1px rgba(0, 0, 0, 0.2); } + + .slot { + padding: 0px 28px 36px 28px; + } + + .modal::-webkit-scrollbar { + display: none; + } diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte index d897c7e..40d78f2 100644 --- a/src/lib/components/Search.svelte +++ b/src/lib/components/Search.svelte @@ -11,7 +11,7 @@ } -
+
Search {#if searchTerm} diff --git a/src/lib/components/Spinner.svelte b/src/lib/components/Spinner.svelte index 11e0f95..284dbc3 100644 --- a/src/lib/components/Spinner.svelte +++ b/src/lib/components/Spinner.svelte @@ -1,7 +1,10 @@ -
+ +
+
+
diff --git a/src/routes/patches/+page.svelte b/src/routes/patches/+page.svelte index 8240a78..62f08a7 100644 --- a/src/routes/patches/+page.svelte +++ b/src/routes/patches/+page.svelte @@ -5,11 +5,13 @@ import type { Patch } from '$lib/types'; import { patches as api_patches } from '$data/api'; - import TreeMenu from '$lib/components/TreeView/TreeMenu.svelte'; - import TreeMenuButton from '$lib/components/TreeView/TreeMenuButton.svelte'; + import PackageMenu from './PackageMenu.svelte'; + import Package from './Package.svelte'; import PatchItem from './PatchItem.svelte'; import Footer from '$layout/Footer.svelte'; import Search from '$lib/components/Search.svelte'; + import FilterChip from '$lib/components/FilterChip.svelte'; + import Modal from '$lib/components/Modal.svelte'; $: ({ patches, packages } = $api_patches); @@ -17,6 +19,7 @@ let searchTerm: string; let searchTermFiltered: string; let timeout: any = null; + let mobilePackages = false; function filterByPackage(selectedPkg: string | boolean, packageList: any) { for (let i = 0; i < packageList.length; i++) { @@ -63,18 +66,57 @@ +
@@ -98,15 +140,28 @@ diff --git a/src/lib/components/TreeView/TreeMenuButton.svelte b/src/routes/patches/Package.svelte similarity index 76% rename from src/lib/components/TreeView/TreeMenuButton.svelte rename to src/routes/patches/Package.svelte index dfd2acb..02a508f 100644 --- a/src/lib/components/TreeView/TreeMenuButton.svelte +++ b/src/routes/patches/Package.svelte @@ -19,9 +19,10 @@ diff --git a/src/routes/patches/PatchItem.svelte b/src/routes/patches/PatchItem.svelte index fb40f47..7b550c7 100644 --- a/src/routes/patches/PatchItem.svelte +++ b/src/routes/patches/PatchItem.svelte @@ -2,8 +2,7 @@ import { slide, fade } from 'svelte/transition'; import { quintOut } from 'svelte/easing'; import type { Patch } from '$lib/types'; - import { friendlyName } from '$lib/utils' - + import { friendlyName } from '$lib/utils'; export let patch: Patch; const hasPatchOptions = !!patch.options.length; @@ -26,37 +25,34 @@ {/if}
{patch.description}
-
+
    {#each patch.compatiblePackages as pkg, i} -
    ๐Ÿ“ฆ {pkg.name}
    +
  • ๐Ÿ“ฆ {pkg.name} ยท
  • {/each} {#if patch.compatiblePackages.length && patch.compatiblePackages[0].versions.length} -
    - ๐ŸŽฏ {patch.compatiblePackages[0].versions.slice(-1)} -
    +
  • + ๐ŸŽฏ {patch.compatiblePackages[0].versions.slice(-1)} ยท +
  • {/if} {#if !patch.compatiblePackages.length} -
    - ๐ŸŒŽ Universal patch -
    +
  • ๐ŸŒŽ Universal patch
  • {/if} - -
    ๐Ÿงฉ {patch.version}
    +
  • ๐Ÿงฉ {patch.version}
  • {#if hasPatchOptions} -
    โš™๏ธ Patch options
    +
  • ยท โš™๏ธ Patch options
  • {/if} -
+ {#if expanded && hasPatchOptions} @@ -75,36 +71,39 @@ diff --git a/static/icons/check.svg b/static/icons/check.svg new file mode 100644 index 0000000..53e38a6 --- /dev/null +++ b/static/icons/check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/search.svg b/static/icons/search.svg index d7b767d..2e252b8 100644 --- a/static/icons/search.svg +++ b/static/icons/search.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file