@@ -16,14 +16,10 @@ public partial class ReportsPage
1616 private bool _isLoadingGames = false ;
1717 private DateTime ? _selectedDate = DateTime . Now ;
1818 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 ( ) ;
19+ private string ? _enteredPlayerName = null ;
20+ private IDictionary < string , GameType ? > _gameTypes = null ! ;
2521
26- private GameType ? SelectedGameType => _selectedGameTypeKey is null ? null : _gameTypes [ _selectedGameTypeKey ] ;
22+ private GameType ? SelectedGameType => string . IsNullOrEmpty ( _selectedGameTypeKey ) ? null : _gameTypes [ _selectedGameTypeKey ] ;
2723
2824 [ Inject ] private IDialogService DialogService { get ; set ; } = default ! ;
2925
@@ -35,6 +31,17 @@ public partial class ReportsPage
3531
3632 private string [ ] Headers => [ .. Loc . GetString ( "ReportsPage_Table_Headers" ) . Value . Split ( "," ) ] ;
3733
34+ protected override void OnInitialized ( )
35+ {
36+ _gameTypes = new Dictionary < string , GameType ? > ( ) {
37+ { Loc [ "ReportsPage_GameType_All" ] , null } ,
38+ { "6x4" , GameType . Game6x4 } ,
39+ { "6x4 Mini" , GameType . Game6x4Mini } ,
40+ { "8x5" , GameType . Game8x5 } ,
41+ { "5x5x4" , GameType . Game5x5x4 } ,
42+ } . ToFrozenDictionary ( ) ;
43+ }
44+
3845 public async Task GetGamesAsync ( )
3946 {
4047 var date = _selectedDate . ToDateOnly ( ) ;
@@ -43,7 +50,7 @@ public async Task GetGamesAsync()
4350 _isLoadingGames = true ;
4451 try
4552 {
46- var query = new GamesQuery ( Date : date , Ended : true , GameType : SelectedGameType ) ;
53+ var query = new GamesQuery ( Date : date , Ended : true , GameType : SelectedGameType , PlayerName : _enteredPlayerName ) ;
4754 var response = await GameClient . GetGamesAsync ( query ) ;
4855 Logger ? . LogDebug ( "Got response: {response}" , response ) ;
4956 _games = [ ..response ?? [ ] ] ;
0 commit comments