Added keyword search to voice work search UI.

This commit is contained in:
2025-11-16 02:12:55 -05:00
parent 75900a90ef
commit 9ef1972472

View File

@@ -4,11 +4,18 @@
@using JSMR.UI.Blazor.Components
@using JSMR.UI.Blazor.Services
@inject VoiceWorksClient Client
@inject IJSRuntime JS
<PageTitle>Voice Works</PageTitle>
<h3>Voice Works</h3>
<div class="search-filter-control-container">
<div class="search-filter-control-span-4">
<MudTextField T="string" Value="Keywords" ValueChanged="OnKeywordsChanged" Immediate="true" DebounceInterval="500" Label="Filter" Variant="Variant.Text" Adornment="@Adornment.Start" AdornmentIcon="@Icons.Material.Outlined.Search" />
</div>
</div>
<JProductCollection Products="searchResults?.Items"></JProductCollection>
@if (searchResults is not null)
@@ -17,6 +24,7 @@
}
@code {
public string? Keywords { get; set; }
public int PageNumber { get; set; } = 1;
public int PageSize { get; set; } = 100;
@@ -29,6 +37,8 @@
private async Task UpdateDataAsync(bool resetPageNumber)
{
await JS.InvokeVoidAsync("pageHelpers.scrollToTop");
if (resetPageNumber)
PageNumber = 1;
@@ -37,6 +47,7 @@
{
Criteria = new()
{
Keywords = Keywords,
SupportedLanguages = [Domain.Enums.Language.English]
},
SortOptions =
@@ -53,6 +64,12 @@
searchResults = response?.Results;
}
public async Task OnKeywordsChanged(string? newKeywords)
{
Keywords = newKeywords;
await UpdateDataAsync(true);
}
public async Task OnPageNumberChanged(int newPageNumber)
{
PageNumber = newPageNumber;