import: the whole feature, and releases put back together
Everything the import grew over the last week, landing in one go — the window, the picker, the audition pen, apply, and the review that stands between them. The fold is the new part. A release filed as a container of parts arrived as N albums, because the scan groups audio by its immediate parent and the container holds none of its own: Analord's eleven volumes were eleven records, and six more releases split the same way. Records now fold into the release above them, and apply is handed an explicit part list — never a recursive walk, which is what let one stray file swallow 288 descendants and duplicate 9 GB. Where releases live is read off the collection rather than assumed, so a genre-nested library moves the answer instead of breaking; below a dominant majority at one depth the pass refuses entirely, because no folding beats wrong folding. Three vetoes independent of depth catch a misread level. Every fold is listed in the review with a way out. research/import/fold-audit.mjs imports the shipping module, so the audited code is the running code: 9 folds, 0 swallows across four library shapes, and none of the 148 artist folders touched. It was that harness that killed the tempting version of this rule — matching a part against its container folded 40 artist folders, Mac Demarco's 8 albums into one, because album folders carry the artist's name. The regression test found a live bug on the way: parts number from 01 each, so flattening two discs collided, and "same name, same size" read the second file as already-imported and dropped it while still counting it. That reuse now also requires that this run has not already written the path. Also here: the picker's accent crossfades between records instead of cutting through the app's blue (ownership moved to the window, which survives the per-record re-key), the fullscreen viewer wears the album's accent instead of the one it left behind in the portal, Skip defers a record without deciding it, and Keep mine is gone — with the cards picked field by field it was Next under another name.
This commit is contained in:
1 parent
4b30c5e573
commit
e7d0971de2
23 files changed
+6498
-258
No files matched your search
@@ -0,0 +1,146 @@
|
||||
<script>
|
||||
// The import's presence while its window is closed — the same dark glass
|
||||
// pill as the follow toast (approved T2), in the same berth above the
|
||||
// player bar, but clickable and persistent: it stays up exactly as long
|
||||
// as there is something to know (a scan or copy running, or a completion
|
||||
// nobody has seen yet) and a click steps back into the import window.
|
||||
//
|
||||
// Visibility is pure derivation — the window OPEN hides it (the window
|
||||
// narrates its own work), and reopening resets terminal phases to idle
|
||||
// (ImportWindow's acknowledgment effect), so the pill never nags about
|
||||
// a state the user has already looked at.
|
||||
import { ui, importStatus } from "../lib/state.svelte.js";
|
||||
|
||||
const nfmt = (n) => n.toLocaleString("en-US");
|
||||
const shown = $derived(!ui.importOpen && importStatus.phase !== "idle");
|
||||
const busy = $derived(
|
||||
importStatus.phase === "scanning" || importStatus.phase === "applying");
|
||||
</script>
|
||||
|
||||
{#if shown}
|
||||
<div class="layer">
|
||||
<button
|
||||
class="toast"
|
||||
onclick={() => { ui.importOpen = true; }}
|
||||
title="Back to the import"
|
||||
>
|
||||
{#if busy}
|
||||
<span class="mark pulse">▸</span>
|
||||
{:else if importStatus.phase === "error" || (importStatus.phase === "applied" && importStatus.skipped)}
|
||||
<span class="mark warn">!</span>
|
||||
{:else}
|
||||
<span class="mark ok">✓</span>
|
||||
{/if}
|
||||
{#if importStatus.phase === "scanning"}
|
||||
<span>Reading your music — <b>{nfmt(importStatus.done)} of
|
||||
{importStatus.total ? nfmt(importStatus.total) : "…"}</b> folders</span>
|
||||
{:else if importStatus.phase === "scanned"}
|
||||
<span>Scan finished — <b>{nfmt(importStatus.done)} records</b> to review</span>
|
||||
{:else if importStatus.phase === "applying"}
|
||||
<span>Importing — <b>{nfmt(importStatus.done)} of
|
||||
{nfmt(importStatus.total)}</b> records copied</span>
|
||||
{:else if importStatus.phase === "applied"}
|
||||
<!-- A bare "Imported 0 records · 0.0 GB" is the worst thing
|
||||
this pill can say: something was refused and the reason
|
||||
is a click away, but nothing here admits it. The count
|
||||
that matters leads. -->
|
||||
{#if importStatus.skipped && !importStatus.done}
|
||||
<span><b>{nfmt(importStatus.skipped)} record{importStatus.skipped === 1
|
||||
? "" : "s"}</b> could not be imported — <b>click to see why</b></span>
|
||||
{:else if importStatus.skipped}
|
||||
<span>Imported <b>{nfmt(importStatus.done)} records</b>{importStatus.label
|
||||
? ` · ${importStatus.label}` : ""} · <b>{nfmt(importStatus.skipped)}
|
||||
left out</b></span>
|
||||
{:else}
|
||||
<span>Imported <b>{nfmt(importStatus.done)} records</b>{importStatus.label
|
||||
? ` · ${importStatus.label}` : ""}</span>
|
||||
{/if}
|
||||
{:else}
|
||||
<span>The import hit a problem — <b>click to see</b></span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
/* FollowToast's berth verbatim — player bar + 8px shell gutter + 26px of
|
||||
air — except the layer lets clicks through and the pill takes them. */
|
||||
.layer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: calc(var(--player-height, 62px) + 8px + 26px);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
z-index: 80;
|
||||
pointer-events: none;
|
||||
}
|
||||
.toast {
|
||||
pointer-events: auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 9px 16px;
|
||||
border-radius: 99px;
|
||||
background: rgba(22, 23, 28, 0.94);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
|
||||
font-size: 12.5px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
animation: toast-in 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||
}
|
||||
.toast:hover {
|
||||
background: rgba(34, 35, 42, 0.96);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.toast:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@keyframes toast-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(16px) scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
.mark {
|
||||
flex: none;
|
||||
font-style: normal;
|
||||
}
|
||||
.mark.pulse {
|
||||
color: var(--accent);
|
||||
animation: mark-pulse 1s ease-in-out infinite;
|
||||
}
|
||||
@keyframes mark-pulse {
|
||||
50% {
|
||||
opacity: 0.35;
|
||||
}
|
||||
}
|
||||
.mark.ok {
|
||||
color: var(--accent);
|
||||
}
|
||||
.mark.warn {
|
||||
color: #f0cd77;
|
||||
}
|
||||
b {
|
||||
font-weight: 800;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.toast {
|
||||
animation-duration: 1ms;
|
||||
}
|
||||
.mark.pulse {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user