From 9f4033649a53222b0543343fc02b0c74a72235b4 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 29 Mar 2026 05:57:43 +1100 Subject: v0.4a --- Pages/Component/AboutDialog.razor | 29 ++++++++++++++++++++++++++++- Pages/Component/AboutDialog.razor.css | 11 +++++++++++ Pages/Component/ProgressBar.razor | 17 +++++++++++++++++ Pages/Component/ProgressBar.razor.css | 17 +++++++++++++++++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Pages/Component/ProgressBar.razor create mode 100644 Pages/Component/ProgressBar.razor.css (limited to 'Pages/Component') diff --git a/Pages/Component/AboutDialog.razor b/Pages/Component/AboutDialog.razor index 9ffbad4..1229dc7 100644 --- a/Pages/Component/AboutDialog.razor +++ b/Pages/Component/AboutDialog.razor @@ -1,5 +1,6 @@ @using System.Reflection @using Microsoft.AspNetCore.Hosting +@inject IDbContextFactory dbFactory @inject IHostingEnvironment hostingEnvironment @implements IDialog @@ -672,6 +673,15 @@ <https://www.gnu.org/licenses/>. Source +
+ @if(progress.HasValue) { + var untagged = progress.Value.Untagged.ToString("N0"); + var total = progress.Value.Total.ToString("N0"); + var percent = (progress.Value.Untagged * 100f / progress.Value.Total).ToString("f1"); +

Untagged: @($"{untagged}/{total} ({percent}%)")

+ } + +
@@ -680,9 +690,26 @@ @code { private Dialog dialog; + private ProgressBar progressBar; + + private (long Untagged, long Total)? progress; + public bool Visible { get => dialog.Visible; - set => dialog.Visible = value; + set { + dialog.Visible = value; + if(value) { + using var db = dbFactory.CreateDbContext(); + progress = ( + Untagged: db.Media + .Where(m => m.Tags.Any(t => t.TagDefinition.ObjectId == (int) HBObjectId.IngestTag)) + .Count(), + Total: db.Media.Count() + ); + progressBar.Progress = (float) progress.Value!.Untagged / (float) progress.Value!.Total; + InvokeAsync(() => StateHasChanged()); + } + } } public void Show() => Visible = true; diff --git a/Pages/Component/AboutDialog.razor.css b/Pages/Component/AboutDialog.razor.css index 0a523a4..cbc4b59 100644 --- a/Pages/Component/AboutDialog.razor.css +++ b/Pages/Component/AboutDialog.razor.css @@ -6,6 +6,12 @@ p#author { font-size: 8pt; } +p#progress { + flex: 1 0 auto; + font-size: 8pt; + margin-right: 10px; +} + div#license { background: #222; border-radius: 10px; @@ -16,3 +22,8 @@ div#license { overflow-y: auto; padding: 20px; } + +div#progressContainer { + align-items: center; + display: flex; +} diff --git a/Pages/Component/ProgressBar.razor b/Pages/Component/ProgressBar.razor new file mode 100644 index 0000000..aa22194 --- /dev/null +++ b/Pages/Component/ProgressBar.razor @@ -0,0 +1,17 @@ +
+
+
+
+ +@code { + private float progress = 0; + + [Parameter] + public float Progress { + get => progress; + set { + progress = value; + InvokeAsync(() => StateHasChanged()); + } + } +} diff --git a/Pages/Component/ProgressBar.razor.css b/Pages/Component/ProgressBar.razor.css new file mode 100644 index 0000000..f49c982 --- /dev/null +++ b/Pages/Component/ProgressBar.razor.css @@ -0,0 +1,17 @@ +div#outer { + background: var(--col-progbar-bg); + border-radius: 15px; + height: 15px; + margin: 0; + padding: 0; + width: 100%; +} + +div#inner { + background: var(--col-progbar-fg); + border-radius: 15px; + height: 100%; + margin: 0; + padding: 0; + transition: width 0.5s ease; +} -- cgit v1.3