Playlist editor: add from library in two steps (file, then pages) with a page range #208

Closed
opened 2026-11-15 09:02:07 +00:00 by vivy · 3 comments
Owner

Product owner, 2026-11-15 (GRI-2051): "Split up the 'add from library' so that you first select which file and then the pages. If there are 10 files with 50 pages it will be a nightmare. Also add a simple range option."

Today. PlaylistEditorScreen.tsx (around line 416) has one <select> "Add from the library" that lists every media item and, under each document, every page. With 10 documents of 50 pages that is 500+ options in one list.

Wanted — two steps.

  1. Pick a file. A searchable list of library items (filter by name and by type: image, video, PDF, PowerPoint, URL), with a thumbnail.
  2. Pick pages — only for a multi-page item (PDF, PowerPoint). Default: all pages. A grid of page thumbnails with checkboxes, plus a text field for a page range:
    • 1-5,8-9 → pages 1 to 5 and 8 to 9
    • * (or empty) → all pages
    • 10- → page 10 to the last page
    • spaces ignored; invalid input (0, 7-3, a page beyond the end, letters) is refused with a message that says which part is wrong.
      The field and the checkboxes stay in sync, and the dialog shows "12 of 50 pages selected" before adding.
      Pages are added in document order, as one item per page (today's model), so the per-page time and "Skip this page" keep working.

This is the same range syntax as a print dialog, which is what non-technical users already know — not a regular expression. The parser is a pure function with unit tests for each case above.

Acceptance. Adding pages 1-5 and 8-9 of a 50-page PDF takes one file pick, one typed range and one click.

Product owner, 2026-11-15 (GRI-2051): *"Split up the 'add from library' so that you first select which file and then the pages. If there are 10 files with 50 pages it will be a nightmare. Also add a simple range option."* **Today.** `PlaylistEditorScreen.tsx` (around line 416) has one `<select>` "Add from the library" that lists every media item and, under each document, every page. With 10 documents of 50 pages that is 500+ options in one list. **Wanted — two steps.** 1. **Pick a file.** A searchable list of library items (filter by name and by type: image, video, PDF, PowerPoint, URL), with a thumbnail. 2. **Pick pages** — only for a multi-page item (PDF, PowerPoint). Default: all pages. A grid of page thumbnails with checkboxes, plus a text field for a **page range**: - `1-5,8-9` → pages 1 to 5 and 8 to 9 - `*` (or empty) → all pages - `10-` → page 10 to the last page - spaces ignored; invalid input (`0`, `7-3`, a page beyond the end, letters) is refused with a message that says which part is wrong. The field and the checkboxes stay in sync, and the dialog shows "12 of 50 pages selected" before adding. Pages are added in document order, as one item per page (today's model), so the per-page time and "Skip this page" keep working. This is the same range syntax as a print dialog, which is what non-technical users already know — not a regular expression. The parser is a pure function with unit tests for each case above. **Acceptance.** Adding pages 1-5 and 8-9 of a 50-page PDF takes one file pick, one typed range and one click.
Member

Implemented the two-step picker in frontend-web: AddFromLibraryDialog (pick a file — searchable, filtered by type Image/Video/PDF/PowerPoint/Web page, with a thumbnail — then, only for a multi-page file, pick pages), backed by a pure parsePageRange/formatPageRange in src/pageRange.ts (unit-tested for every case in the issue: 1-5,8-9, */empty, 10-, spaces ignored, 0, 7-3, beyond the end, letters). Pages are still added one PlaylistItem per page in document order, so the existing per-page duration field and the cogwheel page-overrides on an already-added document item are unaffected.

One scope note: the server never tags a row literally pptx (crates/server/src/media/handlers.rs's classify) — a PowerPoint upload becomes document (slide-image fallback) or video (converted), same as PDF/video. So the "PDF" vs "PowerPoint" filter is a frontend-only heuristic on the filename extension, not an API field. Flagging this in case the type filter matters enough to want a real field later; not blocking.

frontend-web: prettier, oxlint --deny-warnings, tsc, vitest all green (94/94, including a new pageRange.test.ts and AddFromLibraryDialog.test.tsx, plus the two PlaylistsScreen.test.tsx cases updated for the new two-step flow). Full ./scripts/local-gates.sh running now; will push once green.

Implemented the two-step picker in `frontend-web`: `AddFromLibraryDialog` (pick a file — searchable, filtered by type Image/Video/PDF/PowerPoint/Web page, with a thumbnail — then, only for a multi-page file, pick pages), backed by a pure `parsePageRange`/`formatPageRange` in `src/pageRange.ts` (unit-tested for every case in the issue: `1-5,8-9`, `*`/empty, `10-`, spaces ignored, `0`, `7-3`, beyond the end, letters). Pages are still added one `PlaylistItem` per page in document order, so the existing per-page duration field and the cogwheel page-overrides on an already-added `document` item are unaffected. One scope note: the server never tags a row literally `pptx` (`crates/server/src/media/handlers.rs`'s `classify`) — a PowerPoint upload becomes `document` (slide-image fallback) or `video` (converted), same as PDF/video. So the "PDF" vs "PowerPoint" filter is a frontend-only heuristic on the filename extension, not an API field. Flagging this in case the type filter matters enough to want a real field later; not blocking. `frontend-web`: prettier, oxlint --deny-warnings, tsc, vitest all green (94/94, including a new `pageRange.test.ts` and `AddFromLibraryDialog.test.tsx`, plus the two `PlaylistsScreen.test.tsx` cases updated for the new two-step flow). Full `./scripts/local-gates.sh` running now; will push once green.
Member

Pushed and opened pull request #222 (dev <- feature/GRI-2074-playlist-add-from-library-pages). Local ./scripts/local-gates.sh was green (frontend-web prettier/oxlint/tsc/vitest 94/94, cargo workspace, cargo-deny). Forge CI is now running; will report the verdict here.

Pushed and opened pull request #222 (dev <- feature/GRI-2074-playlist-add-from-library-pages). Local `./scripts/local-gates.sh` was green (frontend-web prettier/oxlint/tsc/vitest 94/94, cargo workspace, cargo-deny). Forge CI is now running; will report the verdict here.
Member

Addressed the PR #222 review comments: added an explicit 'Add whole document' button in the pages step (so a multi-page document can still be added as one item and keep the page-overrides cogwheel / Skip this page), disabled Add while the typed range is invalid, and added loading=lazy to the page thumbnails. Added a test for each of the first two behaviors; frontend-web check (prettier/oxlint/tsc/vitest) is green at 98/98 total (7 in this file). Pushed to PR #222 (78a4e8f). Running full local-gates.sh now before pinging the CTO for re-review.

Addressed the PR #222 review comments: added an explicit 'Add whole document' button in the pages step (so a multi-page document can still be added as one item and keep the page-overrides cogwheel / Skip this page), disabled Add while the typed range is invalid, and added loading=lazy to the page thumbnails. Added a test for each of the first two behaviors; frontend-web check (prettier/oxlint/tsc/vitest) is green at 98/98 total (7 in this file). Pushed to PR #222 (78a4e8f). Running full local-gates.sh now before pinging the CTO for re-review.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage#208
No description provided.