fix(ui): count all-games filter from network games
The launcher redesign showed the All Games pill count from the full bundled catalog. That made the counter report every row in game.db even though the All Games filter itself only shows games that are visible on the current network or present locally. Use the same network-visible predicate for the counter and the filter. The pill count and results total now describe the displayed network library instead of the baked catalog size. Test Plan: - git diff --check Refs: user redesign nitpick about All Games counter
This commit is contained in:
@@ -157,8 +157,11 @@ export interface FilterCounts {
|
||||
installed: number;
|
||||
}
|
||||
|
||||
const isNetworkGame = (game: Game): boolean =>
|
||||
game.installed || game.downloaded || game.peer_count > 0;
|
||||
|
||||
export const countByFilter = (games: Game[]): FilterCounts => ({
|
||||
all: games.length,
|
||||
all: games.filter(isNetworkGame).length,
|
||||
local: games.filter(g => g.installed || g.downloaded).length,
|
||||
installed: games.filter(g => g.installed).length,
|
||||
});
|
||||
@@ -170,7 +173,7 @@ const matchesFilter = (game: Game, filter: GameFilter): boolean => {
|
||||
case 'installed':
|
||||
return game.installed;
|
||||
case 'all':
|
||||
return game.installed || game.downloaded || game.peer_count > 0;
|
||||
return isNetworkGame(game);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user