From 49346aeb29e38ac27b0f52bb4a7321682eae8e9b Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Fri, 30 Oct 2026 17:21:08 +0100 Subject: [PATCH] fix(ui): restore the main menu row that reopens the resource menu - On a resource page, the main menu starts with a row that shows the resource name and opens the deepest resource menu again. - Pass the resource name to registerMainNavContext() again. - Document the row in DESIGN.md. Co-Authored-By: Claude Opus 5.5 --- DESIGN.md | 12 +++++++----- bootstrap/helpers/shared.php | 5 +++-- .../application/configuration-sidebar.blade.php | 2 +- .../database/configuration-sidebar.blade.php | 2 +- .../views/components/main-nav-menu.blade.php | 4 ++-- resources/views/components/navbar.blade.php | 15 +++++++++++++++ .../views/components/server/sidebar.blade.php | 2 +- .../service/configuration-sidebar.blade.php | 2 +- .../views/livewire/destination/sidebar.blade.php | 2 +- .../views/livewire/source/github/change.blade.php | 2 +- resources/views/livewire/storage/show.blade.php | 2 +- tests/Feature/ResourceMenuInMainNavTest.php | 4 ++-- 12 files changed, 36 insertions(+), 18 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 633d9e0256..c6b59b8601 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -311,8 +311,10 @@ Class names below are examples. Keep the values and structure. and no frame around it. Only the expanded sidebar shows Search as an input. - A menu that replaces another menu in place starts with a back row: a centered label and a 12px left chevron (`‹ Dashboard`). -- The main menu has no row above its items. Dashboard is the first item, right - under Search, on every page. +- On a resource page, the main menu starts with a row that opens the resource + menu again. It points right and shows the resource name (`adonisjs ›`). On + other pages the main menu has no row above its items, and Dashboard is the + first item, right under Search. ### Card (outer box, title row, well) @@ -800,9 +802,9 @@ state because it can disappear after polling or a Livewire morph. From `xl`, the resource menu replaces the main menu in the main sidebar (`x-main-nav-menu`, `registerMainNavContext()`, `components/navbar.blade.php`). Its back row (`‹ Dashboard`, `‹ Servers`, `‹ Service`) shows the menu one depth -lower, without a page load. The main menu has no row that opens the resource -menu again; to get back to it, open the resource again. Dashboard is always the -first item under Search. +lower, without a page load. On a resource page the main menu starts with a row +(`adonisjs ›`) that opens the deepest resource menu again, also without a page +load. The global topbar owns the current resource identity, its compact status badges, configuration warnings (`#configuration-warning-hud-slot`), and the diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index b31756dae9..10255bcebd 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -4760,11 +4760,12 @@ function wireNavigate(): string * Registers a resource menu that the main sidebar and the mobile drawer show in place of their main menu * (see components/navbar.blade.php). The menu teleports itself into #main-nav-context-{depth}. * Back on a menu shows the menu one depth lower, and Back at depth 0 shows the main menu. + * The main menu then shows a row (labelled with $name) that opens the deepest resource menu again. */ -function registerMainNavContext(int $depth, string $label, string $backTitle): void +function registerMainNavContext(int $depth, string $label, string $backTitle, ?string $name = null): void { $levels = request()->attributes->get('mainNavContext', []); - $levels[$depth] = ['label' => $label, 'backTitle' => $backTitle]; + $levels[$depth] = ['label' => $label, 'backTitle' => $backTitle, 'name' => $name]; ksort($levels); request()->attributes->set('mainNavContext', $levels); diff --git a/resources/views/components/application/configuration-sidebar.blade.php b/resources/views/components/application/configuration-sidebar.blade.php index 592c81e48f..66ab606a7c 100644 --- a/resources/views/components/application/configuration-sidebar.blade.php +++ b/resources/views/components/application/configuration-sidebar.blade.php @@ -228,7 +228,7 @@ @php // The main sidebar and the mobile drawer show this menu (see components/navbar.blade.php). - registerMainNavContext(0, 'Dashboard', 'Back to the main menu'); + registerMainNavContext(0, 'Dashboard', 'Back to the main menu', $application->name); @endphp {{-- Rendered twice: in the page (CSS hides it; it keeps the command palette items), and teleported into the main sidebar. diff --git a/resources/views/components/database/configuration-sidebar.blade.php b/resources/views/components/database/configuration-sidebar.blade.php index 57c5d7ae40..956a6d659a 100644 --- a/resources/views/components/database/configuration-sidebar.blade.php +++ b/resources/views/components/database/configuration-sidebar.blade.php @@ -60,7 +60,7 @@ @php // The main sidebar and the mobile drawer show this menu (see components/navbar.blade.php). - registerMainNavContext(0, 'Dashboard', 'Back to the main menu'); + registerMainNavContext(0, 'Dashboard', 'Back to the main menu', $database->name); @endphp {{-- Rendered twice: in the page (CSS hides it; it keeps the command palette items), and teleported into the main sidebar. diff --git a/resources/views/components/main-nav-menu.blade.php b/resources/views/components/main-nav-menu.blade.php index e38134e110..cabc9e22c3 100644 --- a/resources/views/components/main-nav-menu.blade.php +++ b/resources/views/components/main-nav-menu.blade.php @@ -1,7 +1,7 @@ -@props(['backLabel', 'backTitle' => 'Back to the main menu', 'depth' => 0, 'navOnly' => false]) +@props(['backLabel', 'backTitle' => 'Back to the main menu', 'depth' => 0, 'name' => null, 'navOnly' => false]) @php // The main sidebar and the mobile drawer replace their menu with this one (see components/navbar.blade.php). - registerMainNavContext($depth, $backLabel, $backTitle); + registerMainNavContext($depth, $backLabel, $backTitle, $name); @endphp {{-- A page menu, rendered twice: in the page (CSS hides it), and teleported into the main sidebar. The slot must not contain Livewire components (they would render twice). diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index 69f484845f..83ea2516d4 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -184,6 +184,7 @@ // components/main-nav-menu.blade.php). Each one teleports itself into #main-nav-context-{depth} // (the desktop sidebar); the mobile drawer moves it into its own slot while it shows (see init). $navContext = request()->attributes->get('mainNavContext', []); + $navContextName = collect($navContext)->pluck('name')->filter()->last() ?? 'Resource menu'; @endphp {{-- On a resource page the deepest resource menu replaces the main menu. Back shows the menu one depth lower, and then the main menu (or its submenu), without leaving the page. --}} @@ -262,6 +263,20 @@ @endforeach