fix(library): ring the folder a reading was asked of, from the click

This commit is contained in:
2026-10-08 09:41:16 +07:00
parent a77c9452b9
commit a87ee4d528
+24 -12
View File
@@ -1027,6 +1027,13 @@ 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(() => {
@@ -1659,17 +1666,19 @@ 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 is the folder the
// reading stands in — not the folder it was pointed at, which
// would be the same row for the whole of an afternoon while
// the work went on somewhere the reader cannot see — together
// with every folder above it, so a branch folded shut still
// shows the work going on under it. The roll's own row wears
// it too, and for two reasons: the frames that sit in the
// roll's own folder have no row but this one, and a reading
// kept to one folder leaves its branch folded or its folder
// off the column, which would otherwise be a whole reading
// reported by the toolbar's line alone.
// 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.
const isScanFolderMatch = !!(live && folder && normPath(live.folder) === normPath(folder.name));
const scanAt = live?.progress.at ? normPath(live.progress.at) : '';
// The row's own path under its own roll, spelled the way the
@@ -1682,9 +1691,12 @@ 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 &&
(n.depth === 0 || (nodeRel !== '' && (scanAt === nodeRel || scanAt.startsWith(`${nodeRel}/`))));
(chosen || (nodeRel !== '' && (scanAt === nodeRel || scanAt.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