feat(ui): add smallest-first size sort

The redesign only offered a largest-first size sort. Keep the existing `size`
preference value as largest for compatibility with saved settings and add a new
ascending size key for users who want to find small downloads first.

The sort menu now exposes both size directions and the sorter handles the new
smallest-first option directly.

Test Plan:
- git diff --check

Refs: user redesign nitpick about Size (smallest) sort
This commit is contained in:
2026-05-19 20:47:01 +02:00
parent bcaf28dcee
commit 25f92c9b0b
3 changed files with 4 additions and 1 deletions
@@ -6,6 +6,7 @@ import { GameSort } from '../../lib/types';
const OPTIONS: ReadonlyArray<{ key: GameSort; label: string }> = [
{ key: 'az', label: 'Name (AZ)' },
{ key: 'size', label: 'Size (largest)' },
{ key: 'sizeAsc', label: 'Size (smallest)' },
{ key: 'status', label: 'Status' },
];
@@ -209,6 +209,8 @@ export const applyFilterAndSort = (
return [...list].sort((a, b) => a.name.localeCompare(b.name));
case 'size':
return [...list].sort((a, b) => b.size - a.size);
case 'sizeAsc':
return [...list].sort((a, b) => a.size - b.size);
case 'status':
return [...list].sort(compareByState);
}
@@ -60,7 +60,7 @@ export interface GamesListPayload {
export type GameFilter = 'all' | 'local' | 'installed';
/** Library sort order. */
export type GameSort = 'az' | 'size' | 'status';
export type GameSort = 'az' | 'size' | 'sizeAsc' | 'status';
/** Visual state of a card. Derived from install/download flags. */
export type DerivedState = 'installed' | 'local' | 'none' | 'busy';