summaryrefslogtreecommitdiff
path: root/Pages/Component
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-03-29 05:57:43 +1100
committerJake Mannens <jake@asger.xyz>2026-03-29 05:57:43 +1100
commit9f4033649a53222b0543343fc02b0c74a72235b4 (patch)
treeafa81b1c7926fae3fcc549fdfb2aed31c1de248c /Pages/Component
parent4a2491b24b58027a693b1a69f3b94bb23fb96f20 (diff)
v0.4av0.4a
Diffstat (limited to 'Pages/Component')
-rw-r--r--Pages/Component/AboutDialog.razor29
-rw-r--r--Pages/Component/AboutDialog.razor.css11
-rw-r--r--Pages/Component/ProgressBar.razor17
-rw-r--r--Pages/Component/ProgressBar.razor.css17
4 files changed, 73 insertions, 1 deletions
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<HBContext> dbFactory
@inject IHostingEnvironment hostingEnvironment
@implements IDialog
@@ -672,6 +673,15 @@
&lt<a href="https://www.gnu.org/licenses/" target="_blank">https://www.gnu.org/licenses/</a>&gt.
</div>
<a href="https://gitlab.com/plasmicplexus/HyperBooru-Server" target="_blank">Source</a>
+ <div id="progressContainer">
+ @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");
+ <p id="progress">Untagged: @($"{untagged}/{total} ({percent}%)")</p>
+ }
+ <ProgressBar @ref=progressBar />
+ </div>
<ButtonContainer>
<button @onclick=Hide>Close</button>
</ButtonContainer>
@@ -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 @@
+<div id="outer">
+ <div id="inner" style="width:@(Progress * 100)%">
+ </div>
+</div>
+
+@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;
+}