Show loading indicator on metadata lookup and disable select button
This commit is contained in:
parent
b50b7e4d61
commit
e5ba574468
1 changed files with 9 additions and 3 deletions
|
@ -10,8 +10,8 @@
|
||||||
@{
|
@{
|
||||||
RenderFragment Footer =
|
RenderFragment Footer =
|
||||||
@<Template>
|
@<Template>
|
||||||
<Button OnClick="SelectGame" Disabled="@(Results == null || Results.Count() == 0)" Type="@ButtonType.Primary">Select</Button>
|
<Button OnClick="SelectGame" Disabled="@(Loading || Results.Count() == 0)" Type="@ButtonType.Primary">Select</Button>
|
||||||
<Button OnClick="() => ModalVisible= false">Cancel</Button>
|
<Button OnClick="() => ModalVisible = false">Cancel</Button>
|
||||||
</Template>;
|
</Template>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
TItem="Game"
|
TItem="Game"
|
||||||
DataSource="Results"
|
DataSource="Results"
|
||||||
HidePagination="true"
|
HidePagination="true"
|
||||||
Loading="Results == null"
|
Loading="Loading"
|
||||||
OnRowClick="OnRowClicked"
|
OnRowClick="OnRowClicked"
|
||||||
@bind-SelectedRows="SelectedResults"
|
@bind-SelectedRows="SelectedResults"
|
||||||
ScrollY="calc(100vh - 55px - 55px - 53px)">
|
ScrollY="calc(100vh - 55px - 55px - 53px)">
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
IEnumerable<Game> SelectedResults { get; set; }
|
IEnumerable<Game> SelectedResults { get; set; }
|
||||||
PCGamingWikiClient PCGamingWikiClient { get; set; }
|
PCGamingWikiClient PCGamingWikiClient { get; set; }
|
||||||
bool ModalVisible { get; set; } = false;
|
bool ModalVisible { get; set; } = false;
|
||||||
|
bool Loading = true;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -57,11 +58,14 @@
|
||||||
|
|
||||||
public async Task SearchForGame(string title)
|
public async Task SearchForGame(string title)
|
||||||
{
|
{
|
||||||
|
Loading = true;
|
||||||
ModalVisible = true;
|
ModalVisible = true;
|
||||||
Results = null;
|
Results = null;
|
||||||
|
|
||||||
var results = await IGDBService.Search(title, "involved_companies.*", "involved_companies.company.*");
|
var results = await IGDBService.Search(title, "involved_companies.*", "involved_companies.company.*");
|
||||||
|
|
||||||
|
Loading = false;
|
||||||
|
|
||||||
if (results == null)
|
if (results == null)
|
||||||
Results = new List<Game>();
|
Results = new List<Game>();
|
||||||
else
|
else
|
||||||
|
@ -91,6 +95,8 @@
|
||||||
|
|
||||||
private async Task SelectGame()
|
private async Task SelectGame()
|
||||||
{
|
{
|
||||||
|
Loading = true;
|
||||||
|
|
||||||
var result = new GameLookupResult();
|
var result = new GameLookupResult();
|
||||||
|
|
||||||
result.IGDBMetadata = await IGDBService.Get(SelectedResults.First().IGDBId.GetValueOrDefault(), "genres.*", "game_modes.*", "multiplayer_modes.*", "release_dates.*", "platforms.*", "keywords.*", "involved_companies.*", "involved_companies.company.*", "cover.*");
|
result.IGDBMetadata = await IGDBService.Get(SelectedResults.First().IGDBId.GetValueOrDefault(), "genres.*", "game_modes.*", "multiplayer_modes.*", "release_dates.*", "platforms.*", "keywords.*", "involved_companies.*", "involved_companies.company.*", "cover.*");
|
||||||
|
|
Loading…
Add table
Reference in a new issue