From bde11c0b8c36cdd9afade5e1c1ec33ccc14cca8e Mon Sep 17 00:00:00 2001 From: "Harry (hjbdev)" Date: Tue, 8 Apr 2025 19:17:12 +0100 Subject: [PATCH] Header layout rather than sidebar layout --- .../Controllers/ApplicationController.php | 10 ++++ resources/js/components/AppHeader.vue | 49 +++++++++++------ resources/js/components/AppLogoIcon.vue | 10 +--- resources/js/layouts/AppLayout.vue | 2 +- resources/js/pages/Applications/Index.vue | 54 +++++++++++++++++++ resources/js/pages/Dashboard.vue | 37 ++++++++----- resources/js/pages/organisations/Show.vue | 2 +- routes/web.php | 6 ++- 8 files changed, 131 insertions(+), 39 deletions(-) create mode 100644 resources/js/pages/Applications/Index.vue diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index 504b1de..c9fb324 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -2,10 +2,20 @@ namespace App\Http\Controllers; +use App\Models\Organisation; use Illuminate\Http\Request; class ApplicationController extends Controller { + public function index(Request $request) + { + $organisation = Organisation::with('applications')->findOrFail($request->route('organisation')); + + return inertia('applications/Index', [ + 'applications' => $organisation->applications, + ]); + } + public function show(Request $request) { $id = $request->route('application'); diff --git a/resources/js/components/AppHeader.vue b/resources/js/components/AppHeader.vue index 84902b2..d76fca8 100644 --- a/resources/js/components/AppHeader.vue +++ b/resources/js/components/AppHeader.vue @@ -18,7 +18,7 @@ import UserMenuContent from '@/components/UserMenuContent.vue'; import { getInitials } from '@/composables/useInitials'; import type { BreadcrumbItem, NavItem } from '@/types'; import { Link, usePage } from '@inertiajs/vue3'; -import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-vue-next'; +import { AppWindowIcon, BookOpen, Folder, LayoutGrid, Menu, Search, ServerIcon } from 'lucide-vue-next'; import { computed } from 'vue'; interface Props { @@ -39,24 +39,41 @@ const activeItemStyles = computed( ); const mainNavItems: NavItem[] = [ - { - title: 'Dashboard', - href: '/dashboard', - icon: LayoutGrid, - }, + // { + // title: 'Dashboard', + // href: new URL(route('dashboard')).pathname, + // icon: LayoutGrid, + // }, ]; +if (page.props.organisation) { + mainNavItems.push({ + title: 'Applications', + href: new URL(route('applications.index', { + organisation: page.props?.organisation?.id + })).pathname, + icon: AppWindowIcon, + }); + mainNavItems.push({ + title: 'Servers', + href: new URL(route('servers.index', { + organisation: page.props?.organisation?.id + })).pathname, + icon: ServerIcon, + }) +} + const rightNavItems: NavItem[] = [ - { - title: 'Repository', - href: 'https://github.com/laravel/vue-starter-kit', - icon: Folder, - }, - { - title: 'Documentation', - href: 'https://laravel.com/docs/starter-kits', - icon: BookOpen, - }, + // { + // title: 'Repository', + // href: 'https://github.com/laravel/vue-starter-kit', + // icon: Folder, + // }, + // { + // title: 'Documentation', + // href: 'https://laravel.com/docs/starter-kits', + // icon: BookOpen, + // }, ]; diff --git a/resources/js/components/AppLogoIcon.vue b/resources/js/components/AppLogoIcon.vue index 6412a44..8a6af14 100644 --- a/resources/js/components/AppLogoIcon.vue +++ b/resources/js/components/AppLogoIcon.vue @@ -1,4 +1,5 @@ diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue index 77c9396..f13a51f 100644 --- a/resources/js/layouts/AppLayout.vue +++ b/resources/js/layouts/AppLayout.vue @@ -1,5 +1,5 @@ + + diff --git a/resources/js/pages/Dashboard.vue b/resources/js/pages/Dashboard.vue index 9ec3c4d..04769f5 100644 --- a/resources/js/pages/Dashboard.vue +++ b/resources/js/pages/Dashboard.vue @@ -1,8 +1,16 @@