From 5b93706343484914370a87fddea29874c8156321 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 30 Aug 2023 13:13:19 +1000 Subject: Added temporary fix to focus query input for TagSelectionDialog --- Pages/Component/AboutDialog.razor | 14 +++++++++++++- Pages/Component/TagSelectDialog.razor | 16 ++++++++-------- Pages/Component/TagSelectDialog.razor.css | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) (limited to 'Pages/Component') 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

@Title

@@ -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()? .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 @@ - +
@for(int i = 0; i < tagDefinitions.Count(); i++) { if(!MatchesQuery(tagDefinitions[i].tagDefinition)) @@ -36,14 +36,14 @@
@code { - [Parameter] - public string? Title { get; set; } + [Parameter] + public string? Title { get; set; } - [Parameter] - public EventCallback OnSubmit { get; set; } + [Parameter] + public EventCallback OnSubmit { get; set; } public TagDefinition[] SelectedTags { get; set; } = - Array.Empty(); + Array.Empty(); 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; } -- cgit v1.3