chore: unify admin settings menu items - #27209
Merged
Merged
Conversation
…enu items Extract the Admin settings menu items into a single getAdminSettingsItems helper so the desktop DeploymentDropdown and mobile MobileMenu render the same list from one source of truth. Previously each surface hardcoded the items and their permission gates, which is how the mobile menu drifted out of sync with the desktop dropdown for the AI and AI sessions items.
jakehwll
marked this pull request as ready for review
July 14, 2026 02:06
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
#27191 fixed the mobile menu missing the AI / AI sessions items, but did so by duplicating the item list. The desktop
DeploymentDropdownand mobileMobileMenueach hardcode the same Admin settings links and permission gates. That duplication is exactly why the two drifted out of sync in the first place, and it will happen again the next time an item is added.Fix
Extract a single source of truth in
adminSettings.ts:AdminSettingsPermissionstype shared by both surfaces.getAdminSettingsItems(permissions)builds the ordered item list using conditional spreads, e.g.canViewAdminSettings(permissions)for the desktop visibility gate.DeploymentDropdownandMobileMenunow just.map()over the shared list, so adding or changing an item is a one-line edit in one place.No backend, permission, routing, or user-visible behavior changes. Item labels, links, and order match the current desktop dropdown (mobile now inherits the same
linkToAuditingconstant instead of a hardcoded/audit, same value).Rationale / approach
Following Larry Wall's virtues: laziness (one list to maintain, not two), impatience (kill the class of bug where the two menus silently diverge), and hubris (leave a shared module nobody has to apologize for).
Kept
canViewOrganizationsin the permission type and visibility gate even though Organizations always renders, preserving prior behavior rather than changing it as part of a refactor.Validated with
biome checkandtsc --noEmit; existingMobileMenu.stories.tsxargs already cover the Admin / Auditor / OrgAdmin / Member permission matrices.