diff --git a/docker/frontend/src/Library.tsx b/docker/frontend/src/Library.tsx index 44d9af0..ea16806 100644 --- a/docker/frontend/src/Library.tsx +++ b/docker/frontend/src/Library.tsx @@ -19,6 +19,7 @@ import { jumpScan, listEditedIds, listFolders, + normPath, pickFolder, readPhotoFile, readPhotos, @@ -1653,13 +1654,16 @@ function Catalogue() { // nothing about the folder the reading is actually in. The // frames that sit in the roll's own folder are the one case // left bare, and the toolbar's line is what carries them. - const dir = relOf(n.key); - const at = live && live.folder === folder?.name && live.progress.at ? `${live.progress.at}/` : null; - const scanning = dir !== null && dir !== '' && at !== null && (dir === at || at.startsWith(dir)); - // A row whose reading has not started yet: the ring is - // there, held still, so a reader sees the roll is pending - // rather than idle. - const waiting = dir !== null && dir !== '' && !scanning && scanQueue().some((j) => j.folder === folder?.name && j.rel === dir); + const isScanFolderMatch = !!(live && folder && normPath(live.folder) === normPath(folder.name)); + const scanAt = live?.progress.at ? normPath(live.progress.at) : ''; + const nodeRel = (relOf(n.key) ?? '').replace(/\/$/, ''); + const scanning = isScanFolderMatch && ( + n.depth === 0 ? true : (scanAt === nodeRel || scanAt.startsWith(nodeRel ? `${nodeRel}/` : '')) + ); + const waiting = !scanning && isScanFolderMatch && scanQueue().some((j) => { + const qRel = (j.rel ?? '').replace(/\/$/, ''); + return qRel === nodeRel || qRel.startsWith(nodeRel ? `${nodeRel}/` : ''); + }); const under = parents.has(n.key); return (