Repository navigation
feat(web): show Home rows as one list with switches and a row menu - #1882
Conversation
Admin Home rows was a table with Featured and Enabled columns, Home/Library tabs and a library select. It is now the approved one-list layout: page pills for Home and each library (deep-linkable with ?page=), one line per row with a plain sentence and title count, an on/off switch that collapses off rows to a dashed line in place, and a ⋯ menu with Edit row…, hero banner, Move to top/bottom and Delete row…. The list components live in components/homeRows and read only a surface adapter, so Settings > Home Screen can reuse them. The admin adapter runs switch, hero and reorder writes one at a time, reads each row before a quick action and refuses to write when it changed elsewhere, and keeps reordering and page switching disabled until the refetch after each write lands, since any row write bumps the version a reorder is checked against. Keyboard reorder announces rows by title, touch drags start from the grip after a short press, and focus returns to a neighbour's menu after a delete or move. Adding, editing, Restore defaults and bulk delete still use the existing dialogs and header buttons until the follow-up PRs replace them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
At 390 px the 74 px art column and the hero tag next to the name left the row title no width at all. Phones now get a 48 px art column, and the hero tag moves onto the description line, as the mobile mockup draws it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Delete, edit, add and restore ran outside the list's write queue, so right after a delete the list still offered a reorder against the old page version and it failed with a conflict. Every admin row write now carries one mutation key; the list stays pending while any of them runs and until its refetch lands, and Restore Defaults waits for the same fence. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Turning a row off and back on quickly queued two writes. When the first finished it cleared the row's on-screen value, so the row snapped back to off until the second write landed. Only the newest toggle of a row and field now clears that value. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A Home rows link to a library page waits for the library list before it reads rows. If that list failed to load, the page stayed on "Loading rows…" with every action disabled. It now shows the read error, and Reload rows retries the libraries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The keyboard reorder test used a version that never changed, so it could not tell the version captured at pickup from the current one, and nothing checked the 200 ms press-and-hold that keeps touch swipes scrolling. Both are now asserted; the delay constant is no longer exported. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The default "Top Rated Movies" and "Recently Released Episodes" rows have no
rules, so the list called them "All movies" and "All episodes". A rule row
with no rules now says how it is ordered ("All movies, highest rated
first"), and a library page's Recently added row names what it holds
("Newest movies in this library"), as in the approved design.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The list's panel and the list inside it both carried "Rows on Home", so a screen reader announced the same name for a region and then for the list. Only the list keeps the name now. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The new list replaced the only callers of useReorderSections and of the library, collection and on/off badges in SectionSummaryBadges. The row kind catalog stays for the Add row picker and now has its own test. 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: ce79756853
ℹ️ 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".
| onChange={adapter.setPage} | ||
| disabled={adapter.pending} |
There was a problem hiding this comment.
Cancel stale snapshots when switching pages
The page switcher remains enabled while snapshotLoading is true because it only observes adapter.pending. If an admin starts Edit, Delete, bulk delete, or Restore Defaults and switches pages before the snapshot request finishes, snapshotRequest is not incremented, so the old request can open a dialog on the new page and a confirmation can update, delete, or restore rows from the previous page. Disable page switching during snapshot reads or invalidate pending snapshots when the page changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in ce353ad. Changing pages now invalidates any pending Edit, Delete, bulk delete, or Restore Defaults read, so a read that finishes on another page no longer opens its dialog. A new test covers Delete, Edit, and Restore Defaults: it switches pages mid-read and checks that no dialog opens and nothing is written.
| } catch (error) { | ||
| if (isStale(error)) setConflict({ scope: "row", rowId: id }); | ||
| else toast.error(adminSectionMutationMessage(error, "Could not save this row")); | ||
| } finally { |
There was a problem hiding this comment.
Reconcile quick actions after transport failures
When the server applies the PATCH but the connection drops or the response body is truncated, updateAdminSection rejects even though the row changed. This catch path only reports an error and then clears the optimistic value, leaving the UI on the old state; the next action also sees the server snapshot differ and raises a conflict. Treat non-definitive transport failures as an unknown outcome and refetch the list before settling the displayed value.
AGENTS.md reference: AGENTS.md:L13-L18
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in e264a94. When a quick action fails without a server answer (anything other than a problem response, such as a dropped connection or a cut-off body), the page now rereads the list before clearing the optimistic value. The row then shows what the server holds, and the next action on it does not report a false conflict. A new hook test applies the PATCH, drops the response, and checks both.
The page switcher stays usable while an Edit, Delete, bulk delete or Restore Defaults read is in flight. A read that finished after the admin moved to another page still opened its dialog there, so a confirmation could change rows on the page the admin had left. Changing pages now invalidates any pending read. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
If the connection drops or the response body is cut off after the server applied a switch or hero change, the row went back to its old value on screen and the next action on it reported a conflict. A failure without a server answer now rereads the page before the row's value settles. 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: e264a9417b
ℹ️ 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".
| } else { | ||
| setDraft(null); | ||
| toast.error(adminSectionMutationMessage(error, "Could not move this row")); |
There was a problem hiding this comment.
Re-read the order after an ambiguous reorder failure
When the reorder PUT is applied but its response is lost or truncated, this branch clears the draft and only shows a toast, leaving the cached rows and ETag at the previous order. The row therefore snaps back in the UI, and the next reorder receives a 412 even though the first change succeeded. Treat transport failures as an unknown outcome and refetch the current list—or retain a conflict requiring reload—before clearing the draft.
AGENTS.md reference: AGENTS.md:L73-L75
Useful? React with 👍 / 👎.
Problem
Related issue: #1137
Validation tasks: changes #1141 C1 (reorder, on/off, hero and delete now happen in the list and its row menu, and each row is described in a sentence instead of recipe badges); reaches #1137 AC1
Admin > Home rows shows each row as a table line with a recipe badge, an On/Off badge and pencil and trash buttons. To turn a row off or make it the hero banner, an admin has to open the full editor drawer, and the table doesn't say what a row will show. This PR replaces the table with the list from the approved Home rows design: one line per row with a description, an on/off switch and a ⋯ menu. Adding and editing rows, Restore Defaults and bulk delete still use today's dialogs and header buttons; later PRs in the series replace them. The API and saved data don't change.
Approach
Pills switch between Home and each library page, and a count such as "9 rows · 8 on" shows for the current page. The selected page is in the address as
?page=homeor?page=<libraryId>, so a link can open a library page; an unknown value opens Home. Each row has a drag handle, an icon for its kind of row (posters come in a later PR), its name, a yellow "Hero banner" tag on the hero row, a sentence built from its type and settings ("The next episode of every show each viewer follows · 20 titles"), an on/off switch and a ⋯ menu.An off row collapses to a dashed line, "{title} is off. Nobody sees this row.", with the switch in the same place, so keyboard focus stays on it while the row collapses and expands. The ⋯ menu has Edit row… (the existing drawer), Use as hero banner or Stop using as hero banner, Move to top, Move to bottom and Delete row…. Delete opens a new confirmation dialog that keeps the warning about managed collections. Rows move by mouse, by touch after a 200 ms press on the handle, and by keyboard (Space, arrow keys, Space), and the screen-reader announcements name the row. After a move, focus goes to the moved row's ⋯ button; after a delete, to the next row's ⋯ (the previous row's for the last row, or Add Section when none are left). Library pages show the design's note that the rows sit above the library grid.
The list components in
web/src/components/homeRows/read onlyHomeRowsAdapter(web/src/lib/homeRows/types.ts), never the account role.useAdminHomeRowsis the admin implementation. The profile wording is already there so Settings > Home Screen can use the same components in a later PR.Writes from the list follow the existing version checks:
The old page tests move with the page to
AdminHomeRows.*.test.tsx. The concurrency cases (412 on reorder, a refresh during a pending reorder, the page held while a reorder is pending, a failed first read, delete targets) now drive the menus and pills instead of the pencil, trash and tabs. The table row component anduseReorderSectionshad no remaining callers and are removed.Validation
make test-web(762 files; 6938 passed, 3 expected failures already in the base),tsc -b,pnpm run lint(0 errors; the one warning in a changed file is on a line this PR doesn't touch),format:check,buildandbudget:checkpass.?page=links, the changed-elsewhere banner, write ordering, reordering held after writes from the old dialogs, and the error shown when libraries fail to load. Removing the row comparison, the wait for the refetch, the kept order on 412,touch-none, the 200 ms delay or the version captured at drag start each makes a test fail.make verify-local-pathspasses.Risks
No API, stored data,
section_typevalue, recipe ID or preset key changes. The hero menu item sends the samefeaturedfield as the drawer, and hero behavior is unchanged. The gallery's admin-only recipe gating is untouched. silo-apple, silo-android and jellycompat need no change.Changes an admin will notice beyond the new layout: Escape clears the row selection only when pressed inside the list, not from an open menu or dialog and not during a drag. The delete dialog is titled "Delete {title}?" with a "Delete row" button. The list's "Reload order" button and the "Reload sections" button shown after a failed read are now "Reload rows"; the Restore Defaults dialog keeps its "Reload sections" button for now. The selection checkboxes stay on every row until a later PR adds a select mode.
Saves from the old drawer and delete dialogs don't join the list's one-at-a-time queue; reordering waits for them and their refetch, and later PRs move them into the queue. Rule rows say how many rules they have but not what the rules are, and collection rows don't say whether the collection is manual, smart or a synced list; a later PR adds both.
The user manual describes the old table. A siloserver.org issue covering the switch, the collapsed off rows and the ⋯ menu, along with the rest of the Home rows changes, is drafted and not filed yet.
Checklist
AI Disclosure
?page=link stayed on "Loading rows…" if libraries failed to load. Tests didn't pin the version captured at drag start or the touch delay. Default rule rows read "All movies" whatever their sort order. The list's accessible name was announced twice. Some section code was left without callers.🤖 Generated with Claude Code
Note
Show Home rows as one list with switches, row menus, and drag-to-reorder
AdminSectionstable page with a sharedHomeRowsPagecomponent tree (HomeRowsPage.tsx), rendering rows in a single sortable list with per-row visibility switches, overflow menus, and page switching between Home and libraries/home-rowsroute's oldAdminSectionsmodule and the exportedSortableSectionTableRow; the route now loadsAdminHomeRows(App.tsx), andSectionSummaryBadgesno longer renders library, collection, or enabled badgesMacroscope summarized e264a94.