Skip to content

Commit

Permalink
feat: show all versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushie committed Jul 30, 2023
1 parent d403a26 commit 64e1906
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/routes/patches/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
let timeout: ReturnType<typeof setTimeout>;
let mobilePackages = false;
let showAllVersions = false;
function checkCompatibility(patch: Patch, pkg: string) {
if (pkg === '') {
Expand Down Expand Up @@ -169,7 +170,7 @@
<!-- Trigger new animations when package or search changes (I love Svelte) -->
{#key selectedPkg || searchTermFiltered}
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
<PatchItem {patch} />
<PatchItem {patch} bind:showAllVersions />
</div>
{/key}
{/each}
Expand Down
26 changes: 23 additions & 3 deletions src/routes/patches/PatchItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { slide, fade } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
import type { Patch } from '$lib/types';
import { friendlyName } from '$util/friendlyName';
export let patch: Patch;
export let showAllVersions: boolean;
const hasPatchOptions = !!patch.options.length;
let expanded: boolean = false;
</script>
Expand Down Expand Up @@ -38,8 +38,28 @@

<!-- should i hardcode this to get the version of the first package? idk you cant stop me -->
{#if patch.compatiblePackages.length && patch.compatiblePackages[0].versions.length}
<li class="patch-info">
🎯 {patch.compatiblePackages[0].versions.slice(-1)}
{#if showAllVersions}
{#each patch.compatiblePackages[0].versions as version}
<li class="patch-info">
🎯 {version}
</li>
{/each}
<li class="patch-info">
🎯 {patch.compatiblePackages[0].versions.slice(-1)}
</li>
{:else}
<li class="patch-info">
🎯 {patch.compatiblePackages[0].versions.slice(-1)}
</li>
{/if}
<li class="patch-info button">
<img
on:click={() => (showAllVersions = !showAllVersions)}
id="arrow"
style:transform={showAllVersions ? 'rotate(90deg)' : 'rotate(-90deg)'}
src="/icons/expand_more.svg"
alt="dropdown"
/>
</li>
{/if}

Expand Down

0 comments on commit 64e1906

Please sign in to comment.