diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-30 13:13:19 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2025-08-20 00:48:44 +1000 |
| commit | 5b93706343484914370a87fddea29874c8156321 (patch) | |
| tree | 396d53777e433fc23b6c8c3ec68ce095055e3389 /Pages | |
| parent | a3b729866a5f5ccaf5a7d0fab5663a633475ca49 (diff) | |
Added temporary fix to focus query input for TagSelectionDialog
Diffstat (limited to 'Pages')
| -rw-r--r-- | Pages/Component/AboutDialog.razor | 14 | ||||
| -rw-r--r-- | Pages/Component/TagSelectDialog.razor | 16 | ||||
| -rw-r--r-- | Pages/Component/TagSelectDialog.razor.css | 1 |
3 files changed, 22 insertions, 9 deletions
diff --git a/Pages/Component/AboutDialog.razor b/Pages/Component/AboutDialog.razor index a533fbc..9823761 100644 --- a/Pages/Component/AboutDialog.razor +++ b/Pages/Component/AboutDialog.razor @@ -1,4 +1,6 @@ @using System.Reflection +@using Microsoft.AspNetCore.Hosting +@inject IHostingEnvironment hostingEnvironment <Dialog @ref=dialog> <p id="title">@Title</p> @@ -686,11 +688,21 @@ public void Hide() => Visible = false; public string Title => - $"HyperBooru v{Version}"; + $"HyperBooru v{Version} {Development}"; public string? Version => GetType() .Assembly .GetCustomAttribute<AssemblyInformationalVersionAttribute>()? .InformationalVersion; + + public string? Development { + get { + #if DEBUG + return "(Development)"; + #else + return hostingEnvironment.IsDevelopment() ? "(Development)" : null; + #endif + } + } } diff --git a/Pages/Component/TagSelectDialog.razor b/Pages/Component/TagSelectDialog.razor index f1c294c..916a070 100644 --- a/Pages/Component/TagSelectDialog.razor +++ b/Pages/Component/TagSelectDialog.razor @@ -6,7 +6,7 @@ <link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> <Dialog Title=@(Title ?? "Select one or more tag(s)") @ref=dialog> - <input type="text" placeholder="Search" @ref=queryInput @oninput=QueryInput @onkeypress=QueryKey value=@query autofocus/> + <input type="text" placeholder="Search" @ref=queryInput @oninput=QueryInput @onkeypress=QueryKey value=@query/> <div class="tag-definitions"> @for(int i = 0; i < tagDefinitions.Count(); i++) { if(!MatchesQuery(tagDefinitions[i].tagDefinition)) @@ -36,14 +36,14 @@ </Dialog> @code { - [Parameter] - public string? Title { get; set; } + [Parameter] + public string? Title { get; set; } - [Parameter] - public EventCallback<TagDefinition[]> OnSubmit { get; set; } + [Parameter] + public EventCallback<TagDefinition[]> OnSubmit { get; set; } public TagDefinition[] SelectedTags { get; set; } = - Array.Empty<TagDefinition>(); + Array.Empty<TagDefinition>(); public bool Visible { get => visible; @@ -74,9 +74,9 @@ LoadTags(); } - protected override void OnAfterRender(bool firstRender) { + protected override async Task OnAfterRenderAsync(bool firstRender) { if(Visible) - queryInput.FocusAsync(); + await Task.Delay(100).ContinueWith(t => queryInput.FocusAsync()); } private void LoadTags() { diff --git a/Pages/Component/TagSelectDialog.razor.css b/Pages/Component/TagSelectDialog.razor.css index 5394dfe..7b50077 100644 --- a/Pages/Component/TagSelectDialog.razor.css +++ b/Pages/Component/TagSelectDialog.razor.css @@ -1,4 +1,5 @@ div.tag-definitions { + max-height: 450px; overflow-y: auto; user-select: none; } |
