Added more UI styling. Updated voice work search provider to send back English tag names, if applicable.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@page "/voiceworks"
|
||||
@using JSMR.Application.Common.Search
|
||||
@using JSMR.Application.VoiceWorks.Queries.Search
|
||||
@using JSMR.UI.Blazor.Components
|
||||
@using JSMR.UI.Blazor.Services
|
||||
@@ -6,21 +7,61 @@
|
||||
|
||||
<PageTitle>Voice Works</PageTitle>
|
||||
|
||||
<h3>VoiceWorks</h3>
|
||||
<h3>Voice Works</h3>
|
||||
|
||||
<JProductCollection Products="items"></JProductCollection>
|
||||
<JProductCollection Products="searchResults?.Items"></JProductCollection>
|
||||
|
||||
@if (searchResults is not null)
|
||||
{
|
||||
<JPagination PageNumber="PageNumber" PageNumberChanged="OnPageNumberChanged" PageSize="PageSize" PageSizeChanged="OnPageSizeChanged" @bind-TotalItems="searchResults.TotalItems" />
|
||||
}
|
||||
|
||||
@code {
|
||||
VoiceWorkSearchResult[]? items;
|
||||
public int PageNumber { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 100;
|
||||
|
||||
SearchResult<VoiceWorkSearchResult>? searchResults;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await UpdateDataAsync(true);
|
||||
}
|
||||
|
||||
private async Task UpdateDataAsync(bool resetPageNumber)
|
||||
{
|
||||
if (resetPageNumber)
|
||||
PageNumber = 1;
|
||||
|
||||
SearchVoiceWorksRequest request = new(
|
||||
Options: new()
|
||||
{
|
||||
Criteria = new()
|
||||
{
|
||||
SupportedLanguages = [Domain.Enums.Language.English]
|
||||
},
|
||||
SortOptions =
|
||||
[
|
||||
new(VoiceWorkSortField.ReleaseDate, Application.Common.Search.SortDirection.Descending)
|
||||
],
|
||||
PageNumber = PageNumber,
|
||||
PageSize = PageSize
|
||||
}
|
||||
);
|
||||
|
||||
var result = await Client.SearchAsync(request);
|
||||
SearchVoiceWorksResponse? response = await Client.SearchAsync(request);
|
||||
|
||||
items = result?.Results.Items ?? [];
|
||||
searchResults = response?.Results;
|
||||
}
|
||||
|
||||
public async Task OnPageNumberChanged(int newPageNumber)
|
||||
{
|
||||
PageNumber = newPageNumber;
|
||||
await UpdateDataAsync(false);
|
||||
}
|
||||
|
||||
public async Task OnPageSizeChanged(int newPageSize)
|
||||
{
|
||||
PageSize = newPageSize;
|
||||
await UpdateDataAsync(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user