From e9fc4121f41d82d7562c1483cf203d514c72b59e Mon Sep 17 00:00:00 2001 From: Evan / Fero Date: Mon, 14 Aug 2023 00:09:43 -0700 Subject: [PATCH] feat(web): functional instant mod search on discovery --- apps/web/src/lib/components/ModListItem.svelte | 2 +- apps/web/src/lib/components/ModVersionItem.svelte | 2 +- apps/web/src/routes/discover/+page.svelte | 15 ++++++++------- apps/web/src/routes/mod/[mod]/+page.svelte | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/web/src/lib/components/ModListItem.svelte b/apps/web/src/lib/components/ModListItem.svelte index 0e4bce9..b854526 100644 --- a/apps/web/src/lib/components/ModListItem.svelte +++ b/apps/web/src/lib/components/ModListItem.svelte @@ -23,7 +23,7 @@
+ class="beatforge-discover-list-item flex flex-row gap-2 md:gap-4 w-full bg-primary-850 hover:bg-primary-900 border-b-[1px] border-primary-850 items-center p-2 md:p-4 min-w-0 transition hover:duration-[0ms] duration-[120ms] my-2 md:my-0">
diff --git a/apps/web/src/lib/components/ModVersionItem.svelte b/apps/web/src/lib/components/ModVersionItem.svelte index 7ce6023..3c6abbf 100644 --- a/apps/web/src/lib/components/ModVersionItem.svelte +++ b/apps/web/src/lib/components/ModVersionItem.svelte @@ -40,7 +40,7 @@
{#if isHovered}
diff --git a/apps/web/src/routes/discover/+page.svelte b/apps/web/src/routes/discover/+page.svelte index b1d15c8..b2bf1d4 100644 --- a/apps/web/src/routes/discover/+page.svelte +++ b/apps/web/src/routes/discover/+page.svelte @@ -8,10 +8,10 @@ import { onMount } from 'svelte'; enum Sort { - Newest, - Oldest, - MostPopular, - LeastPopular + Newest = "created_at:desc", + Oldest = "created_at:asc", + MostPopular = "stats.downloads:desc", + LeastPopular = "stats.downloads:asc" } let listHeight; @@ -30,11 +30,12 @@ }, body: JSON.stringify({ q: q, - sort: sort + sort: [sort.toString()] }) }) ).json(); data = res.hits; + data = data; }; const searchOnInput = async (e: any) => { @@ -86,9 +87,9 @@ slug={mod.slug} author={mod.author.username} description={mod.description} - category={mod.category.name} + category={mod.category} downloads={mod.stats.downloads} - updatedAt={mod.updatedAt} + updatedAt={mod.updated_at} icon={mod.icon} /> {/each} diff --git a/apps/web/src/routes/mod/[mod]/+page.svelte b/apps/web/src/routes/mod/[mod]/+page.svelte index b390e0f..92a580b 100644 --- a/apps/web/src/routes/mod/[mod]/+page.svelte +++ b/apps/web/src/routes/mod/[mod]/+page.svelte @@ -31,7 +31,7 @@
icon @@ -84,7 +84,7 @@ Copied!
- + {:else}