From 7903c9fbbd9026cb290a0aaa10ada4188ef9fc89 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Wed, 29 Apr 2026 01:45:04 +0800 Subject: [PATCH] Tasks 12-13: Fix release date input to type=date, add sort direction toggle to games page --- app/games/games-page-client.tsx | 12 +++++++++++- components/wizard/non-steam-edit-form.tsx | 2 +- .../wizard/steps/non-steam-basic-info-step.tsx | 3 +-- lib/api/games-listing.ts | 11 ++++++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/games/games-page-client.tsx b/app/games/games-page-client.tsx index 14a4c0f..3465de5 100644 --- a/app/games/games-page-client.tsx +++ b/app/games/games-page-client.tsx @@ -31,6 +31,7 @@ interface DeviceOption { } type SortOption = "recent" | "name" | "benchmarks" +type SortDirection = "asc" | "desc" const DECK_STATUS_CONFIG: Record = { native: { label: "Native", className: "bg-green-500/10 border-green-500/20 text-green-400" }, @@ -62,6 +63,7 @@ export function GamesPageClient({ const [selectedGenres, setSelectedGenres] = useState([]) const [selectedDevice, setSelectedDevice] = useState("") const [sort, setSort] = useState("recent") + const [sortDirection, setSortDirection] = useState("desc") const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [showFilters, setShowFilters] = useState(false) @@ -76,12 +78,13 @@ export function GamesPageClient({ params.set("offset", String(offset)) params.set("limit", "24") params.set("sort", sort) + params.set("order", sortDirection) if (search) params.set("search", search) if (selectedDevice) params.set("device", selectedDevice) if (selectedGenres.length === 1) params.set("genre", selectedGenres[0]) return `/api/games/listing?${params.toString()}` }, - [sort, search, selectedDevice, selectedGenres], + [sort, sortDirection, search, selectedDevice, selectedGenres], ) // Load more function for infinite scroll @@ -217,6 +220,13 @@ export function GamesPageClient({ ))} +