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({ ))} +