From 68ec83f68197ac7fb32e0112652989ae33284bbe Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Fri, 3 Mar 2023 17:34:50 -0600 Subject: [PATCH] Put games table in a card, use loading indicator --- LANCommander/Pages/Games/Index.razor | 64 ++++++++++++++++------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/LANCommander/Pages/Games/Index.razor b/LANCommander/Pages/Games/Index.razor index d24b175..1aa328f 100644 --- a/LANCommander/Pages/Games/Index.razor +++ b/LANCommander/Pages/Games/Index.razor @@ -3,39 +3,49 @@ @inject GameService GameService @inject NavigationManager NavigationManager - - - - - - - - - - @context.CreatedBy?.UserName - - - - @context.UpdatedBy?.UserName - - - - - - - - -
+ + + + + + + + + + + + @context.CreatedBy?.UserName + + + + @context.UpdatedBy?.UserName + + + + +
+ +
@code { IEnumerable Games { get; set; } = new List(); - private string Search { get; set; } - protected override async Task OnInitializedAsync() + bool Loading = true; + + protected override void OnAfterRender(bool firstRender) { - Games = GameService.Get().OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList(); + if (firstRender) + { + Games = GameService.Get().OrderBy(g => String.IsNullOrWhiteSpace(g.SortTitle) ? g.Title : g.SortTitle).ToList(); - StateHasChanged(); + Loading = false; + + StateHasChanged(); + } } private string GetIcon(Game game)