Skip to content

feat(nav): redirect to manage if there's no dropdown on mobile - #4949

Draft
Chew wants to merge 2 commits into
RetroAchievements:masterfrom
Chew:fix/manage-mobile
Draft

feat(nav): redirect to manage if there's no dropdown on mobile#4949
Chew wants to merge 2 commits into
RetroAchievements:masterfrom
Chew:fix/manage-mobile

Conversation

@Chew

@Chew Chew commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

https://canary.discord.com/channels/310192285306454017/1498889559998595144/1498889559998595144

This PR allows mobile users who see no dropdown a way to get to the manage area.

It does (a bunch of) checks to see if there's a visible dropdown to show, and if there is not, just redirect the user.

All of this only affects mobile users. As a result, an override of the desktopHref was needed to let us effectively make it act like it does in desktop on mobile if there's no dropdown to show.

@wescopeland

Copy link
Copy Markdown
Member

My eye darts between the 3 Manage labels that all have a different semantic meaning:

Screenshot 2026-06-04 at 5 31 38 PM

One is a button, another is a heading, and another is a link.

Ideally, if there is nothing in the dropdown, we just send them to the manage area anyway.

I think this is the solution we want. This should be doable with some conditional rendering in the Blade template. If there's nothing to show in the dropdown, we can use a simple link.

@Chew

Chew commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Maybe I was looking in the wrong places, basically every role should have accessManagementTools, including Jr Devs and Manual Unlock, the code here seems to allow it to show up in $tools and $visibleTools, that just pulls from the settings file. Was this just a bug with that not showing up?

@wescopeland

Copy link
Copy Markdown
Member

Yep. I would most certainly classify this issue as a bug 🐛

@Chew

Chew commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

I'll take a look into that and see if we can resolve the root issue instead 😃

@Chew

Chew commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

This is apparently not an issue with the tool selection since it works in development. Works on my machine™ strikes again. I'll rework this to redirect if there's nothing in the dropdown instead.

@Chew
Chew marked this pull request as draft June 5, 2026 19:18
@Chew Chew changed the title feat(nav): add button to dashboard in management dropdown feat(nav): redirect to manage if there's no dropdown on mobile Jun 5, 2026
@Chew
Chew marked this pull request as ready for review June 6, 2026 00:56
dropdown-class="dropdown-menu-right"
:title="__('Manage')"
:desktopHref="route('filament.admin.pages.dashboard')"
:force-href="!$anyDropdownItems"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Better to call this something like shouldForceHref. At the moment, it's almost indistinguishable in purpose between desktopHref unless the reader looks around to see what the type of $anyDropdownItems is.

Might be a good idea to rename $anyDropdownItems too to something like $hasAnyDropdownItems.

Comment on lines +14 to +17
$user?->can('develop') ||
$user?->can('manage', App\Models\Ticket::class) ||
$user?->can('manage', App\Models\AchievementSetClaim::class) ||
$user?->can('manage', App\Models\GameHash::class) ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: For users whose permissions pass these checks but are still blocked by the later nesting, $anyDropdownItems will technically become true even though no item is rendered.

For example, a Junior Developer can manage tickets/claims per the policy classes, but they fail the outer @can('develop') on line 41. Therefore, assuming I have my boolean math correct, the mobile Manage trigger still renders as a non-link button with an empty dropdown instead of forcing the Filament dashboard href.

@Chew
Chew marked this pull request as draft June 21, 2026 07:16
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.

2 participants