66using Microsoft . Extensions . Localization ;
77using Microsoft . FluentUI . AspNetCore . Components ;
88using Microsoft . FluentUI . AspNetCore . Components . Extensions ;
9+ using System . Collections . Frozen ;
910
1011namespace CodeBreaker . Blazor . Client . Pages ;
1112
@@ -14,6 +15,15 @@ public partial class ReportsPage
1415 private GameInfo [ ] ? _games ;
1516 private bool _isLoadingGames = false ;
1617 private DateTime ? _selectedDate = DateTime . Now ;
18+ private string ? _selectedGameTypeKey = null ;
19+ private readonly FrozenDictionary < string , GameType > _gameTypes = new Dictionary < string , GameType > ( ) {
20+ { "6x4" , GameType . Game6x4 } ,
21+ { "6x4 Mini" , GameType . Game6x4Mini } ,
22+ { "8x5" , GameType . Game8x5 } ,
23+ { "5x5x4" , GameType . Game5x5x4 } ,
24+ } . ToFrozenDictionary ( ) ;
25+
26+ private GameType ? SelectedGameType => _selectedGameTypeKey is null ? null : _gameTypes [ _selectedGameTypeKey ] ;
1727
1828 [ Inject ] private IDialogService DialogService { get ; set ; } = default ! ;
1929
@@ -33,7 +43,7 @@ public async Task GetGamesAsync()
3343 _isLoadingGames = true ;
3444 try
3545 {
36- var query = new GamesQuery ( Date : date , Ended : true ) ;
46+ var query = new GamesQuery ( Date : date , Ended : true , GameType : SelectedGameType ) ;
3747 var response = await GameClient . GetGamesAsync ( query ) ;
3848 Logger ? . LogDebug ( "Got response: {response}" , response ) ;
3949 _games = [ ..response ?? [ ] ] ;
0 commit comments