Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(ui): add Projects page to the sidebar

Andras Bacsai58b7f85e1ea1
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index b834571da0..e6a082cf71 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -104,8 +104,8 @@
// An entry with children opens a submenu in place of the main menu (back button + its pages).
$navSections = collect([
'Workspace' => [
- // The dashboard lists projects and links to all of them, so project pages count as Dashboard.
- ['label' => 'Dashboard', 'icon' => 'dashboard', 'href' => '/', 'active' => request()->is('/', 'dashboard/*', 'projects', 'projects/*', 'project/*', 'canvas')],
+ ['label' => 'Dashboard', 'icon' => 'dashboard', 'href' => '/', 'active' => request()->is('/', 'dashboard/*', 'canvas')],
+ ['label' => 'Projects', 'icon' => 'projects', 'href' => route('project.index'), 'active' => request()->is('projects', 'projects/*', 'project/*')],
['label' => 'Monitoring', 'icon' => 'graph', 'children' => [
['label' => 'Analytics', 'icon' => 'analytics', 'href' => route('analytics'), 'active' => request()->is('analytics')],
['label' => 'Metrics', 'icon' => 'graph', 'href' => route('metrics'), 'active' => request()->is('metrics')],
diff --git a/tests/Feature/NavbarSubmenuTest.php b/tests/Feature/NavbarSubmenuTest.php
index b336b46a80..de06618119 100644
--- a/tests/Feature/NavbarSubmenuTest.php
+++ b/tests/Feature/NavbarSubmenuTest.php
@@ -131,3 +131,12 @@ test('a parent entry opens its submenu in place on mobile and desktop', function
->not->toMatch('#<a title="Monitoring"#');
}
});
+
+test('the projects entry links to the projects page and is active on project pages', function () {
+ loginNavbarUser('member');
+
+ expect(renderNavbarAt('/project/abc'))
+ ->toContain('href="'.route('project.index').'"')
+ ->toMatch('#title="Projects"[^>]*menu-item-active#s')
+ ->not->toMatch('#title="Dashboard"[^>]*menu-item-active#s');
+});