2023-01-07 17:22:28 -07:00
|
|
|
import React from "react";
|
2024-04-17 11:25:26 -06:00
|
|
|
import {
|
2025-12-26 10:16:12 -07:00
|
|
|
batchClearDownloads,
|
|
|
|
|
batchDeleteDownloads,
|
|
|
|
|
batchRetryDownloads,
|
2024-04-17 11:25:26 -06:00
|
|
|
clearCompletedDownloads,
|
|
|
|
|
deleteDownload,
|
|
|
|
|
deleteOnceDownloads,
|
|
|
|
|
killDownload,
|
2024-05-08 17:02:27 -06:00
|
|
|
restartDownload,
|
|
|
|
|
retryOnceDownloads
|
2024-04-17 11:25:26 -06:00
|
|
|
} from "../../api";
|
2025-12-07 11:54:20 -07:00
|
|
|
import {Link} from "react-router";
|
2022-09-29 12:02:09 -06:00
|
|
|
import {
|
2023-07-21 15:14:09 -06:00
|
|
|
APIButton,
|
2026-02-20 14:37:58 -07:00
|
|
|
CookiesLockedMessage,
|
2022-11-12 14:17:21 -07:00
|
|
|
DisableDownloadsToggle,
|
2026-07-29 14:40:58 -06:00
|
|
|
DailyLimitMessage,
|
2026-03-12 20:10:57 -06:00
|
|
|
DownloadWindowMessage,
|
2023-09-07 20:13:36 -06:00
|
|
|
ErrorMessage,
|
2025-12-02 15:33:46 -07:00
|
|
|
formatFrequency,
|
2026-03-12 17:48:35 -06:00
|
|
|
humanBandwidth,
|
|
|
|
|
humanFileSize,
|
2022-12-23 16:04:09 -07:00
|
|
|
isoDatetimeToElapsedPopup,
|
2026-03-12 17:48:35 -06:00
|
|
|
useLocalStorage,
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle,
|
2022-09-29 12:02:09 -06:00
|
|
|
WROLModeMessage
|
|
|
|
|
} from "../Common";
|
|
|
|
|
import {
|
2026-07-30 13:10:51 -06:00
|
|
|
Button,
|
2025-12-02 15:33:46 -07:00
|
|
|
ButtonGroup,
|
2025-12-26 10:16:12 -07:00
|
|
|
Checkbox,
|
2026-07-30 13:10:51 -06:00
|
|
|
Header,
|
|
|
|
|
IconButton,
|
2024-04-16 10:14:47 -06:00
|
|
|
Label,
|
2022-10-25 15:06:52 -06:00
|
|
|
Loader,
|
2026-07-30 13:10:51 -06:00
|
|
|
Modal,
|
|
|
|
|
Panel,
|
|
|
|
|
Placeholder,
|
|
|
|
|
Progress,
|
|
|
|
|
Table,
|
|
|
|
|
} from "../ui";
|
2024-11-02 15:14:02 -06:00
|
|
|
import {useDownloads} from "../../hooks/customHooks";
|
2024-12-03 12:44:38 -07:00
|
|
|
import {
|
2025-12-02 15:33:46 -07:00
|
|
|
EditArchiveDownloadForm,
|
2024-12-03 12:44:38 -07:00
|
|
|
EditChannelDownloadForm,
|
|
|
|
|
EditRSSDownloadForm,
|
|
|
|
|
EditScrapeFilesDownloadForm,
|
2025-06-07 17:36:00 -06:00
|
|
|
EditVideosDownloadForm,
|
2025-12-02 15:33:46 -07:00
|
|
|
EditZimDownloadForm
|
2024-12-03 12:44:38 -07:00
|
|
|
} from "../Download";
|
2024-11-02 15:14:02 -06:00
|
|
|
import {Downloaders} from "../Vars";
|
2025-12-26 10:16:12 -07:00
|
|
|
import {SortableTable} from "../SortableTable";
|
|
|
|
|
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
// A header too long for a phone. Both forms are rendered and `.label-*` in App.css shows
|
|
|
|
|
// one; the mobile column widths are sized for the short word.
|
|
|
|
|
const shortHeader = (short, full) => <>
|
|
|
|
|
<span className='label-short'>{short}</span>
|
|
|
|
|
<span className='label-long'>{full}</span>
|
|
|
|
|
</>;
|
|
|
|
|
|
2026-03-12 17:48:35 -06:00
|
|
|
function DownloadProgressModal({progress, url}) {
|
|
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
|
const [navColor] = useLocalStorage('nav_color', 'violet');
|
|
|
|
|
|
|
|
|
|
const speedText = humanBandwidth(progress.speed);
|
|
|
|
|
const etaText = progress.eta || '...';
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
// A percent: this button sits in a column sized for its header, and speed-and-ETA does not
|
|
|
|
|
// fit there. The modal it opens carries the detail, and `title` the full text.
|
|
|
|
|
const buttonLabel = Number.isFinite(progress.percent) ? `${Math.round(progress.percent)}%` : '...';
|
2026-03-12 17:48:35 -06:00
|
|
|
|
|
|
|
|
return <>
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
<Button size='small' onClick={() => setOpen(true)} style={{marginLeft: '0.5em'}}
|
|
|
|
|
title={`${speedText} / ${etaText}`}>
|
2026-03-12 17:48:35 -06:00
|
|
|
{buttonLabel}
|
|
|
|
|
</Button>
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
<Modal closeIcon open={open} onClose={() => setOpen(false)} size='fullscreen'>
|
2026-03-12 17:48:35 -06:00
|
|
|
<Modal.Header>Download Progress</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
|
|
|
|
<Progress
|
|
|
|
|
percent={progress.percent}
|
|
|
|
|
color={navColor}
|
2026-07-30 13:10:51 -06:00
|
|
|
label={`${humanFileSize(progress.bytes_downloaded)} / ${humanFileSize(progress.total_bytes)}`}
|
|
|
|
|
/>
|
|
|
|
|
<Table>
|
|
|
|
|
<Table.Body>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell style={{fontWeight: 600}}>Speed</Table.Cell>
|
|
|
|
|
<Table.Cell>{speedText}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell style={{fontWeight: 600}}>ETA</Table.Cell>
|
|
|
|
|
<Table.Cell>{progress.eta || 'Calculating...'}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.Cell style={{fontWeight: 600}}>Downloaded</Table.Cell>
|
|
|
|
|
<Table.Cell>{humanFileSize(progress.bytes_downloaded)} / {humanFileSize(progress.total_bytes)}</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
{url && <Table.Row>
|
|
|
|
|
<Table.Cell style={{fontWeight: 600}}>URL</Table.Cell>
|
|
|
|
|
<Table.Cell style={{wordBreak: 'break-all'}}>{url}</Table.Cell>
|
|
|
|
|
</Table.Row>}
|
|
|
|
|
</Table.Body>
|
2026-03-12 17:48:35 -06:00
|
|
|
</Table>
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
2026-07-30 13:10:51 -06:00
|
|
|
<Button role='cancel' onClick={() => setOpen(false)}>Close</Button>
|
2026-03-12 17:48:35 -06:00
|
|
|
</Modal.Actions>
|
|
|
|
|
</Modal>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
function ClearDownloadsButton({callback, selectedIds, clearSelection}) {
|
|
|
|
|
const hasSelection = selectedIds && selectedIds.length > 0;
|
2022-09-29 12:02:09 -06:00
|
|
|
|
|
|
|
|
async function localClearDownloads() {
|
|
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
if (hasSelection) {
|
|
|
|
|
await batchClearDownloads(selectedIds);
|
|
|
|
|
if (clearSelection) clearSelection();
|
|
|
|
|
} else {
|
|
|
|
|
await clearCompletedDownloads();
|
|
|
|
|
}
|
2022-09-29 12:02:09 -06:00
|
|
|
} finally {
|
|
|
|
|
if (callback) {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const label = hasSelection ? `Clear (${selectedIds.length})` : 'Clear';
|
|
|
|
|
|
2022-09-29 12:02:09 -06:00
|
|
|
return <>
|
2023-07-21 15:14:09 -06:00
|
|
|
<APIButton
|
2022-09-29 12:02:09 -06:00
|
|
|
onClick={localClearDownloads}
|
2024-04-17 11:25:26 -06:00
|
|
|
color='violet'
|
2023-07-21 15:14:09 -06:00
|
|
|
obeyWROLMode={true}
|
2025-12-26 10:16:12 -07:00
|
|
|
>{label}</APIButton>
|
2022-09-29 12:02:09 -06:00
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
function RetryDownloadsButton({callback, selectedIds, clearSelection}) {
|
|
|
|
|
const hasSelection = selectedIds && selectedIds.length > 0;
|
|
|
|
|
|
2024-05-08 17:02:27 -06:00
|
|
|
async function localRetryOnce() {
|
2022-09-29 12:02:09 -06:00
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
if (hasSelection) {
|
|
|
|
|
await batchRetryDownloads(selectedIds);
|
|
|
|
|
if (clearSelection) clearSelection();
|
|
|
|
|
} else {
|
|
|
|
|
await retryOnceDownloads();
|
|
|
|
|
}
|
2022-09-29 12:02:09 -06:00
|
|
|
} finally {
|
|
|
|
|
if (callback) {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const label = hasSelection ? `Retry (${selectedIds.length})` : 'Retry';
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
return <APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='retry'
|
2024-05-08 17:02:27 -06:00
|
|
|
onClick={localRetryOnce}
|
2023-07-21 15:14:09 -06:00
|
|
|
obeyWROLMode={true}
|
2025-12-26 10:16:12 -07:00
|
|
|
>{label}</APIButton>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
function DeleteOnceDownloadsButton({callback, selectedIds, clearSelection}) {
|
|
|
|
|
const hasSelection = selectedIds && selectedIds.length > 0;
|
|
|
|
|
|
2024-04-17 11:25:26 -06:00
|
|
|
async function localDeleteOnce() {
|
|
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
if (hasSelection) {
|
|
|
|
|
await batchDeleteDownloads(selectedIds);
|
|
|
|
|
if (clearSelection) clearSelection();
|
|
|
|
|
} else {
|
|
|
|
|
await deleteOnceDownloads();
|
|
|
|
|
}
|
2024-04-17 11:25:26 -06:00
|
|
|
} finally {
|
|
|
|
|
if (callback) {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const label = hasSelection ? `Delete (${selectedIds.length})` : 'Delete';
|
|
|
|
|
const confirmContent = hasSelection
|
|
|
|
|
? `Are you sure you want to delete ${selectedIds.length} download(s)?`
|
|
|
|
|
: 'Are you sure you want to delete all downloads? Some may be retried!';
|
|
|
|
|
|
2024-04-17 11:25:26 -06:00
|
|
|
return <APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='danger'
|
2024-04-17 11:25:26 -06:00
|
|
|
onClick={localDeleteOnce}
|
2025-12-26 10:16:12 -07:00
|
|
|
confirmContent={confirmContent}
|
2024-04-17 11:25:26 -06:00
|
|
|
confirmButton='Delete'
|
|
|
|
|
obeyWROLMode={true}
|
2025-12-26 10:16:12 -07:00
|
|
|
>{label}</APIButton>
|
2024-04-17 11:25:26 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-25 22:12:13 -06:00
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
function RecurringDownloadRow({download, fetchDownloads, onDelete}) {
|
|
|
|
|
const [errorModalOpen, setErrorModalOpen] = React.useState(false);
|
|
|
|
|
const [editModalOpen, setEditModalOpen] = React.useState(false);
|
2024-06-25 22:12:13 -06:00
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
const handleRestart = async () => {
|
|
|
|
|
const {id} = download;
|
2024-06-25 22:12:13 -06:00
|
|
|
try {
|
2024-11-02 15:14:02 -06:00
|
|
|
await restartDownload(id);
|
2024-07-03 21:35:38 -06:00
|
|
|
} finally {
|
2024-11-02 15:14:02 -06:00
|
|
|
if (fetchDownloads) {
|
|
|
|
|
await fetchDownloads();
|
|
|
|
|
}
|
2024-06-25 22:12:13 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
const handleEditOpen = () => setEditModalOpen(true);
|
|
|
|
|
const handleEditClose = () => setEditModalOpen(false);
|
|
|
|
|
const handleErrorOpen = () => setErrorModalOpen(true);
|
|
|
|
|
const handleErrorClose = () => setErrorModalOpen(false);
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
url,
|
|
|
|
|
frequency,
|
|
|
|
|
last_successful_download,
|
|
|
|
|
status,
|
|
|
|
|
location,
|
|
|
|
|
next_download,
|
|
|
|
|
error,
|
|
|
|
|
downloader,
|
|
|
|
|
} = download;
|
|
|
|
|
|
|
|
|
|
const link = location ?
|
|
|
|
|
(text) => <Link to={location}>{text}</Link> :
|
|
|
|
|
(text) => <a href={url} target='_blank' rel='noopener noreferrer'>{text}</a>;
|
|
|
|
|
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
const errorModal = <Modal size='fullscreen'
|
2024-11-02 15:14:02 -06:00
|
|
|
closeIcon
|
|
|
|
|
onClose={handleErrorClose}
|
|
|
|
|
open={errorModalOpen}
|
|
|
|
|
>
|
2025-12-07 11:32:07 -07:00
|
|
|
<Modal.Header>Download Error</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
2024-11-02 15:14:02 -06:00
|
|
|
<pre style={{overflowX: 'scroll'}}>{error}</pre>
|
2025-12-07 11:32:07 -07:00
|
|
|
</Modal.Content>
|
|
|
|
|
<Modal.Actions>
|
2026-07-30 13:10:51 -06:00
|
|
|
<Button role='cancel' onClick={handleErrorClose}>Close</Button>
|
2025-12-07 11:32:07 -07:00
|
|
|
</Modal.Actions>
|
2024-11-02 15:14:02 -06:00
|
|
|
</Modal>;
|
|
|
|
|
|
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue. Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.
Converted:
SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
config validity: valid / invalid / empty
"Failed to load preview"
the two "Download error" triggers
expired inventory items, desktop and mobile
the refresh phases: complete / active / not reached
a refresh Progress bar in its error state
cookie status: Unlocked / Locked
a chip-mismatch label on the flasher
CPU load thresholds (LoadStatistic)
the outcome of an API call in useAPIButton
the gallery's "Danger zone" heading and its load readings
Left alone, deliberately:
the file browser toolbar -- every action has its own colour to be told apart,
and delete already uses role='danger' (Roland's ruling)
diff add/remove in the config and inventory import previews. Adding is not a
success and removing is not a failure; in Overwrite mode the removals are
exactly what the user asked for, and painting them danger would report their
intended action as broken
seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
downloader category buttons, "Recommended to Keep"
Three sites were wrong in a way worth naming. Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control. Config validity drew its valid state in `--violet`, which no user
parses as "valid". And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.
Also fixed a stale comment in Videos.js that claimed no token existed for these.
Two notes on the tests:
The first LoadStatistic test I wrote rendered the component and asserted the
inline colour. jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored. It is a source guard now, with the painted result asserted in
the browser instead.
That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine. Not fixed here. The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness. That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:08:34 -06:00
|
|
|
const errorTrigger = <IconButton icon='exclamation triangle' label='Download error' color='danger'
|
2026-07-30 13:10:51 -06:00
|
|
|
onClick={handleErrorOpen}/>;
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const hideEdit = downloader === Downloaders.MapCatalog || downloader === Downloaders.MapExtract;
|
2026-07-30 13:10:51 -06:00
|
|
|
const editButton = hideEdit ? null :
|
|
|
|
|
<IconButton icon='edit' label='Edit download' onClick={handleEditOpen}/>;
|
2024-11-02 15:14:02 -06:00
|
|
|
|
|
|
|
|
const restartButton = <APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='retry'
|
2024-11-02 15:14:02 -06:00
|
|
|
icon='redo'
|
|
|
|
|
confirmContent='Are you sure you want to restart this download?'
|
|
|
|
|
confirmButton='Restart'
|
|
|
|
|
onClick={handleRestart}
|
2024-06-25 22:12:13 -06:00
|
|
|
obeyWROLMode={true}
|
2024-11-02 15:14:02 -06:00
|
|
|
/>;
|
2024-06-25 22:12:13 -06:00
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
// Show "now" if we have passed the next_download.
|
|
|
|
|
let next = 'now';
|
|
|
|
|
if (next_download && new Date() < new Date(next_download)) {
|
|
|
|
|
next = isoDatetimeToElapsedPopup(next_download);
|
|
|
|
|
}
|
2024-06-25 22:12:13 -06:00
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
const onSuccess = async () => {
|
|
|
|
|
if (fetchDownloads) {
|
|
|
|
|
await fetchDownloads();
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
2024-11-02 15:14:02 -06:00
|
|
|
handleEditClose();
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
const localOnDelete = async () => {
|
2023-09-07 21:38:19 -06:00
|
|
|
try {
|
2024-11-02 15:14:02 -06:00
|
|
|
await deleteDownload(download.id);
|
|
|
|
|
await onDelete();
|
2023-09-07 21:38:19 -06:00
|
|
|
} finally {
|
2024-11-02 15:14:02 -06:00
|
|
|
await fetchDownloads();
|
|
|
|
|
handleEditClose();
|
2023-09-07 21:38:19 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
let editForm;
|
|
|
|
|
if (downloader === Downloaders.VideoChannel) {
|
|
|
|
|
editForm = <EditChannelDownloadForm
|
|
|
|
|
download={download}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={onSuccess}
|
|
|
|
|
onDelete={localOnDelete}
|
|
|
|
|
/>;
|
|
|
|
|
} else if (downloader === Downloaders.RSS) {
|
|
|
|
|
editForm = <EditRSSDownloadForm
|
|
|
|
|
download={download}
|
|
|
|
|
onDelete={localOnDelete}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={onSuccess}
|
|
|
|
|
/>;
|
|
|
|
|
} else if (downloader === Downloaders.KiwixCatalog) {
|
|
|
|
|
editForm = <EditZimDownloadForm
|
|
|
|
|
download={download}
|
|
|
|
|
onDelete={localOnDelete}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={onSuccess}
|
2024-12-03 12:44:38 -07:00
|
|
|
/>;
|
|
|
|
|
} else if (downloader === Downloaders.ScrapeHtml) {
|
|
|
|
|
editForm = <EditScrapeFilesDownloadForm
|
|
|
|
|
download={download}
|
|
|
|
|
onDelete={localOnDelete}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={onSuccess}
|
2024-11-02 15:14:02 -06:00
|
|
|
/>;
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
2024-11-02 15:14:02 -06:00
|
|
|
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
const editModal = <Modal size='large' closeIcon
|
2024-11-02 15:14:02 -06:00
|
|
|
open={editModalOpen}
|
|
|
|
|
onClose={handleEditClose}
|
|
|
|
|
>
|
2025-12-07 11:32:07 -07:00
|
|
|
<Modal.Header>Edit Download</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
2024-11-02 15:14:02 -06:00
|
|
|
{editForm}
|
2025-12-07 11:32:07 -07:00
|
|
|
</Modal.Content>
|
2024-11-02 15:14:02 -06:00
|
|
|
</Modal>;
|
|
|
|
|
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Table.Row failed={!!error && !download.progress}>
|
|
|
|
|
<Table.Cell className='column-ellipsis'>
|
2024-11-02 15:14:02 -06:00
|
|
|
{link(url)}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{formatFrequency(frequency)}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2024-11-02 15:14:02 -06:00
|
|
|
{last_successful_download && isoDatetimeToElapsedPopup(last_successful_download)}
|
2026-07-30 13:10:51 -06:00
|
|
|
{status === 'pending' && !download.progress && <Loader size='xs'/>}
|
2026-03-12 17:48:35 -06:00
|
|
|
{download.progress && <DownloadProgressModal progress={download.progress} url={download.url}/>}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{next}</Table.Cell>
|
ui: a row of buttons is spaced by the row
The archive page's six actions shared edges, and Update sat lower than the
rest. Both come from the same thing: Semantic's Button carried
`margin: 0 .25em .25em 0`, so a page could list buttons as bare siblings and
they arrived spaced -- and separated from the line below when the row wrapped.
Nothing replaced that margin.
Two of those six answered with `marginTop: 0.5em`, which is the wrong axis: a
Button is `display: inline-flex; vertical-align: middle`, and `vertical-align`
is measured on the MARGIN box, so half of any top margin shows up as the
visible button dropping. It was covering the wrapped-row case in the only axis
a margin can, and paying for it in the other one.
`.wrolpi-button-row` is a flex row with a gap, so both axes are covered at once
and no button needs a margin of its own -- the same rule as `.wrolpi-stack`,
along the other axis. Applied to the five rows in the app that had no gap: the
archive page, the shared collection edit form (which three pages hand action
buttons to, and where nine buttons plus Cancel carried `margin-top: 1em` each
while Save carried none), the doc page's two responsive branches, and the
downloads table's edit/restart pair.
`.action-button-spacing` goes with them; it was that same margin, on Cancel.
Guarded four ways. ui-layout.cy.js measures that the row really spaces what it
holds, wraps rather than overflows, centres its buttons against a taller item
beside them, and counts a confirmed APIButton as one item rather than two --
that one returns a fragment holding a `<Confirm/>`, which would open a hole in
the row if it did not portal. Common.test.js scans for the two ways this comes
back: a button in a row stamping a vertical margin, and a row of buttons that is
not a row. Neither throws, which is how the app got here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:39:03 -06:00
|
|
|
<Table.Cell>
|
|
|
|
|
{/* `justify-content` rather than the cell's `text-align: right`, which a flex row
|
|
|
|
|
does not answer to. These two are icon buttons and were sharing an edge. */}
|
|
|
|
|
<div className='wrolpi-button-row' style={{justifyContent: 'flex-end'}}>
|
|
|
|
|
{error && !download.progress && errorTrigger}
|
|
|
|
|
{editButton}
|
|
|
|
|
{restartButton}
|
|
|
|
|
</div>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
{errorModal}
|
2024-11-02 15:14:02 -06:00
|
|
|
{editModal}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Row>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
function OnceDownloadRow({download, fetchDownloads, isSelected, onSelect}) {
|
|
|
|
|
const [editModalOpen, setEditModalOpen] = React.useState(false);
|
|
|
|
|
|
2026-02-08 09:39:28 -07:00
|
|
|
const {url, last_successful_download, status, location, error, downloader, settings, id, tag_names} = download;
|
2026-02-18 15:16:10 -07:00
|
|
|
const parentDownloadUrl = settings?.parent_download_url;
|
2022-09-29 12:02:09 -06:00
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const handleDelete = async () => {
|
2024-11-02 15:14:02 -06:00
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
await deleteDownload(id);
|
2024-11-02 15:14:02 -06:00
|
|
|
} finally {
|
2025-12-26 10:16:12 -07:00
|
|
|
await fetchDownloads();
|
2024-11-02 15:14:02 -06:00
|
|
|
}
|
2023-04-01 16:09:05 -06:00
|
|
|
};
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const handleStop = async () => {
|
2024-11-02 15:14:02 -06:00
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
await killDownload(id);
|
2024-11-02 15:14:02 -06:00
|
|
|
} finally {
|
2025-12-26 10:16:12 -07:00
|
|
|
await fetchDownloads();
|
2024-11-02 15:14:02 -06:00
|
|
|
}
|
2022-09-29 12:02:09 -06:00
|
|
|
};
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const handleRestart = async () => {
|
2023-09-07 21:38:19 -06:00
|
|
|
try {
|
2025-12-26 10:16:12 -07:00
|
|
|
await restartDownload(id);
|
2024-11-02 15:14:02 -06:00
|
|
|
} finally {
|
2025-12-26 10:16:12 -07:00
|
|
|
await fetchDownloads();
|
2023-09-07 21:38:19 -06:00
|
|
|
}
|
2022-09-29 12:02:09 -06:00
|
|
|
};
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const handleEditOpen = () => setEditModalOpen(true);
|
|
|
|
|
const handleEditClose = () => setEditModalOpen(false);
|
2025-06-07 17:36:00 -06:00
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
const handleEditSuccess = async () => {
|
|
|
|
|
await fetchDownloads();
|
|
|
|
|
handleEditClose();
|
2025-06-07 17:36:00 -06:00
|
|
|
};
|
|
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
// Open downloads (/download), or external links in an anchor.
|
|
|
|
|
const link = location && !location.startsWith('/download') ?
|
|
|
|
|
(text) => <Link to={location}>{text}</Link> :
|
|
|
|
|
(text) => <a href={location || url} target='_blank' rel='noopener noreferrer'>{text}</a>;
|
2022-09-29 12:02:09 -06:00
|
|
|
|
2025-12-26 10:16:12 -07:00
|
|
|
let completedAtCell = last_successful_download ? isoDatetimeToElapsedPopup(last_successful_download) : null;
|
2026-07-30 13:10:51 -06:00
|
|
|
let buttonCell = <Table.Cell/>;
|
2025-12-26 10:16:12 -07:00
|
|
|
if (status === 'pending' || status === 'new') {
|
|
|
|
|
buttonCell = (
|
2026-07-30 13:10:51 -06:00
|
|
|
<Table.Cell>
|
2026-02-18 15:16:10 -07:00
|
|
|
<ButtonGroup>
|
|
|
|
|
<APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='danger'
|
|
|
|
|
icon='stop'
|
2026-02-18 15:16:10 -07:00
|
|
|
onClick={handleStop}
|
|
|
|
|
confirmContent='Are you sure you want to stop this download? It will not be retried.'
|
|
|
|
|
confirmButton='Stop'
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
/>
|
|
|
|
|
{status === 'new' && (downloader === Downloaders.Video || downloader === Downloaders.Archive) && (
|
2026-07-30 13:10:51 -06:00
|
|
|
<IconButton
|
2026-02-18 15:16:10 -07:00
|
|
|
icon='edit'
|
2026-07-30 13:10:51 -06:00
|
|
|
label='Edit download'
|
2026-02-18 15:16:10 -07:00
|
|
|
color='blue'
|
|
|
|
|
onClick={handleEditOpen}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</ButtonGroup>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
);
|
|
|
|
|
} else if (status === 'failed' || status === 'deferred') {
|
|
|
|
|
buttonCell = (
|
2026-07-30 13:10:51 -06:00
|
|
|
<Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
<ButtonGroup>
|
2023-07-21 15:14:09 -06:00
|
|
|
<APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='danger'
|
2025-12-26 10:16:12 -07:00
|
|
|
icon='trash'
|
|
|
|
|
onClick={handleDelete}
|
|
|
|
|
confirmContent='Are you sure you want to delete this download?'
|
|
|
|
|
confirmButton='Delete'
|
2023-07-21 15:14:09 -06:00
|
|
|
obeyWROLMode={true}
|
2025-12-26 10:16:12 -07:00
|
|
|
/>
|
|
|
|
|
{(downloader === Downloaders.Video || downloader === Downloaders.Archive) && status !== 'pending' && (
|
2026-07-30 13:10:51 -06:00
|
|
|
<IconButton
|
2025-12-26 10:16:12 -07:00
|
|
|
icon='edit'
|
2026-07-30 13:10:51 -06:00
|
|
|
label='Edit download'
|
2025-12-26 10:16:12 -07:00
|
|
|
color='blue'
|
|
|
|
|
onClick={handleEditOpen}
|
2025-06-07 17:36:00 -06:00
|
|
|
/>
|
2025-12-26 10:16:12 -07:00
|
|
|
)}
|
|
|
|
|
<APIButton
|
2026-07-30 13:10:51 -06:00
|
|
|
role='retry'
|
2025-12-26 10:16:12 -07:00
|
|
|
icon='redo'
|
|
|
|
|
confirmContent='Are you sure you want to restart this download?'
|
|
|
|
|
confirmButton='Start'
|
|
|
|
|
onClick={handleRestart}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
/>
|
|
|
|
|
</ButtonGroup>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
);
|
|
|
|
|
} else if (status === 'complete' && location) {
|
|
|
|
|
buttonCell = (
|
2026-07-30 13:10:51 -06:00
|
|
|
<Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
{link('View')}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
);
|
|
|
|
|
}
|
2026-07-30 13:10:51 -06:00
|
|
|
|
|
|
|
|
// Create edit modal for video or archive downloads
|
|
|
|
|
let editModal = null;
|
|
|
|
|
let errorModal = null;
|
|
|
|
|
const [errorModalOpen, setErrorModalOpen] = React.useState(false);
|
|
|
|
|
|
2026-03-12 17:48:35 -06:00
|
|
|
if (error && !download.progress) {
|
2025-12-26 10:16:12 -07:00
|
|
|
completedAtCell = (
|
ui: route genuine success and failure through the roles
Sixteen call sites, chosen by reading each one rather than by grepping for a
hue. Four sub-agents judged them independently against one rule: convert only
what genuinely means success or failure; identification, category and
decoration stay hue-named.
Converted:
SMART drive health (all four branches -- PASS/WARN/FAIL/unknown)
config validity: valid / invalid / empty
"Failed to load preview"
the two "Download error" triggers
expired inventory items, desktop and mobile
the refresh phases: complete / active / not reached
a refresh Progress bar in its error state
cookie status: Unlocked / Locked
a chip-mismatch label on the flasher
CPU load thresholds (LoadStatistic)
the outcome of an API call in useAPIButton
the gallery's "Danger zone" heading and its load readings
Left alone, deliberately:
the file browser toolbar -- every action has its own colour to be told apart,
and delete already uses role='danger' (Roland's ruling)
diff add/remove in the config and inventory import previews. Adding is not a
success and removing is not a failure; in Overwrite mode the removals are
exactly what the user asked for, and painting them danger would report their
intended action as broken
seasons in DatesSelector, the uploader star and favourite heart, TagIcon,
downloader category buttons, "Recommended to Keep"
Three sites were wrong in a way worth naming. Both "Download error" triggers
guard on the same condition and render the same modal, but one was `orange` and
the other `red` -- and `orange` is the single worst choice, byte-identical to
`--text` in night, so that error button was indistinguishable from an ordinary
control. Config validity drew its valid state in `--violet`, which no user
parses as "valid". And `LoadStatistic` -- the thing users actually watch on the
Status page -- rendered its warning threshold in that same invisible orange.
Also fixed a stale comment in Videos.js that claimed no token existed for these.
Two notes on the tests:
The first LoadStatistic test I wrote rendered the component and asserted the
inline colour. jsdom REJECTS `color: var(--danger)` as an invalid declaration
and drops it, so every colour reads back as the empty string -- two of the four
assertions passed for that reason alone and would have kept passing with the
hues restored. It is a source guard now, with the painted result asserted in
the browser instead.
That browser test then found something real: an uncoloured reading inherits
`--text`, which in night is 4.98:1 against `--warning`'s 4.91:1, so a machine
under load is marginally QUIETER than one that is fine. Not fixed here. The
only way up on a dark panel is lightness, and night's danger would desaturate
from #ff3e3e to about #ff5d5d -- trading the theme's "red only" character for
loudness. That is a palette decision, so the test documents it and asserts what
does hold rather than quietly making it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:08:34 -06:00
|
|
|
<IconButton icon='exclamation triangle' label='Download error' color='danger'
|
2026-07-30 13:10:51 -06:00
|
|
|
onClick={() => setErrorModalOpen(true)}/>
|
2025-12-26 10:16:12 -07:00
|
|
|
)
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
errorModal = <Modal size='fullscreen'
|
2026-07-30 13:10:51 -06:00
|
|
|
closeIcon
|
|
|
|
|
open={errorModalOpen}
|
|
|
|
|
onClose={() => setErrorModalOpen(false)}
|
|
|
|
|
>
|
|
|
|
|
<Modal.Header>Download Error</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
|
|
|
|
<pre style={{overflowX: 'scroll'}}>{error}</pre>
|
|
|
|
|
</Modal.Content>
|
|
|
|
|
</Modal>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
2025-12-26 10:16:12 -07:00
|
|
|
|
|
|
|
|
if (downloader === Downloaders.Video) {
|
|
|
|
|
editModal = (
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
<Modal size='large'
|
2025-12-26 10:16:12 -07:00
|
|
|
closeIcon
|
|
|
|
|
open={editModalOpen}
|
|
|
|
|
onClose={handleEditClose}
|
|
|
|
|
>
|
|
|
|
|
<Modal.Header>Edit Video Download</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
|
|
|
|
<EditVideosDownloadForm
|
|
|
|
|
download={{
|
|
|
|
|
urls: url,
|
|
|
|
|
settings: settings || {},
|
2026-02-08 09:39:28 -07:00
|
|
|
id: id,
|
|
|
|
|
tag_names: tag_names || []
|
2025-12-26 10:16:12 -07:00
|
|
|
}}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={handleEditSuccess}
|
|
|
|
|
onDelete={handleDelete}
|
|
|
|
|
/>
|
2026-02-18 15:16:10 -07:00
|
|
|
{parentDownloadUrl && (
|
2026-07-30 13:10:51 -06:00
|
|
|
<p style={{marginTop: '1em', color: 'var(--muted)'}}>
|
2026-02-18 15:16:10 -07:00
|
|
|
From: <a href={parentDownloadUrl} target='_blank' rel='noopener noreferrer'>
|
2026-03-12 17:48:35 -06:00
|
|
|
{parentDownloadUrl}
|
|
|
|
|
</a>
|
2026-02-18 15:16:10 -07:00
|
|
|
</p>
|
|
|
|
|
)}
|
2025-12-26 10:16:12 -07:00
|
|
|
</Modal.Content>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
} else if (downloader === Downloaders.Archive) {
|
|
|
|
|
editModal = (
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
<Modal size='large'
|
2025-12-26 10:16:12 -07:00
|
|
|
closeIcon
|
|
|
|
|
open={editModalOpen}
|
|
|
|
|
onClose={handleEditClose}
|
|
|
|
|
>
|
|
|
|
|
<Modal.Header>Edit Archive Download</Modal.Header>
|
|
|
|
|
<Modal.Content>
|
|
|
|
|
<EditArchiveDownloadForm
|
|
|
|
|
download={{
|
|
|
|
|
urls: url,
|
2026-02-08 09:39:28 -07:00
|
|
|
tag_names: tag_names || [],
|
2025-12-26 10:16:12 -07:00
|
|
|
id: id
|
|
|
|
|
}}
|
|
|
|
|
onCancel={handleEditClose}
|
|
|
|
|
onSuccess={handleEditSuccess}
|
|
|
|
|
onDelete={handleDelete}
|
|
|
|
|
/>
|
2026-02-18 15:16:10 -07:00
|
|
|
{parentDownloadUrl && (
|
2026-07-30 13:10:51 -06:00
|
|
|
<p style={{marginTop: '1em', color: 'var(--muted)'}}>
|
2026-02-18 15:16:10 -07:00
|
|
|
From: <a href={parentDownloadUrl} target='_blank' rel='noopener noreferrer'>
|
2026-03-12 17:48:35 -06:00
|
|
|
{parentDownloadUrl}
|
|
|
|
|
</a>
|
2026-02-18 15:16:10 -07:00
|
|
|
</p>
|
|
|
|
|
)}
|
2025-12-26 10:16:12 -07:00
|
|
|
</Modal.Content>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Table.Row failed={status === 'failed' || status === 'deferred'}>
|
|
|
|
|
<Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
<Checkbox
|
|
|
|
|
checked={isSelected}
|
|
|
|
|
onChange={() => onSelect(id)}
|
|
|
|
|
/>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell className='column-ellipsis'>
|
2025-12-26 10:16:12 -07:00
|
|
|
{link(url)}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
{completedAtCell}
|
2026-07-30 13:10:51 -06:00
|
|
|
{status === 'pending' && !download.progress ? <Loader size='xs'/> : null}
|
2026-03-12 17:48:35 -06:00
|
|
|
{download.progress && <DownloadProgressModal progress={download.progress} url={download.url}/>}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Cell>
|
2025-12-26 10:16:12 -07:00
|
|
|
{buttonCell}
|
2026-07-30 13:10:51 -06:00
|
|
|
{errorModal}
|
2025-12-26 10:16:12 -07:00
|
|
|
{editModal}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Row>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-07 17:22:28 -07:00
|
|
|
export function OnceDownloadsTable({downloads, fetchDownloads}) {
|
2025-12-26 10:16:12 -07:00
|
|
|
const [selectedIds, setSelectedIds] = React.useState([]);
|
|
|
|
|
|
|
|
|
|
// Clear selection when downloads change (e.g., after deletion)
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (downloads) {
|
|
|
|
|
// Remove any selected IDs that no longer exist
|
|
|
|
|
const downloadIds = new Set(downloads.map(d => d.id));
|
|
|
|
|
setSelectedIds(prev => prev.filter(id => downloadIds.has(id)));
|
|
|
|
|
}
|
|
|
|
|
}, [downloads]);
|
|
|
|
|
|
|
|
|
|
const onSelect = (id) => {
|
|
|
|
|
if (selectedIds.includes(id)) {
|
|
|
|
|
setSelectedIds(selectedIds.filter(i => i !== id));
|
|
|
|
|
} else {
|
|
|
|
|
setSelectedIds([...selectedIds, id]);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const clearSelection = () => setSelectedIds([]);
|
|
|
|
|
|
|
|
|
|
const toggleSelectAll = () => {
|
|
|
|
|
if (downloads && selectedIds.length === downloads.length) {
|
|
|
|
|
setSelectedIds([]);
|
|
|
|
|
} else if (downloads) {
|
|
|
|
|
setSelectedIds(downloads.map(d => d.id));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
// Widths come from the `col-*` classes in App.css, which change at the tablet breakpoint.
|
|
|
|
|
// Only the URL names none: it takes the remainder and truncates.
|
2025-12-26 10:16:12 -07:00
|
|
|
const tableHeaders = [
|
|
|
|
|
{
|
|
|
|
|
key: 'select',
|
|
|
|
|
text: <Checkbox
|
|
|
|
|
checked={downloads && downloads.length > 0 && selectedIds.length === downloads.length}
|
|
|
|
|
indeterminate={selectedIds.length > 0 && selectedIds.length < (downloads?.length || 0)}
|
|
|
|
|
onChange={toggleSelectAll}
|
|
|
|
|
/>,
|
ui: a downloads table wider than the phone showing it (#660)
The two downloads tables came out 676px and 727px in a 540px window, so Completed At and
Control sat off the right edge and their buttons could not be reached without scrolling
sideways.
`.table-ellipsis` was trying to truncate under `table-layout: auto`, where a table is as
wide as its columns want to be and the container simply overflows. The rule leaned on
`max-width: 0` to force an ellipsis and `min-width: 25em` to keep the text column readable
-- but 25em is 385px, and a floor wider than the screen makes the overflow certain.
Fixed layout inverts it: the columns divide the table's width and the column marked
`column-ellipsis` gives up what it cannot show. Neither the max-width trick nor the floor
is needed then. Columns that must fit something exact -- a checkbox, a group of buttons --
state a width; the rest is the truncating column's.
`table.table-ellipsis`, not the bare class: Mantine sets `table-layout` on its own
`.mantine-Table-table`, the same specificity and later in the cascade, so the first version
of this lost silently. Every other property in the rule applied, which made the table look
fixed while it stayed auto -- the recurring table got *wider* than before, not narrower.
Three things the rework then had to answer for, each of them measured in the browser:
* A header overran its column: "Completed At" printed on top of "Control", because
`.wrolpi-th-sort` is nowrap so a label never splits from its arrow. It wraps here, and
needs `min-width: 0` as well -- the label is an anonymous flex item whose automatic
minimum is its longest word, so without it the label still refuses to go below
"Completed" and still overruns.
* A grouped button was squeezed: `ButtonGroup` is a nowrap flex row whose children shrink,
and the Stop button on a pending download came out 23px against its neighbour's 40 --
clipped, and too small to hit. The columns are sized for the widest group a row can
have, so the buttons no longer give.
* Status's Top Processes table had the same bug. It already asked for `.table-ellipsis`
and already marked its Command cell, so it overflowed a phone too (548px into 503px).
The same rule fixes it, with widths for the three short readings.
A wrapped header is the fallback, not the layout, so every column is sized to hold its own
label on one line -- including on a phone. "Download Frequency" is the exception at 11.7em,
which a phone cannot spare beside four other columns, so it takes a class that widens at the
tablet breakpoint and wraps below it.
Measured, nothing overflowing, no header overrun, no clipped cell, no shrunken button:
540px once 40 / 208 / 146 / 146 recurring 123 / 108 / 131 / 62 / 116
1400px once 40 / 1033 / 146 / 146 recurring 871 / 185 / 131 / 62 / 116
Desktop gains from it as well: the checkbox column drops from 90px to 40 and Completed At
from 291 to 146, so the URL column picks up about 255px.
Covered by five tests in the Cypress layout suite. None of this is checkable in jsdom --
it is all resolved widths, and the central question is whether our `table-layout` beats the
one Mantine sets, which is exactly the part that failed silently.
69 suites / 1214 jest tests pass.
2026-08-12 10:08:55 -06:00
|
|
|
sortBy: null,
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
className: 'col-select',
|
2025-12-26 10:16:12 -07:00
|
|
|
},
|
|
|
|
|
{key: 'url', text: 'URL', sortBy: i => i.url.toLowerCase()},
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
{key: 'completed_at', text: shortHeader('Done', 'Completed At'),
|
|
|
|
|
sortBy: i => i.last_successful_download || '', className: 'col-completed'},
|
|
|
|
|
{key: 'control', text: 'Control', sortBy: null, className: 'col-control-group'},
|
2025-12-26 10:16:12 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const rowFunc = (download) => (
|
|
|
|
|
<OnceDownloadRow
|
|
|
|
|
key={download.id}
|
|
|
|
|
download={download}
|
|
|
|
|
fetchDownloads={fetchDownloads}
|
|
|
|
|
isSelected={selectedIds.includes(download.id)}
|
|
|
|
|
onSelect={onSelect}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
|
2026-07-30 13:10:51 -06:00
|
|
|
const footer = <Table.Footer>
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<Table.HeaderCell colSpan={4}>
|
review: the scan the first two commits needed
Five findings, all valid. The substantive one: the video page's Download /
Delete / Refresh / AddToPlaylist strip was still four bare buttons in a `<p>` --
the direct analogue of the archive row this PR started with -- and the scan that
was supposed to catch exactly that reported the app clean.
It only ever saw `{fooButton}` interpolations, and most of the app writes its
buttons out in place. Scanning for adjacent button ELEMENTS finds twelve more
rows in the same state: reorder icons in the playlist and field-schema tables,
both service tables on the controller page, its hotspot Save/QR pair and its
Restart/Shutdown pair, the downloads footer, the one-time pad's Generate/Cheat
Sheet, and the ration calculator's CSV/Print. All rowed.
Two holes had to be closed before that scan could be trusted, because a scan
that reports noise is worse than one with a stated limit:
- `tagsIn` never captured the tag NAME, so `ROW_COMPONENTS.has(undefined)` was
false for every tag and the list of components that lay out their own
children -- Group, ButtonGroup, Modal.Actions -- silently accepted none of
them. 56 false positives, every modal footer in the app among them.
- A row whose style is a const (`style={seasonRowStyle}`) says nothing in its
own attributes. Resolved now; the dates selector's seasons row is a
four-column grid with a gap and was reported three times.
Also from review: the row body is found by walking to the MATCHING close rather
than the first `</div>`, which one nested div would have truncated -- and the
collection form now nests one, so this was about to matter. Cancel and Save
travel together in a row of their own pushed to the end; `margin-left: auto` on
Save alone was right for a row that could not wrap, and would now drop Save onto
a second line by itself with Cancel left among the action buttons. The doc
page's comment no longer implies the picker's 1em separation was not a change.
One more found on the way: the file browser's filter row is flex with no gap, and
its collapse-all button carried `margin-left: 0.5em` for it. The gap is the
container's.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 17:06:56 -06:00
|
|
|
<div className='wrolpi-button-row'>
|
2025-12-26 10:16:12 -07:00
|
|
|
<ClearDownloadsButton
|
|
|
|
|
callback={fetchDownloads}
|
|
|
|
|
selectedIds={selectedIds}
|
|
|
|
|
clearSelection={clearSelection}
|
|
|
|
|
/>
|
|
|
|
|
<RetryDownloadsButton
|
|
|
|
|
callback={fetchDownloads}
|
|
|
|
|
selectedIds={selectedIds}
|
|
|
|
|
clearSelection={clearSelection}
|
|
|
|
|
/>
|
|
|
|
|
<DeleteOnceDownloadsButton
|
|
|
|
|
callback={fetchDownloads}
|
|
|
|
|
selectedIds={selectedIds}
|
|
|
|
|
clearSelection={clearSelection}
|
|
|
|
|
/>
|
review: the scan the first two commits needed
Five findings, all valid. The substantive one: the video page's Download /
Delete / Refresh / AddToPlaylist strip was still four bare buttons in a `<p>` --
the direct analogue of the archive row this PR started with -- and the scan that
was supposed to catch exactly that reported the app clean.
It only ever saw `{fooButton}` interpolations, and most of the app writes its
buttons out in place. Scanning for adjacent button ELEMENTS finds twelve more
rows in the same state: reorder icons in the playlist and field-schema tables,
both service tables on the controller page, its hotspot Save/QR pair and its
Restart/Shutdown pair, the downloads footer, the one-time pad's Generate/Cheat
Sheet, and the ration calculator's CSV/Print. All rowed.
Two holes had to be closed before that scan could be trusted, because a scan
that reports noise is worse than one with a stated limit:
- `tagsIn` never captured the tag NAME, so `ROW_COMPONENTS.has(undefined)` was
false for every tag and the list of components that lay out their own
children -- Group, ButtonGroup, Modal.Actions -- silently accepted none of
them. 56 false positives, every modal footer in the app among them.
- A row whose style is a const (`style={seasonRowStyle}`) says nothing in its
own attributes. Resolved now; the dates selector's seasons row is a
four-column grid with a gap and was reported three times.
Also from review: the row body is found by walking to the MATCHING close rather
than the first `</div>`, which one nested div would have truncated -- and the
collection form now nests one, so this was about to matter. Cancel and Save
travel together in a row of their own pushed to the end; `margin-left: auto` on
Save alone was right for a row that could not wrap, and would now drop Save onto
a second line by itself with Cancel left among the action buttons. The doc
page's comment no longer implies the picker's 1em separation was not a change.
One more found on the way: the file browser's filter row is flex with no gap, and
its collapse-all button carried `margin-left: 0.5em` for it. The gap is the
container's.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 17:06:56 -06:00
|
|
|
</div>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.HeaderCell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Footer>;
|
2025-12-26 10:16:12 -07:00
|
|
|
|
2023-09-07 20:13:36 -06:00
|
|
|
if (downloads && downloads.length >= 1) {
|
2025-12-26 10:16:12 -07:00
|
|
|
return <SortableTable
|
|
|
|
|
tableHeaders={tableHeaders}
|
|
|
|
|
data={downloads}
|
|
|
|
|
rowFunc={rowFunc}
|
|
|
|
|
rowKey='id'
|
|
|
|
|
footer={footer}
|
|
|
|
|
tableProps={{className: 'table-ellipsis'}}
|
|
|
|
|
/>
|
2023-09-07 20:13:36 -06:00
|
|
|
} else if (downloads) {
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Panel>No downloads are scheduled.</Panel>
|
2023-09-07 20:13:36 -06:00
|
|
|
} else if (downloads === undefined) {
|
|
|
|
|
return <ErrorMessage>Unable to fetch downloads</ErrorMessage>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Placeholder lines={2}/>
|
2023-01-07 17:22:28 -07:00
|
|
|
}
|
2022-09-29 12:02:09 -06:00
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
export function RecurringDownloadsTable({downloads, fetchDownloads, onDelete}) {
|
2023-09-07 20:13:36 -06:00
|
|
|
if (downloads && downloads.length >= 1) {
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Table className='table-ellipsis'>
|
|
|
|
|
<Table.Header>
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
{/* Widths come from the `col-*` classes in App.css, not percentages: what each
|
|
|
|
|
column holds is a fixed amount of text or a fixed number of buttons, and a
|
|
|
|
|
percentage of a phone's width is not that. Only the URL names none -- it
|
|
|
|
|
takes the remainder and truncates. */}
|
2026-07-30 13:10:51 -06:00
|
|
|
<Table.Row>
|
ui: a downloads table wider than the phone showing it (#660)
The two downloads tables came out 676px and 727px in a 540px window, so Completed At and
Control sat off the right edge and their buttons could not be reached without scrolling
sideways.
`.table-ellipsis` was trying to truncate under `table-layout: auto`, where a table is as
wide as its columns want to be and the container simply overflows. The rule leaned on
`max-width: 0` to force an ellipsis and `min-width: 25em` to keep the text column readable
-- but 25em is 385px, and a floor wider than the screen makes the overflow certain.
Fixed layout inverts it: the columns divide the table's width and the column marked
`column-ellipsis` gives up what it cannot show. Neither the max-width trick nor the floor
is needed then. Columns that must fit something exact -- a checkbox, a group of buttons --
state a width; the rest is the truncating column's.
`table.table-ellipsis`, not the bare class: Mantine sets `table-layout` on its own
`.mantine-Table-table`, the same specificity and later in the cascade, so the first version
of this lost silently. Every other property in the rule applied, which made the table look
fixed while it stayed auto -- the recurring table got *wider* than before, not narrower.
Three things the rework then had to answer for, each of them measured in the browser:
* A header overran its column: "Completed At" printed on top of "Control", because
`.wrolpi-th-sort` is nowrap so a label never splits from its arrow. It wraps here, and
needs `min-width: 0` as well -- the label is an anonymous flex item whose automatic
minimum is its longest word, so without it the label still refuses to go below
"Completed" and still overruns.
* A grouped button was squeezed: `ButtonGroup` is a nowrap flex row whose children shrink,
and the Stop button on a pending download came out 23px against its neighbour's 40 --
clipped, and too small to hit. The columns are sized for the widest group a row can
have, so the buttons no longer give.
* Status's Top Processes table had the same bug. It already asked for `.table-ellipsis`
and already marked its Command cell, so it overflowed a phone too (548px into 503px).
The same rule fixes it, with widths for the three short readings.
A wrapped header is the fallback, not the layout, so every column is sized to hold its own
label on one line -- including on a phone. "Download Frequency" is the exception at 11.7em,
which a phone cannot spare beside four other columns, so it takes a class that widens at the
tablet breakpoint and wraps below it.
Measured, nothing overflowing, no header overrun, no clipped cell, no shrunken button:
540px once 40 / 208 / 146 / 146 recurring 123 / 108 / 131 / 62 / 116
1400px once 40 / 1033 / 146 / 146 recurring 871 / 185 / 131 / 62 / 116
Desktop gains from it as well: the checkbox column drops from 90px to 40 and Completed At
from 291 to 146, so the URL column picks up about 255px.
Covered by five tests in the Cypress layout suite. None of this is checkable in jsdom --
it is all resolved widths, and the central question is whether our `table-layout` beats the
one Mantine sets, which is exactly the part that failed silently.
69 suites / 1214 jest tests pass.
2026-08-12 10:08:55 -06:00
|
|
|
<Table.HeaderCell>URL</Table.HeaderCell>
|
review: the 375px phone this fix had not been measured on (#662)
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660.
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL
column got exactly 0 and the table overflowed again -- the same bug as before,
moved down from 540px. Widths are phone-first now, in col-* classes, widening
at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s" -- 169-188px
measured, against 124px of column. It shows the percent; the modal it opens
already lists speed, ETA and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung
into the URL column. 3em holds the checkbox and its padding.
* The Cypress fixtures were a raw <table>, so tableLayout would read 'fixed' even
with the selector that loses to Mantine -- the test could not fail for the reason
it claimed. They mount SortableTable, Table.HeaderCell onSort and a real
Checkbox now, and the header check measures the text rather than skipping cells
with no element child.
* Comments trimmed to what cannot be recovered from the code.
Fixing the first surfaced one more: once URL became the small column, its own header
overran -- "URL" and its arrow need 72px against 58 -- and a single word cannot wrap.
A header is clipped by its column as a last resort.
Measured at 375px: once 46/58/123/146, recurring 44/100/104/57/69, nothing
overflowing. 69 suites / 1214 jest tests pass.
The Cypress tests here are NOT verified: the component runner does not start in this
repo (see the separate cypress investigation), so every layout claim above rests on
direct measurement in Chrome, not on that suite.
* review: the 375px phone this fix had not been measured on
Answers the five findings on #660, and now runs against a component suite that can
actually execute (#661).
* Recurring's four fixed columns wanted 416px between them, so at 375px the URL got
exactly 0 and the table overflowed -- the same bug as before, moved down from 540px.
Widths are phone-first now, in col-* classes, widening at the tablet breakpoint.
* The in-progress button in Completed At carried "5 MBps / 3m44s", 169-188px against
124px of column. It shows the percent; the modal it opens already lists speed, ETA
and bytes, and the full text is on the button's title.
* The select column was 2.5em: 16.5px of content for a 22px checkbox, which hung into
the URL column. 3em holds the checkbox and its padding.
* The fixtures were a raw <table>, so tableLayout read 'fixed' even with the selector
that loses to Mantine -- the test could not fail for the reason it claimed. They
mount SortableTable, Table.HeaderCell onSort and a real Checkbox now.
* Comments trimmed to what cannot be recovered from the code.
Two defects the restored suite caught, neither of them findable before it ran:
* The elastic URL column ends up narrower than its own header -- "URL" and its arrow
need 72px against 58 -- and one word cannot wrap, so the column clips. A sized column
must fit its label; only the elastic one may clip. That is what the header test
asserts, per kind of column, rather than measuring text and calling it the label: the
first version measured the text alone, missed the sort arrow, and passed while the
button overran by 14px.
* Recurring's Control column was 4.5em, 70px of content for a 78px "Control". Sized
for the word rather than the button it holds: 5.2em.
At 375px: once 46/58/123/146, recurring 33/100/104/57/80, nothing overflowing and no
sized header clipped. The URL column there is 33px -- the accepted trade for keeping
every column on a phone.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
* review: a header assertion that stopped at the padding box
Three findings on #662.
* The sized-header check compared scrollWidth to clientWidth, which is the padding box,
so a label could overflow its content box into the padding and pass -- the same class
of miss the 4.5em Control failure was meant to close. It measures the label's longest
word (plus the sort arrow, where there is one) against the content box now.
That found two more columns tuned to their exact limit and clipping by a pixel:
Download Frequency wanted 79.4px of a 78.1px box, Completed At 82.3 of 81.9. Every
sized column now has margin over its own label.
* SortableTable stopped applying `width`, leaving dead keys at the Tags and Zim call
sites. Removed, so a column is sized one way. CollectionTable's `width` is NOT dead
-- it converts sixteenths to percentages -- so Channels, Docs, Playlists and Archive
keep theirs.
* Comments trimmed again: the percent button, the header clip, the ButtonGroup rule and
the Cypress helper.
336 component tests pass, 69 suites / 1214 jest tests pass.
* ui: a phone header short enough to leave room for the URL
Five full-length headers do not fit a phone. Sized so each held its own label, the
recurring URL column came out 20px -- narrower than one character and its ellipsis, a
column present but carrying nothing.
A long header carries both forms and `.label-*` shows one: Freq and Done below the tablet
breakpoint, Download Frequency and Completed At above it, where there is room. The mobile
widths are sized for the short word.
At 375px the URL column goes from 20px to 105px on the recurring table and 54px to 97px on
the once table. Nothing overflows, nothing clips, and every column stays.
336 component tests pass, 69 suites / 1214 jest tests pass, npm run build is clean.
2026-08-13 11:38:49 -06:00
|
|
|
<Table.HeaderCell className='col-frequency'>
|
|
|
|
|
{shortHeader('Freq', 'Download Frequency')}
|
|
|
|
|
</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell className='col-completed-plain'>
|
|
|
|
|
{shortHeader('Done', 'Completed At')}
|
|
|
|
|
</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell className='col-next'>Next</Table.HeaderCell>
|
|
|
|
|
<Table.HeaderCell className='col-control-row'
|
|
|
|
|
style={{textAlign: 'right'}}>Control</Table.HeaderCell>
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Row>
|
|
|
|
|
</Table.Header>
|
|
|
|
|
<Table.Body>
|
2024-11-02 15:14:02 -06:00
|
|
|
{downloads.map(i => {
|
|
|
|
|
return <RecurringDownloadRow
|
|
|
|
|
key={i.id}
|
|
|
|
|
fetchDownloads={fetchDownloads}
|
|
|
|
|
download={i}
|
|
|
|
|
onDelete={onDelete}
|
|
|
|
|
/>
|
|
|
|
|
})}
|
2026-07-30 13:10:51 -06:00
|
|
|
</Table.Body>
|
2023-09-07 20:13:36 -06:00
|
|
|
</Table>
|
|
|
|
|
} else if (downloads) {
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Panel>No downloads are scheduled.</Panel>
|
2023-09-07 20:13:36 -06:00
|
|
|
} else if (downloads === undefined) {
|
|
|
|
|
return <ErrorMessage>Unable to fetch downloads</ErrorMessage>
|
2022-09-29 12:02:09 -06:00
|
|
|
}
|
2026-07-30 13:10:51 -06:00
|
|
|
return <Placeholder lines={2}/>
|
2023-01-07 17:22:28 -07:00
|
|
|
}
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
export function DownloadsPage() {
|
2023-01-07 17:22:28 -07:00
|
|
|
useTitle('Downloads');
|
|
|
|
|
|
2023-08-08 13:42:55 -06:00
|
|
|
const {onceDownloads, recurringDownloads, pendingOnceDownloads, fetchDownloads} = useDownloads();
|
|
|
|
|
|
2024-04-16 10:14:47 -06:00
|
|
|
const pendingOnceDownloadsSpan = pendingOnceDownloads > 0 ?
|
2026-07-30 13:10:51 -06:00
|
|
|
<Label color='violet'>{pendingOnceDownloads}</Label>
|
2024-04-16 10:14:47 -06:00
|
|
|
: null;
|
2022-09-29 12:02:09 -06:00
|
|
|
|
|
|
|
|
return <>
|
|
|
|
|
<WROLModeMessage content='Downloads are disabled because WROL Mode is enabled.'/>
|
2026-03-12 20:10:57 -06:00
|
|
|
<DownloadWindowMessage/>
|
2026-07-29 14:40:58 -06:00
|
|
|
<DailyLimitMessage/>
|
2022-09-29 12:02:09 -06:00
|
|
|
<DisableDownloadsToggle/>
|
2026-02-20 14:37:58 -07:00
|
|
|
<CookiesLockedMessage/>
|
2023-01-07 17:22:28 -07:00
|
|
|
|
2023-08-08 13:42:55 -06:00
|
|
|
<Header as='h1'>Downloads {pendingOnceDownloadsSpan}</Header>
|
2023-01-07 17:22:28 -07:00
|
|
|
<OnceDownloadsTable downloads={onceDownloads} fetchDownloads={fetchDownloads}/>
|
2022-09-29 12:02:09 -06:00
|
|
|
|
|
|
|
|
<Header as='h1'>Recurring Downloads</Header>
|
2023-01-07 17:22:28 -07:00
|
|
|
<RecurringDownloadsTable downloads={recurringDownloads} fetchDownloads={fetchDownloads}/>
|
2022-09-29 12:02:09 -06:00
|
|
|
</>
|
|
|
|
|
}
|