diff --git a/DESIGN.md b/DESIGN.md index 633d9e0256..6dd7dec361 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -311,8 +311,11 @@ 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 name of the deepest menu (`adonisjs ›`, + `Backup ›`). 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 +803,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 1621c1ed33..f9a3883d29 100644 --- a/resources/views/components/application/configuration-sidebar.blade.php +++ b/resources/views/components/application/configuration-sidebar.blade.php @@ -224,7 +224,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/backup-sidebar.blade.php b/resources/views/components/backup-sidebar.blade.php index efa09f884a..2167e72ee7 100644 --- a/resources/views/components/backup-sidebar.blade.php +++ b/resources/views/components/backup-sidebar.blade.php @@ -51,7 +51,7 @@ }; @endphp -