Skip to content

feat(web): add a Home row to several library pages at once - #1897

Merged
Quick104 merged 6 commits into
feat/collections-revampfrom
feat/home-rows-library-copies
Oct 4, 2026
Merged

Quick104 merged 6 commits into
feat/collections-revampfrom
feat/home-rows-library-copies

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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 to feat/collections-revamp once 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

  • Add row, step 2: "Add to these library pages" chips sit between Row name and More options. The current page is a checked chip marked "this page" that can't be turned off; it stays in the tab order so a screen reader announces that the page is included. When other pages are picked, the button reads "Add to N pages" (counting this page) and the footer reads "Goes to the bottom of each page". While Hero banner is on, the other chips are off and disabled with "Turn off the hero banner to add this row to other pages.", and turning Hero on clears any picked pages.
  • ⋯ Add to other libraries… (between Move to bottom and Delete row…) opens a small dialog with the same chips. The current page shows as "already here" and isn't counted, so "Add to 2 pages" makes two copies. A copy keeps the row's type, title, config, item limit and on/off state, and is never a hero banner. On success a toast names the pages ("Added to TV Shows and Kids.") and focus returns to the row's ⋯ button.

Both send POST /api/v2/admin/sections/bulk with scope: "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 in library_ids and position. A new row goes to library_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:

  • A config with a positive library_id (editorial spotlight keeps one) also counts as naming a library. The plan checked only the library filter keys and generated_library_id.
  • Legacy Trakt rows are never offered, because the server refuses new Trakt rows.
  • An existing hero row can be copied. Its copies are regular rows, and the dialog says "The copies aren't hero banners; this page keeps its own." The plan's "Hero is off" rule applies to new rows only.
  • The changed-row check before copying an existing row is not in the plan.
  • Text the mockups don't draw: the dialog title "Add {title} to other libraries", its description, "Nothing changes on this page.", the changed-row message, and "Add to pages" while no page is picked.
  • The chips and the menu item appear only when there is at least one other library page.
  • Adding a new row to several pages shows no toast, the same as a single add; the new row is highlighted instead.
  • The chips list every library page whatever its type, so a TV-only row kind can be offered for a Movies page. The plan sets no rule for this, the bulk endpoint accepts it, and the old "Apply to all libraries" listed every library too.

Validation

  • Web: make test-web (784 files, 7211 tests passed), pnpm run lint (0 errors; eslint reports nothing in changed files), format:check, build, tsc -b and budget:check pass.
  • Tests cover which row kinds can be copied and each config key that names a library; the bulk body against the recorded single-create bodies for every copyable preset; a new row sent to this page and the picked pages, then found and highlighted; an existing row copied to the picked pages only, with 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.
  • Hygiene: make verify-local-paths passes.
  • Not run: the Go gate and the contract verify targets, because this diff changes no Go, contract or generated input. No browser check was run against a build, and Curated home sections — Web admin #1141 C1 has not been walked with library copies.

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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent checked the diff against the approved design and the planned scope, checked which server config keys name a library, re-ran the focused tests, and ran the new tests against the base branch's code to confirm they catch the change. It found no blockers, one minor problem and three nits. Three are fixed: the locked current-page chip was natively disabled, which took it out of the tab order so keyboard and screen-reader users never heard that the page was included; the copy dialog's button read "Add to 0 pages" with nothing picked; and an optional adapter method had no caller. The fourth, that the chips offer every library page whatever its type, is not a defect against the plan and is listed under Approach for a decision.

🤖 Generated with Claude Code

Note

Add multi-library row creation and copying to Home rows admin

  • Administrators on a library page can now add a new row to that library and selected other libraries in a single bulk request, using the new destination chip selector in RowForm (RowForm.tsx, LibraryPageChips.tsx).
  • Existing rows on a library page get an Add to other libraries menu 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).
  • Copy eligibility is centralized in canCopyToLibraries in 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.
  • Copying is capped at the 100-page bulk request limit, and the current page is always included and cannot be toggled off.
  • Behavioral change: turning a new row into a hero row clears its selected additional destinations; existing-row copies fail with a conflict state when the row changed on the server since it was displayed.

Macroscope summarized d58313a.

Quick104 and others added 3 commits October 4, 2026 05:17
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]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 74b1625b-482b-455e-a06e-ba570131a1de

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T12:57:24.620326Z 907114a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +42 to +45
return (
!PAGE_BOUND_TYPES.has(row.sectionType) &&
!namesLibrary(row.config) &&
!isTraktConfig(row.config)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +64 to +67
onChange(
next === true
? [...selectedIds, page.id]
: selectedIds.filter((selected) => selected !== page.id),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Quick104 and others added 2 commits October 4, 2026 08:46
…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]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 13d8d88 on #1913 (follow-up for late findings)

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

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

Base automatically changed from feat/home-rows-collection-rule-rows to feat/collections-revamp October 4, 2026 14:32
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]>
@Quick104
Quick104 merged commit 155a407 into feat/collections-revamp Oct 4, 2026
14 checks passed
@Quick104
Quick104 deleted the feat/home-rows-library-copies branch October 4, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant