-
-
Notifications
You must be signed in to change notification settings - Fork 132
feat(nav): redirect to manage if there's no dropdown on mobile #4949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,13 +9,26 @@ | |
| $tools = $settings['tools'] ?? []; | ||
| $visibleTools = collect($tools)->filter(fn($tool) => $user?->can($tool['abilities'])); | ||
|
|
||
| $anyDropdownItems = | ||
| $visibleTools->isNotEmpty() || | ||
| $user?->can('develop') || | ||
| $user?->can('manage', App\Models\Ticket::class) || | ||
| $user?->can('manage', App\Models\AchievementSetClaim::class) || | ||
| $user?->can('manage', App\Models\GameHash::class) || | ||
| $user->Permissions >= Permissions::Developer || | ||
| $user?->can('manage', App\Models\News::class) || | ||
| $user->can('manage', User::class) || | ||
| $user->Permissions === Permissions::Moderator || | ||
| $user->can('tool'); | ||
|
|
||
| ?> | ||
|
|
||
| <x-nav-dropdown | ||
| :class="$class ?? ''" | ||
| dropdown-class="dropdown-menu-right" | ||
| :title="__('Manage')" | ||
| :desktopHref="route('filament.admin.pages.dashboard')" | ||
| :force-href="!$anyDropdownItems" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Better to call this something like Might be a good idea to rename |
||
| > | ||
| <x-slot name="trigger"> | ||
| <x-fas-toolbox /> | ||
|
|
||
There was a problem hiding this comment.
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,
$anyDropdownItemswill 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.