From 04ed177e5c0fd443ba6475a207fdca6f240a6ee8 Mon Sep 17 00:00:00 2001 From: 3dtours Date: Thu, 8 Oct 2026 09:58:35 +0700 Subject: [PATCH] fix(library): mark only the folder a reading was asked of and the rows above it --- docker/frontend/src/Library.tsx | 66 +++++++++++++++------------------ 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/docker/frontend/src/Library.tsx b/docker/frontend/src/Library.tsx index 99885fb..afbddec 100644 --- a/docker/frontend/src/Library.tsx +++ b/docker/frontend/src/Library.tsx @@ -1027,13 +1027,6 @@ function Catalogue() { [nodes, expanded] ); - // The row a reading was asked of, spelled the way the walk spells a path (`''` - // for the whole roll), and whether the column holds that row at all: a reading - // kept to a folder whose branch the reader has folded shut has no row to wear - // the ring, and falls back on its roll's own row. - const askedFrom = live ? normPath(live.progress.from) : ''; - const askedDrawn = askedFrom !== '' && rows.some((n) => normPath(relOf(n.key) ?? '') === askedFrom); - // A remembered subfolder that no longer holds a frame falls back to the folder // it sits in, so the screen never opens on a node that is not drawn. useEffect(() => { @@ -1666,21 +1659,23 @@ function Catalogue() { const fNorm = (f.name || '').replace(/\\/g, '/'); return n.key === fNorm || n.key.startsWith(`${fNorm}/`) || n.key === f.name || n.key.startsWith(`${f.name}/`); }) ?? folders[0] ?? null; - // The row that says a reading is under way. It is first of - // all the row the reading was asked of — a right click on - // April is a reading of April — and it wears the ring from - // the click, not from the first frame in hand: the walk - // reads the catalogue and the position back before it - // touches the disk, and a command that shows nothing at all - // for that while is a command the reader cannot tell from - // one that never ran. From there the ring follows the - // reading: the folder it stands in, and every folder above - // it, so a branch folded shut still shows the work going on - // under it. A reading asked of the whole roll, and one whose - // own row is not on the column at all, is answered by the - // roll's row — the only row those frames have. + // The row that says a reading is under way: the row the + // reading was asked of, and every row above it short of the + // roll's own row. A right click on April is a reading of + // April, and April is what gets marked — the shelf it sits on + // is not the folder the reader asked for — while a right + // click on 2026/04 marks 2026 with it, so a branch folded + // shut still shows the work going on under it. The roll's own + // row is worn only when the reading is the whole roll's. + // The ring is worn from the click, not from the first frame + // in hand: the walk reads the catalogue and the position back + // before it touches the disk, and a command that shows nothing + // at all for that while is a command the reader cannot tell + // from one that never ran. const isScanFolderMatch = !!(live && folder && normPath(live.folder) === normPath(folder.name)); - const scanAt = live?.progress.at ? normPath(live.progress.at) : ''; + // The folder the reading was asked of, spelled the way the + // walk spells a path: '' for the whole roll. + const askedFrom = live && isScanFolderMatch ? normPath(live.progress.from) : ''; // The row's own path under its own roll, spelled the way the // walk spells one. Not `relOf`, which answers for the open // node's roll alone: a reading of another roll draws its ring @@ -1691,26 +1686,25 @@ function Catalogue() { n.depth === 0 || !normFolder || !n.key.startsWith(`${normFolder}/`) ? '' : n.key.slice(normFolder.length + 1); - // The row the reading was asked of, and the roll's own row - // for a reading that has no row of its own to stand on. - const chosen = askedFrom === '' || !askedDrawn ? n.depth === 0 : nodeRel === askedFrom; const scanning = isScanFolderMatch && - (chosen || (nodeRel !== '' && (scanAt === nodeRel || scanAt.startsWith(`${nodeRel}/`)))); + (askedFrom === '' + ? n.depth === 0 + : nodeRel !== '' && (nodeRel === askedFrom || askedFrom.startsWith(`${nodeRel}/`))); // What is waiting its turn is waiting on the row it was asked - // of, and on every row above it: a request under a folded - // branch still says the roll has work queued. The roll's own - // row carries it for the same reason it carries the reading — - // and a request belongs to the roll it was asked of, so - // another roll's queue is not this row's news. + // of, and on every row above it short of the roll's row — the + // same rows the reading itself will wear, so the mark a wait + // leaves is the mark the reading takes up. A request belongs + // to the roll it was asked of, so another roll's queue is not + // this row's news. const waiting = !scanning && - (n.depth === 0 || nodeRel !== '') && - scanQueue().some( - (j) => - j.folder === folder?.name && - (n.depth === 0 || j.rel === `${nodeRel}/` || j.rel.startsWith(`${nodeRel}/`)) - ); + scanQueue().some((j) => { + if (j.folder !== folder?.name) return false; + const rel = normPath(j.rel); + if (rel === '') return n.depth === 0; + return nodeRel !== '' && (nodeRel === rel || rel.startsWith(`${nodeRel}/`)); + }); const under = parents.has(n.key); return (