From 25d9bf910c1738e214b13bb6282d9402e1c123ed Mon Sep 17 00:00:00 2001 From: Jared Schoeny Date: Fri, 2 Oct 2026 23:52:16 -0600 Subject: [PATCH] Home: sort the Ready shelf by total downloads (#102) It took the first 12 matching hacks in whatever order the catalog query returned them, which has no order by. Co-authored-by: Claude Opus 5.5 --- src/components/Home/HomeHero.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Home/HomeHero.tsx b/src/components/Home/HomeHero.tsx index d0263dc..08691dd 100644 --- a/src/components/Home/HomeHero.tsx +++ b/src/components/Home/HomeHero.tsx @@ -84,7 +84,11 @@ export function HomeHero({ catalog }: HeroProps) { export function ReadyShelf({ catalog }: { catalog: HackCardAttributes[] }) { const readyIds = useReadyBaseRomIds(); if (readyIds.size === 0) return null; - const ready = catalog.filter((h) => h.baseRomId && readyIds.has(h.baseRomId)).slice(0, 12); + // Most downloaded first; the catalog itself comes back in no particular order. + const ready = catalog + .filter((h) => h.baseRomId && readyIds.has(h.baseRomId)) + .sort((a, b) => b.downloads - a.downloads) + .slice(0, 12); const names = [...readyIds].map((id) => baseRoms.find((r) => r.id === id)?.name).filter((n): n is string => Boolean(n)); const title = names.length === 1 ? `Ready for your ${baseGameLabel(names[0])}` : "Ready to patch"; return ;