From f7693d909f338107f17dd826b3f3341ecd45b155 Mon Sep 17 00:00:00 2001 From: Jared Schoeny Date: Tue, 21 Oct 2025 22:57:58 -1000 Subject: [PATCH] Add "Recently Updated" sort option to discover --- src/components/Discover/DiscoverBrowser.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Discover/DiscoverBrowser.tsx b/src/components/Discover/DiscoverBrowser.tsx index cc81918..4e8b083 100644 --- a/src/components/Discover/DiscoverBrowser.tsx +++ b/src/components/Discover/DiscoverBrowser.tsx @@ -42,10 +42,19 @@ export default function DiscoverBrowser() { React.useEffect(() => { const run = async () => { + let orderBy: string | undefined = undefined; + if (sort === "popular") { + orderBy = "downloads"; + } else if (sort === "updated") { + orderBy = "updated_at"; + } else { + orderBy = "created_at"; + } + const { data: rows } = await supabase .from("hacks") - .select("slug,title,summary,description,base_rom,version,downloads,created_by,patch_url") - .order(sort === "popular" ? "downloads" : "created_at", { ascending: false }); + .select("slug,title,summary,description,base_rom,version,downloads,created_by,patch_url,updated_at") + .order(orderBy, { ascending: false }); const slugs = (rows || []).map((r) => r.slug); const { data: coverRows } = await supabase .from("hack_covers") @@ -192,6 +201,7 @@ export default function DiscoverBrowser() { > +