Repository navigation
feat(web): add a Home row to several library pages at once - #1897
Conversation
On a library page, step 2 of Add row now offers "Add to these library pages" chips, and a library row's menu offers "Add to other libraries…". Both send one POST /admin/sections/bulk, so each page gets its own copy at its bottom in one transaction. Copies are offered only for ready-made kinds whose settings name no library, never on Home, and never as a second hero banner. An existing row's copy leaves its own page alone and is refused when the row changed since the page loaded. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The locked "this page" chip was natively disabled, so keyboard and screen-reader users tabbing through the group never heard that the current page is included and counted. It now stays focusable with aria-disabled and never toggles, as the design marks it. The copy dialog's confirm button reads "Add to pages" until a page is picked instead of "Add to 0 pages". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…pter Only the admin page copies rows to other libraries, and its adapter already declares the method, so the optional shared member and the unread created count go. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d602b24ac3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return ( | ||
| !PAGE_BOUND_TYPES.has(row.sectionType) && | ||
| !namesLibrary(row.config) && | ||
| !isTraktConfig(row.config) |
There was a problem hiding this comment.
Restrict copies to compatible library types
When the source is a typed default row, this predicate still allows the copy because configurations such as { media_scope: "movie" } contain no library ID. The dialog then offers every library page, so copying the default “Recently Added Movies” row to a Series library preserves the movie filter and creates an empty or misleading row there. Account for destination library types, or normalize page-local media settings before sending the same config to every target.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 907114a. A row whose config sets a media_scope (like the default "Recently Added Movies") is now offered only library pages of the current page's library type, in both the Add row chips and "Add to other libraries…". The create path filters the picked pages the same way. Covered by copyTargetPages/libraryCopyIds unit tests and a page test where a movies-only row skips the TV library and a shows-only row with no other TV library gets no copy option.
| onChange( | ||
| next === true | ||
| ? [...selectedIds, page.id] | ||
| : selectedIds.filter((selected) => selected !== page.id), |
There was a problem hiding this comment.
Enforce the bulk API limit in the library selector
On servers with more than 100 libraries, this selector permits an arbitrary number of targets even though bulkCreateAdminSections rejects requests containing more than 100 IDs. Selecting 100 other pages while adding a new row already sends 101 IDs because the current page is prepended, causing the entire action to fail after the user finishes selecting pages. Cap the selectable targets appropriately or split requests without exceeding the endpoint limit.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 907114a. The library page chips now stop at the bulk endpoint's 100-id limit: 99 other pages when adding a row (this page is in the same request) and 100 in "Add to other libraries…". Once full, the unpicked chips are disabled and a note says a row can go to up to 100 pages at once. Page tests cover both dialogs with 101+ libraries and check the request carries exactly 100 ids.
…ows' into feat/home-rows-library-copies # Conflicts: # web/src/lib/homeRows/payloads.golden.test.ts
A default row such as "Recently Added Movies" keeps media_scope "movie", so copying it to a TV library made an empty row there. Rows set to one kind of title now go only to library pages of the current page's type. The bulk create takes at most 100 library ids, so picking more pages made the whole add fail. The page chips now stop at that limit and say so. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 907114a00d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pages: readonly LibraryPage[], | ||
| currentId: number, | ||
| ): LibraryPage[] { | ||
| if (typeof config.media_scope !== "string" || config.media_scope === "") return [...pages]; |
There was a problem hiding this comment.
Restrict modality-specific rows to compatible libraries
The new compatibility filter is fresh evidence beyond the earlier comment, but this early return treats every config without media_scope as portable. For example, Continue Listening stores {continue_type: "listening"}, and next_in_series is audiobook-only with an empty config, so copying either from an audiobook library offers Movies and Series destinations where the destination library filter leaves the new row empty. Compatibility needs to account for continue_type and section-type-specific modalities, not only media_scope.
Useful? React with 👍 / 👎.
|
Web admin C1 is currently Not run, so this PR does not invalidate a recorded pass. It adds library-page copy controls to Add row and a new “Add to other libraries…” menu path; include both in the post-merge C1 run and record the tested build. The current Validation tasks mapping to #1141 C1 and #1137 AC1 is accurate. Suggested fix: No diff; cover both new flows in C1 after merge. Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
The two tests that tick 100 library pages queried each checkbox by role and name. Role queries recompute every accessible name in the group, so the tests ran past CI's 30-second timeout. Label lookups find the same checkboxes far faster. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #1137
Validation tasks: changes #1141 C1 (on a library page, Add row can also put the new row on other library pages, and a row's ⋯ menu can copy it to other library pages); reaches #1137 AC1
Stacked on #1895 (collection and rule rows), so this targets
feat/home-rows-collection-rule-rows. #1895 sits on #1893, #1891, #1889, #1885, #1884, #1883 and #1882. It retargets tofeat/collections-revamponce those merge.The old Sections page let an admin add a row to several libraries at once with "Apply to all libraries". The Add row dialog that replaced it (#1883) has no such option, so an admin who wants the same row on Movies, TV Shows and Kids has to add it on each page, and there is no way to put an existing row on another library page. This PR adds both, as the approved Home rows design draws them: "Add to these library pages" in Add row, and "Add to other libraries…" in a row's ⋯ menu. Both appear only on library pages, never on Home.
Approach
Both send
POST /api/v2/admin/sections/bulkwithscope: "library", which creates every copy in one transaction at the bottom of each page. The body comes from the same builders as a single create and differs from a single library-page create only inlibrary_idsandposition. A new row goes tolibrary_ids: [this page, …picked pages]. The bulk response returns no IDs, so the page finds the new row by comparing row IDs before and after the refetch, then highlights it. A copy of an existing row goes to the picked pages only, so nothing new appears on the current page. Before sending, the page re-reads the row; if it changed since the page loaded, the dialog says so and nothing is written, the same check the row switch and hero toggle run. Both writes go through the page's one-write-at-a-time queue, so a double click creates once.Copying is offered only when one config fits every page, and the same check decides whether the chips and the menu item appear. It isn't offered for collection, custom_filter, admin_curated_list, genre or award_winners rows, for a config that names a library, or for legacy Trakt rows. Components read
capabilities.libraryCopies, which is on for library pages and never depends on the account role.Differences from the plan and the approved design, for sign-off:
library_id(editorial spotlight keeps one) also counts as naming a library. The plan checked only the library filter keys andgenerated_library_id.Validation
make test-web(784 files, 7211 tests passed),pnpm run lint(0 errors; eslint reports nothing in changed files),format:check,build,tsc -bandbudget:checkpass.featured: false, its on/off state kept and this page's row count unchanged; hero rows; a row changed elsewhere; chips and the menu item missing on Home and for collection rows; and the locked chip's keyboard focus, Escape and focus return. The new tests fail when run against the base branch's code.make verify-local-pathspasses.Risks
A copy appears on pages the admin isn't looking at. The chips' help text says each page gets its own copy that can be changed or removed there; copies are separate rows, so editing one leaves the others alone.
If another admin adds a row to the same page at the same moment, the highlight after a multi-page add can land on their row. Nothing else depends on which row is highlighted.
No API,
section_type, recipe ID, preset key, layout export/import or gating change, and hero behavior is unchanged. Copies are ordinary rows, so silo-apple, silo-android and jellycompat need no change.The user manual doesn't describe adding a row to several library pages from Home rows. A siloserver.org issue covering this, along with the rest of the Home rows changes, is drafted and not filed yet.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Add multi-library row creation and copying to Home rows admin
RowForm(RowForm.tsx, LibraryPageChips.tsx).Add to other librariesmenu action that opens a copy dialog; the adapter sends one bulk-copy request, preserves title, item limit, configuration, and enabled state, and always clears the hero flag on copies (AddToOtherLibrariesDialog.tsx, AdminHomeRows.tsx).canCopyToLibrariesin bulkCopy.ts: page-bound rows, rows whose configuration references library IDs or filters, and legacy Trakt rows are rejected. Media-scoped rows can only target pages of the same library type.Macroscope summarized d58313a.