|
|
|
|
@ -1,4 +1,6 @@
@@ -1,4 +1,6 @@
|
|
|
|
|
@using System.Reflection |
|
|
|
|
@using Microsoft.AspNetCore.WebUtilities |
|
|
|
|
@using Microsoft.Extensions.Primitives |
|
|
|
|
@using System.Web |
|
|
|
|
@inherits LayoutComponentBase |
|
|
|
|
@inject NavigationManager NavigationManager |
|
|
|
|
@ -15,7 +17,7 @@
@@ -15,7 +17,7 @@
|
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
<MudTextField T="string" |
|
|
|
|
@ref="_textField" |
|
|
|
|
@bind-Value="@_query" |
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search" |
|
|
|
|
Adornment="Adornment.Start" |
|
|
|
|
Variant="Variant.Outlined" |
|
|
|
|
@ -65,7 +67,7 @@
@@ -65,7 +67,7 @@
|
|
|
|
|
@code { |
|
|
|
|
private static readonly string InfoVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "unknown"; |
|
|
|
|
|
|
|
|
|
private MudTextField<string> _textField; |
|
|
|
|
private string _query; |
|
|
|
|
|
|
|
|
|
private MudTheme _ersatzTvTheme => new() |
|
|
|
|
{ |
|
|
|
|
@ -89,12 +91,26 @@
@@ -89,12 +91,26 @@
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
protected override async Task OnParametersSetAsync() |
|
|
|
|
{ |
|
|
|
|
await base.OnParametersSetAsync(); |
|
|
|
|
|
|
|
|
|
string query = new Uri(NavigationManager.Uri).Query; |
|
|
|
|
if (QueryHelpers.ParseQuery(query).TryGetValue("query", out StringValues value)) |
|
|
|
|
{ |
|
|
|
|
_query = value; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
_query = string.Empty; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void OnSearchKeyDown(KeyboardEventArgs args) |
|
|
|
|
{ |
|
|
|
|
if (args.Code == "Enter") |
|
|
|
|
{ |
|
|
|
|
string query = HttpUtility.UrlEncode(_textField.Value); |
|
|
|
|
_textField.Reset(); |
|
|
|
|
string query = HttpUtility.UrlEncode(_query); |
|
|
|
|
NavigationManager.NavigateTo($"/search?query={query}", true); |
|
|
|
|
StateHasChanged(); |
|
|
|
|
} |
|
|
|
|
|