fix(ingest): implement beautiful upload loading state and fix button loading spinner visibility #66
@@ -33,8 +33,15 @@
|
||||
<p>Scanning metadata...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ingesting-state shimmer" style="@(IsIngesting && !IsIndexing ? "display:flex;" : "display:none;")">
|
||||
|
mjasin marked this conversation as resolved
Outdated
|
||||
<div class="shimmer-content">
|
||||
<div class="spinner"></div>
|
||||
<p>Saving book to library...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="verification-state" style="@(IsVerifying && !IsParsing && !IsIndexing ? "display:flex;" : "display:none;")">
|
||||
<div class="verification-state" style="@(IsVerifying && !IsParsing && !IsIndexing && !IsIngesting ? "display:flex;" : "display:none;")">
|
||||
@if (Metadata != null)
|
||||
{
|
||||
<div class="verification-layout">
|
||||
@@ -70,8 +77,8 @@
|
||||
<div class="actions">
|
||||
<NexusButton Class="btn-secondary" OnClick="Reset" Disabled="IsIngesting">Back</NexusButton>
|
||||
<NexusButton Class="@($"btn-primary {(IsIngesting ? "btn-loading" : "")}")"
|
||||
|
mjasin marked this conversation as resolved
Antigravity
commented
🟢 Button spinner runs inside a The While browsers generally optimize The 🟢 **Button spinner runs inside a `display:none` parent — unnecessary GPU compositor work**
The `NexusButton` with `btn-loading` class is inside `.verification-state`, which is hidden via `display:none` when `IsIngesting` is true. The CSS spinner animation (`spin 0.8s linear infinite`) and the new `filter: drop-shadow(...)` are applied to DOM nodes that are not rendered to the screen.
While browsers generally optimize `display:none` subtrees, `filter` properties can still hold GPU resources depending on the browser's paint/compositor implementation. Since `ingesting-state` now provides its own dedicated spinner, consider simplifying the button:
```razor
<NexusButton Class="btn-primary" OnClick="SaveToLibrary" Disabled="IsIngesting">
Save to Library
</NexusButton>
```
The `btn-loading` state on the button is redundant now that `ingesting-state` gives full visual feedback.
|
||||
OnClick="SaveToLibrary"
|
||||
Disabled="IsIngesting">
|
||||
OnClick="SaveToLibrary"
|
||||
Disabled="IsIngesting">
|
||||
@(IsIngesting ? "" : "Save to Library")
|
||||
</NexusButton>
|
||||
</div>
|
||||
@@ -79,7 +86,7 @@
|
||||
</div>
|
||||
|
||||
<div class="upload-state @(_isDragging ? "drag-over" : "")"
|
||||
style="@(!IsParsing && !IsVerifying && !IsIndexing ? "display:flex;" : "display:none;")"
|
||||
style="@(!IsParsing && !IsVerifying && !IsIndexing && !IsIngesting ? "display:flex;" : "display:none;")"
|
||||
@ondragenter="OnDragEnter"
|
||||
@ondragleave="OnDragLeave">
|
||||
<div class="drop-zone">
|
||||
|
||||
@@ -118,8 +118,9 @@
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* Parsing State */
|
||||
.parsing-state {
|
||||
/* Parsing and Ingesting States */
|
||||
.parsing-state,
|
||||
.ingesting-state {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -158,7 +159,8 @@
|
||||
filter: drop-shadow(0 0 8px rgba(0, 255, 153, 0.3));
|
||||
}
|
||||
|
||||
.parsing-state p {
|
||||
.parsing-state p,
|
||||
.ingesting-state p {
|
||||
color: var(--nexus-text);
|
||||
font-family: var(--nexus-font-mono, monospace);
|
||||
font-size: 0.9rem;
|
||||
@@ -371,10 +373,11 @@
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.1);
|
||||
border-top-color: #000;
|
||||
border: 2px solid rgba(255, 255, 255, 0.2);
|
||||
border-top-color: var(--nexus-neon, #00ffaa);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
filter: drop-shadow(0 0 4px var(--nexus-neon, #00ffaa));
|
||||
}
|
||||
|
||||
/* Indexing State */
|
||||
|
||||
Reference in New Issue
Block a user
🟡
ingesting-stateis hidden by the timeIsIndexingcould be true — redundant guardThe
!IsIndexingcondition in theingesting-statevisibility expression is always vacuously true during the visible window of this state. InSaveToLibrary,IsIngestingis set tofalsebeforeIsIndexingis set totrue(lines 309-310), so the two flags are mutually exclusive by construction.Either:
// !IsIndexing is redundant by construction but kept for defensive consistency with parsing-statestyle="@(IsIngesting ? "display:flex;" : "display:none;")"The current state is not a bug, but it creates a false impression that
IsIngestingandIsIndexingcan both betruesimultaneously.