Repository navigation
feat(settings): let managers change menus and set a person's own sections (menu access, part 4) - #1705
Merged
Conversation
… part 1)
Menu access, part 1 of 7: the data and the rule, with no UI yet.
- 00374 adds organization_menu_roles, the sections a role (not admin)
doesn't see. Members of the organization read it and the server
writes it.
- On profiles it adds menu_shown, menu_hidden and can_manage_menus,
which only the server sets (00228's guard is extended), and
work_areas and work_areas_asked_at, which the person sets.
- lib/menu-access.ts holds the rule: the role's sections, then the
person's exceptions, narrowed to their work areas.
- Action Center is always on.
- Nobody takes a section off an admin's menu; only their own work
areas narrow it.
- A section is named by its route, so a new one shows by default.
- lib/actions/menu-access.ts covers getMyMenu, the Settings data, the
role table, per-person exceptions and menu managers (admin only).
It also writes the person's own work areas.
Hide only: pages still open from a link, roles and data access don't
change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…enu access, part 2) The dashboard layout reads the viewer's menu once (getMyMenu, part 1) and hands the sections it leaves out to a MenuAccessProvider. Both menus filter by them through shouldShowDashboardNavItem: - the sidebar drops a group whose sections are all off the menu, title and all; - the mobile menu drops the active brand's Prompts link with the Prompts section. If the menu can't be read, the whole menu shows. Hide only: an address still opens its page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A removed member keeps their profile and an invitation moves it to the next organization, so a menu manager of one organization arrived in another still able to change its menus, with their old exceptions. A trigger now clears menu_shown, menu_hidden and can_manage_menus on a new organization and can_manage_menus on a new role, unless the same update sets them; it fires after the guard, so the guard still checks what the person asked for. Also reloads PostgREST's schema at the end of 00374, validates setMenuManager's flag with Zod, and tests that the work-area check in the database lists exactly the app's work areas. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…access, part 3)
A new Settings section, Menu access, for admins and the managers they let
change menus. Others don't see it in Settings, and its address tells them
who can.
- A table of the menu's sections by its groups, with a column per role:
- each box saves at once, and is put back with a toast if the save
fails;
- Admin is always Everything, and Action Center can't be turned off;
- "Use a set…" fills a role from a work area's ready-made set, or
Everything.
- Fixed column shares keep the table inside Settings' column at 1024 px.
- en.json carries the copy and the nine work areas' names and lines, so
the Account and welcome-step parts can use them too.
- MenuAccessProvider also carries whether the viewer can change menus.
The plan dialog for a workspace whose plan has ended follows once ansvisor#1599
lands.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ions (menu access, part 4)
Two more cards on Settings › Menu access.
Who can change menus:
- lists the managers;
- an admin switches one on (setMenuManager) to let them use this page;
- a manager who changes menus sees the switches but can't flip them.
People: every non-admin with their role, work areas, menu ("{role}'s
menu", or "Custom: +Prompts, −Content") and how many sections it keeps.
Customize opens their sections:
- ticked as their role has them;
- a change from the role marked "shown for them" or "hidden for them";
- Action Center always on;
- each box saved at once (setMemberMenu);
- "Use {role}'s menu" goes back to the role's.
A failed save puts the switch or box back, with a toast. A row lays out on
one line when the card is wide, and on two when it's narrow (1024 px).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…areas "What do you work on?" is for new sign-ups and people joining from an invite, once. Without this, every existing person would get the step at their next sign-in. They can still pick work areas in Settings › Account. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… access, part 2 review) The dashboard layout read the viewer's menu through getMyMenu, a second user check and profile read after its own: two or three requests in a row on every render. The menu columns now come with the profile the layout already reads. The role's row (none for admins) is read alongside the organization and the brands. menuOfProfile builds the menu from both, and getMyMenu uses the same. - A role row that can't be read is logged (console.error) and the menu shows whole, rather than the failure passing silently. - The sidebar no longer reads the tracked prompts' count while Prompts is off the menu. - Tests cover a group dropped with its title when all its sections are hidden, the whole menu without a menu to go by, the count not read, the mobile menu leaving hidden sections off (the brand's Prompts link with Prompts), and readRoleHidden. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ettings # Conflicts: # web/src/app/[locale]/(dashboard)/layout.tsx
…let "Use a set…" fit (menu access, part 3 review) - A failed save on Menu access reads the role table again, instead of putting back the state from before it, which also undid a later save that had gone through. - No router.refresh after a save: setRoleMenu's revalidatePath already brings the menu up to date, so each click no longer renders twice. - The role columns get a little more of the table, and the select's chevron is smaller, so "Use a set…" isn't cut at 1024 px with the sidebar open. - Tests: picking a ready-made set saves it; a failed save next to a successful one keeps the successful one; Settings lists Menu access only for someone who can change menus. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…access, part 4 review) As with the role table: a failed save on Who can change menus or People reads the settings again (onFailed), instead of putting back the state from before it, which could undo a later save that had gone through. No router.refresh after a save: setMenuManager and setMemberMenu revalidate already. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…menu access, part 3 review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
7 of 8 tasks
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Own change. Part 4's own diff is a08247c against part 3's head (c00f8e1):
menu-access-people.tsxand its test (new), the two cards inmenu-access-section.tsx, and 26 keys inen.json. No change tosupabase/here, so 00374 is the same as in part 1. On today's main only part 1'ssupabase/schema.sqlconflicts; this part'sen.jsonkeys merge without a conflict. - Who can change whose menu. The cards call part 1's actions, and those check again on the server.
setMenuManagerre-reads the caller and lets only an admin change it, only for a manager in the same organization.setMemberMenutakes an admin or a manager with the menu right, refuses admin rows, and stays inside the caller's organization. The UI matches: admins are left out of People, only managers are in Who can change menus, and a manager sees the switches disabled with "Only admins choose who can change menus." - Hide only. Action Center stays ticked and disabled. A box writes only the person's exception to their role.
memberMenuWithdrops the exception when the box goes back to what the role has, and "Use {role}'s menu" clears both lists. - Failed saves. The change shows at once. When the save fails, a toast shows and the settings are read again, so another save that went through stays.
- Tests and types. On the PR's tree,
menu-access-people.test.tsx(9 tests) passes, and so do the other Settings, sidebar and menu-access tests: 19 files, 197 tests.tscreports nothing in the files this PR touches.
Follow-ups (none block):
settings.menuAccess.person,.workAreasand.menu("Person", "Their work areas", "Menu") aren't used anywhere, up to part 6. Use them as column headers on the wide layout, or remove them.- People lists the viewer's own row, and a manager who can change menus can edit their own exceptions too. That's fine, since only the menu changes, but
isCurrentUseris never shown. Adding "(you)" to that row would make it clear the change is to their own menu. - A "Custom" badge can list an exception that no longer changes anything. For example, "+Content" stays after the role starts showing Content too. When the role table changes, consider dropping exceptions that match the role, or showing in the badge only the ones that still make a difference.
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Menu access, part 4: under the role table in Settings › Menu access, who can change menus and each person's own sections. Stacked on part 3 (#1704), which is stacked on #1703 and #1702.
MenuManagersCard): every manager with a switch (setMenuManager). Only admins can flip it; a manager who manages menus sees the switches disabled, with a note.MenuPeopleCard): every non-admin with role, e-mail, their work areas, and their menu: "{Role}'s menu" or an amber "Custom: +X, −Y", plus "N of 11 sections".setMemberMenu); "Use {role}'s menu" resets. A failed save shows a toast and reads the settings again.en.jsonundersettings.menuAccess.Related issue
None.
Type of change
feat— New featureHow to test
Same setup as part 2 (00374 on the dev database). You need a second member in the demo organization (invite one, or add a profile with
organization_id = '2222…'and rolemanager).[email protected]/demo123(admin), open Settings › Menu access.Checklist
yarn lint/yarn typecheck/yarn formatpassyarn testandyarn buildpass, run on part 6's tip: 465 files, 4,561 tests; build OK (on part 6's tip 8c2e172).menu-access-people.test.tsx)npm run version:check(fails on main too: docker-compose images 0.2.0)🤖 Generated with Claude Code