From aac71915e5cf3337c936a5e37b554fafb7bc1ac2 Mon Sep 17 00:00:00 2001 From: afn <47723802+afnzmn@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:54:19 -0400 Subject: [PATCH] feat: cooler info chips, minor refactoring --- src/data/ContributorsStore.ts | 8 ++-- src/data/PatchesStore.ts | 2 +- src/{lib => data}/types.ts | 0 src/lib/components/atoms/PatchCell.svelte | 38 ++++++++-------- .../components/atoms/TreeMenuButton.svelte | 20 ++++----- .../molecules/ContributorHost.svelte | 2 +- src/lib/components/molecules/Footer.svelte | 44 +++++++++---------- src/routes/patches/+page.svelte | 44 ++++++++----------- 8 files changed, 74 insertions(+), 84 deletions(-) rename src/{lib => data}/types.ts (100%) diff --git a/src/data/ContributorsStore.ts b/src/data/ContributorsStore.ts index cf1c083..0b25902 100644 --- a/src/data/ContributorsStore.ts +++ b/src/data/ContributorsStore.ts @@ -1,14 +1,12 @@ import { readable } from 'svelte/store'; -import type { Repository } from '$lib/types'; +import type { Repository } from 'src/data/types'; export type ContribData = { repositories: Repository[] }; const fetchContributors = async (): Promise => { const response = await fetch('https://releases.rvcd.win/contributors'); - const data = await response.json(); - return data; + const data = await response.json(); + return data; }; export const ContributorsStore = readable(fetchContributors()); - - diff --git a/src/data/PatchesStore.ts b/src/data/PatchesStore.ts index 0d83c99..d4e4bb7 100644 --- a/src/data/PatchesStore.ts +++ b/src/data/PatchesStore.ts @@ -1,5 +1,5 @@ import { readable } from 'svelte/store'; -import type { Patch } from '$lib/types'; +import type { Patch } from 'src/data/types'; export type PatchesData = { patches: Patch[]; packages: string[] }; diff --git a/src/lib/types.ts b/src/data/types.ts similarity index 100% rename from src/lib/types.ts rename to src/data/types.ts diff --git a/src/lib/components/atoms/PatchCell.svelte b/src/lib/components/atoms/PatchCell.svelte index a44302e..3805b45 100644 --- a/src/lib/components/atoms/PatchCell.svelte +++ b/src/lib/components/atoms/PatchCell.svelte @@ -1,29 +1,25 @@
(expanded = !expanded)} >

- {name + {patch.name // im sorry .replace(/-/g, ' ') .replace(/(?:^|\s)\S/g, (x) => x.toUpperCase()) @@ -40,25 +36,30 @@

- {#each compatiblePackages as pkg, i} + {#each patch.compatiblePackages as pkg, i} {#if current === false} -

{pkg.name}

+

📦 {pkg.name}

{/if} - + {#if i < pkg.versions.length - 1}

- Target Package Version: {pkg.versions.slice(-1)[0] || 'Any'} + 🎯 {pkg.versions.slice(-1)[0] || 'Any'}

{/if} {/each} -

Patch Version: {version}

+ +

🧩 {patch.version}

+ + {#if hasPatchOptions} +

⚙️ Patch Options

+ {/if}
-

{description}

+

{patch.description}

{#if expanded && hasPatchOptions}
- {#each options as option} + {#each patch.options as option}

{option.title}

{option.description}

@@ -117,7 +118,6 @@ border-radius: 12px; } - .patch-container:active { background-color: var(--grey-three); } diff --git a/src/lib/components/atoms/TreeMenuButton.svelte b/src/lib/components/atoms/TreeMenuButton.svelte index da8b42f..2e7b43f 100644 --- a/src/lib/components/atoms/TreeMenuButton.svelte +++ b/src/lib/components/atoms/TreeMenuButton.svelte @@ -1,18 +1,18 @@
(current = (current === name) ? false : name) && window.scrollTo({ top: 0, behavior: 'smooth' })} + class:selected={current === name} + on:click={() => + (current = current === name ? false : name) && window.scrollTo({ top: 0, behavior: 'smooth' })} > -

{name}

+

{name}

- \ No newline at end of file + diff --git a/src/lib/components/molecules/ContributorHost.svelte b/src/lib/components/molecules/ContributorHost.svelte index 53f9bef..51b7504 100644 --- a/src/lib/components/molecules/ContributorHost.svelte +++ b/src/lib/components/molecules/ContributorHost.svelte @@ -1,5 +1,5 @@ @@ -51,20 +51,12 @@
{#if patches} - {#each patches as { name, description, version, options, compatiblePackages }, i} - {#if search(current, compatiblePackages) || !current} -
- -
- {/if} + {#each patches as patch, i} + {#if search(current, patch.compatiblePackages) || !current} +
+ +
+ {/if} {/each} {/if}
@@ -89,7 +81,7 @@ width: 100%; position: sticky; z-index: 1; - min-height: calc(100vh - 7.5rem); + min-height: calc(100vh - 7.5rem); } /*