Repository navigation
feat(web): add and edit ready-made Home rows in one dialog - #1883
Conversation
Admins added rows through a recipe gallery overlay, a separate config drawer and a type select, and edited them in a sheet that showed raw recipe settings. One Add row button now opens a two-step dialog: pick a kind of row by group (with search and variant chips), then see a live preview, pick the variant, name the row and open More options. Edit row uses the same form with Shows · Change and Delete row…, and after a 412 Reload row keeps the user's changes and names what changed elsewhere. Variants are inferred strictly and change only their own config keys, so opening or renaming a row never rewrites its config. New rows send the gallery's create body plus position max+1 so they land at the bottom. Collection and rule rows still open the older editor until the dialog gains their pickers. The unreachable Trakt creation path goes with the gallery. The launch CSS grows with the dialog's utility classes, so the bundle budget moves up by 1.5 KB. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…er editor Changing an existing row to a collection or rule row opened the older editor from the stored row, so a name, title count or hero change made in the dialog was lost, though the Change step says they stay. A 412 reload in that editor also dropped the picked kind and reopened the row's old one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…escribes Continue Reading rows lost Change, so an admin could only delete them; only legacy Trakt rows must keep their kind. A legacy single-holiday seasonal row now reads "Seasonal picks (Christmas only)" and its holiday list starts from that holiday, as the old editor did, instead of offering only the radios that replace it. The holiday list no longer offers Family movie night, its own variant, which flipped the row to that variant mid-edit. A list with no holiday can't be saved: the server refuses it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tles be retyped On phones the picker now uses the mobile mockup's copy: a description that carries the bottom-of-page note the footer has no room for, and a short "Search rows" placeholder that isn't cut off at 390 px. Number of titles snapped back whenever it was briefly empty or out of range, so a new value took select-all and a valid first digit. It now holds what is typed and keeps the last whole number from 1 to 100. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A double click in jsdom re-renders between clicks, so the disabled button alone stopped the second one and the test passed without the guard. Two clicks in one tick reach the handler twice; only the guard keeps it to one POST. 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: 1fd3c7e7c7
ℹ️ 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".
| const [original, setOriginal] = useState<RowDraft | null>(() => | ||
| initialSession ? draftFromRow(initialSession.row, catalog) : null, | ||
| ); |
There was a problem hiding this comment.
Recompute the edit draft when the catalog arrives
If the sections request finishes before the recipe-catalog request, an admin can open Edit row while catalog is still undefined. This initializer then permanently records titleFollowsVariant as false; when the catalog later appears and the admin changes a default-named row to another kind or variant, pick() incorrectly preserves the old name instead of adopting the selected preset's name. Initialize only after the catalog settles, or reconcile the draft when it becomes available.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f43c3a1. When the catalog arrives after Edit row opened, the dialog recomputes whether the stored name is still the variant's preset name and updates the draft (unless the name was already edited). Test: "renames a row that kept its preset name when the kinds of rows load after it opened".
| const next = await adapter.reloadEdit(session); | ||
| if (!mounted.current) return; | ||
| const upstream = draftFromRow(next.row, catalog); | ||
| const merged = mergeReloadedDraft(original, draft, upstream); | ||
| setSession(next); | ||
| setOriginal(upstream); | ||
| setDraft(merged.draft); |
There was a problem hiding this comment.
Route reloaded collection rows through the collection editor
When another admin changes this row to a bridged kind such as collection while the dialog is open, a rejected save followed by Reload installs that collection draft directly into this form. This form has no collection selector, and the subsequent save calls buildRowUpdateRequest with an empty selectedCollectionId, replacing the stored collection reference with library_collection_id: "". Detect bridged kinds after reload and hand the refreshed session to onBridge instead of keeping it in this editor.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f43c3a1. After Reload, if the merged draft's kind is a bridged kind (collection, rules, genre, curated list), the dialog hands the refreshed session to onBridge with the draft's name, Number of titles and hero setting instead of keeping it in this form, so it is never saved with an empty collection reference. Test: "hands a row reloaded as a collection to the older editor instead of saving it here".
…t/home-rows-dialog # Conflicts: # web/src/pages/AdminHomeRows.tsx
…oads A row opened before the kinds of rows loaded never learned that its name was still the preset's, so picking another variant or kind kept the old name. The dialog now works that out when the catalog arrives. Reloading after a refused save could also pull in a row someone changed into a collection or rule row; saving that from this form would have cleared its collection. Those rows now go to the older editor, carrying the name and More options. 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: f43c3a1048
ℹ️ 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".
| const fromPerson = ["director", "actor", "studio"].includes(String(config.subject_type)); | ||
| return fromPerson | ||
| ? { ...rest, subject_type: option.values.subject_type } |
There was a problem hiding this comment.
Keep spotlight variants valid when switching subjects
When an existing spotlight is pinned (auto_rotate: false with a subject), switching between Director, Actor, or Studio enters this branch, drops subject, and preserves auto_rotate: false. The resulting config has no subject, so editorialSpotlightRecipe.Validate rejects the save with “subject is required when auto_rotate is false.” Preserve the subject or enable rotation when applying the new variant.
Useful? React with 👍 / 👎.
Problem
Related issue: #1137
Validation tasks: changes #1141 C1 (rows are added and edited in the new dialog and land at the bottom of the page; adding one row to several library pages at once is unavailable until the library-copies PR; includes the #586 weekly trending label); changes #1142 C1 (a newly added row renders at the bottom of Home instead of near the top); reaches #1137 AC1 and AC2 (the #585 seasonal title check)
Stacked on #1882 (the Home rows list), so this targets
feat/home-rows-rowlist. It retargets tofeat/collections-revamponce #1882 merges.Admin > Home rows has two ways to add a row. "Add from Gallery" opens a recipe gallery, a settings drawer for the picked recipe, and on library pages an "Apply to all libraries" dialog. "+ Add Section" opens a drawer with a type dropdown, and editing a ready-made row uses that same drawer. Neither shows which titles the row will hold, and both expose raw recipe settings such as a "Subject type" select and an "Anchor item" ID box. A single create also sends no position, so a new row lands near the top of the page. This PR replaces both with one Add row dialog from the approved Home rows design: pick a kind of row, see a live preview, choose a variant, name it. Edit row… on a ready-made row opens the same form. Collection and rule rows keep the old editor (
SectionEditorDrawer) until the next PR. The API,section_typevalues, recipe IDs and preset keys don't change.Approach
Step 1 lists the kinds of row in six groups (Keep watching, What's new, Popular, Picked for you, Moods & themes, Collections & rules) with counts, a search that also matches words like "4K", "Ghibli" and "Christmas", and cards whose variant chips jump straight to that variant. A card for a kind already on the page carries an "On {page}" tag. Editor's Picks, genre and award rows are not offered for new rows; existing ones stay editable. Step 2 shows a live preview, the variant choice, Row name and a collapsed More options box (Number of titles, Hero banner). The row name follows the variant until the admin types their own. Edit row… shows the same form with a "Shows: … [Change]" line and Delete row… in the footer. Below 1024 px the dialog is a bottom sheet with one-column cards and group chips. The group list works as keyboard tabs, variants are radio cards, Escape closes from either step, Back keeps the search, and focus returns to Add row or the row's ⋯ button.
Saves keep stored data as it is unless the admin changes it:
position= highest position + 1. Collection and rule rows created through the old editor also send that position.themekey keep it on a rename and name their holiday, for example "Seasonal picks (Christmas only)".The preview asks the admin preview endpoint for 7 titles, 400 ms after the last change, and keeps the last result on screen while the next one loads. That endpoint returns no poster URLs, so the strip shows blurred thumbhash tiles with titles. One component draws the tiles and already shows a poster when
poster_urlis present, so it can switch to posters if the server starts sending them.Collection, rule, genre and Editor's Picks rows still open the old editor. When Change turns an existing ready-made row into a collection or rule row, the old editor opens with the name, Number of titles and hero setting from the dialog. The gallery, its settings drawer, the "Apply to all libraries" dialog and the page's unreachable Trakt row creation code are removed from the admin page; the server already refuses new Trakt rows. Settings > Home Screen still uses the gallery until its own PR. Restore Defaults, Delete All and Delete Selected stay in the header for now.
Differences from the approved design, for sign-off:
Validation
make test-web(765 files; 6993 passed, 3 expected failures already in the base),pnpm run lint(0 errors; the three warnings in a changed file are on re-export lines this PR doesn't touch),format:check,build(includestsc -b) andbudget:checkpass.position; that renames keep config byte for byte; that the variant tables match the recipe catalog fixture; the picker groups, counts and search; keyboard use and focus return; the phone layout; Reload row after a 412; and the hand-off to the old editor. Removingposition, merging the stored config back into edits, removing the double-submit guard, or dropping the picked kind on a 412 reload in the old editor each makes a test fail.make verify-local-pathspasses.Risks
No API,
section_type, recipe ID or preset key changes, and hero behavior is unchanged. Stored config changes only when an admin picks a different variant: that variant's keys are written and the old variant's keys are dropped (for example Spotlight'ssubject, its rotation keys when switching to The 80s, or the olderthemekey on a seasonal row). The Anchor item field for Because you watched is gone from the form; an existing value stays in the config and keeps working. The admin-only recipe gating on Settings > Home Screen is untouched. silo-apple, silo-android and jellycompat need no change.Until the library-copies PR lands, an admin can't add one row to several library pages at once; they add it to each page separately. That PR should merge right after this one on
feat/collections-revamp.New rows send
position. Two admins adding a row to the same page at the same moment can get the same position; rows with the same position sort by ID, so both still show.The holiday name fields keep the old editor's placeholder,
Name in season (defaults to "Christmas"). #585 reports that the server doesn't apply that default, and this PR doesn't change that.The launch bundle grows by 762 B brotli, all in the launch CSS from the dialog's Tailwind classes; the dialog's JavaScript is in the lazy-loaded admin page chunk.
perf-budget.jsongoes from 319852 to 321326.The user manual describes the gallery and the old editor. A siloserver.org issue covering the Add row dialog, plain row names, new rows at the bottom and the removed Anchor item field, along with the rest of the Home rows changes, is drafted and not filed yet.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Add unified
AddRowDialogfor creating and editing admin Home rowsReplaces the old recipe-gallery/bulk-creation workflow on the admin Home rows page with a two-step dialog: pick a row kind (grouped, searchable, with variant chips), then configure it with kind-specific fields, live preview, and a debounced preview query.
RowChangedErroron 412).initialTypeand carried title, item limit, and hero settings.Add Sectionbutton is nowAdd row; created rows are appended at the bottom of the page and highlighted for 2.5 seconds; the adapter capability fieldcapabilitieswas renamed toserverCapabilitiesin useAdminHomeRows.ts.Macroscope summarized f43c3a1.