Filter non-standalone addons from library compact list

This commit is contained in:
Pat Hartl 2026-06-18 01:24:15 -05:00
parent 1cb30dda24
commit 5e59e1ca17
2 changed files with 8 additions and 0 deletions

View file

@ -86,6 +86,9 @@ public partial class GameItemViewModel : ViewModelBase
[ObservableProperty]
private bool _isUpdateAvailable;
[ObservableProperty]
private GameType _type;
public GameItemViewModel() { }
public GameItemViewModel(SDK.Models.DepotGame game, string? coverPath = null, string? coverMimeType = null, bool inLibrary = false, bool showInLibraryBadge = true)
@ -95,6 +98,7 @@ public partial class GameItemViewModel : ViewModelBase
Description = game.Description ?? string.Empty;
SortTitle = game.SortTitle ?? game.Title ?? string.Empty;
ReleasedOn = game.ReleasedOn;
Type = game.Type;
Singleplayer = game.Singleplayer;
Genres = game.Genres != null ? string.Join(", ", game.Genres.Select(g => g.Name)) : string.Empty;
Collections = game.Collections != null ? string.Join(", ", game.Collections.Select(c => c.Name)) : string.Empty;
@ -119,6 +123,7 @@ public partial class GameItemViewModel : ViewModelBase
Description = game.Description ?? string.Empty;
SortTitle = game.SortTitle ?? game.Title ?? string.Empty;
ReleasedOn = game.ReleasedOn ?? DateTime.MinValue;
Type = game.Type;
Singleplayer = game.Singleplayer;
Genres = game.Genres != null ? string.Join(", ", game.Genres.Select(g => g.Name)) : string.Empty;
Collections = game.Collections != null ? string.Join(", ", game.Collections.Select(c => c.Name)) : string.Empty;

View file

@ -10,6 +10,7 @@ using LANCommander.Launcher.ViewModels.Components;
using LANCommander.Launcher.Settings.Enums;
using LANCommander.SDK.Models;
using LANCommander.SDK.Enums;
using LANCommander.SDK.Extensions;
namespace LANCommander.Launcher.ViewModels;
@ -233,6 +234,8 @@ public abstract partial class GamesCollectionViewModel : ViewModelBase
{
var filtered = _allGames.AsEnumerable();
filtered = filtered.Where(g => g.Type.ValueIsIn(GameType.MainGame, GameType.StandaloneExpansion, GameType.StandaloneMod));
if (!string.IsNullOrWhiteSpace(SearchText))
filtered = filtered.Where(g =>
g.Title.Contains(SearchText, StringComparison.OrdinalIgnoreCase) ||