diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 911ac4e6..d83c2e39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,9 +43,6 @@ jobs: - name: Generate Application Key run: php artisan key:generate - - name: Publish Ziggy Configuration - run: php artisan ziggy:generate - - name: Build Assets run: npm run build diff --git a/.gitignore b/.gitignore index 3847c0df..af25c295 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ /public/storage /storage/*.key /storage/pail +/resources/js/actions +/resources/js/routes +/resources/js/wayfinder /vendor .env .env.backup diff --git a/.prettierignore b/.prettierignore index df954ecd..6b929aea 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,2 @@ resources/js/components/ui/* -resources/js/ziggy.js resources/views/mail/* diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 62b69f31..bd890133 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -5,7 +5,6 @@ use Illuminate\Foundation\Inspiring; use Illuminate\Http\Request; use Inertia\Middleware; -use Tighten\Ziggy\Ziggy; class HandleInertiaRequests extends Middleware { @@ -46,10 +45,6 @@ public function share(Request $request): array 'auth' => [ 'user' => $request->user(), ], - 'ziggy' => [ - ...(new Ziggy)->toArray(), - 'location' => $request->url(), - ], 'sidebarOpen' => ! $request->hasCookie('sidebar_state') || $request->cookie('sidebar_state') === 'true', ]; } diff --git a/composer.json b/composer.json index ec56e03c..c4024acb 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "inertiajs/inertia-laravel": "^2.0", "laravel/framework": "^12.0", "laravel/tinker": "^2.10.1", - "tightenco/ziggy": "^2.4" + "laravel/wayfinder": "^0.1.9" }, "require-dev": { "fakerphp/faker": "^1.23", diff --git a/package-lock.json b/package-lock.json index 7701bbb1..bef34a6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,11 +15,11 @@ "tailwind-merge": "^3.2.0", "tailwindcss": "^4.1.1", "tw-animate-css": "^1.2.5", - "vue": "^3.5.13", - "ziggy-js": "^2.4.2" + "vue": "^3.5.13" }, "devDependencies": { "@eslint/js": "^9.19.0", + "@laravel/vite-plugin-wayfinder": "^0.1.3", "@tailwindcss/vite": "^4.1.11", "@types/node": "^22.13.5", "@vitejs/plugin-vue": "^6.0.0", @@ -912,6 +912,12 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@laravel/vite-plugin-wayfinder": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@laravel/vite-plugin-wayfinder/-/vite-plugin-wayfinder-0.1.3.tgz", + "integrity": "sha512-S/21Lzl7lci7LrRo/VsN5AXT02AMf7rs+OPTyt3VPgffBB1wTrzwsPr28sCU0gcR/APhfC1eVIUwpLbAvBmyKw==", + "dev": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1551,12 +1557,6 @@ "undici-types": "~6.21.0" } }, - "node_modules/@types/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", - "license": "MIT" - }, "node_modules/@types/web-bluetooth": { "version": "0.0.21", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz", @@ -5128,28 +5128,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/ziggy-js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/ziggy-js/-/ziggy-js-2.5.3.tgz", - "integrity": "sha512-fdlGmRpG6I7yqGicIm6xYXhfbYZHjjb5fPHF5xekK6RLQRgOgLXzEg1R6GUgmF3qPAuKTHhAJ3EUfZ86LyMGeg==", - "license": "MIT", - "dependencies": { - "@types/qs": "^6.9.17", - "qs": "~6.9.7" - } - }, - "node_modules/ziggy-js/node_modules/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } } } } diff --git a/package.json b/package.json index 7b68a54d..6fa16015 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "devDependencies": { "@eslint/js": "^9.19.0", + "@laravel/vite-plugin-wayfinder": "^0.1.3", "@tailwindcss/vite": "^4.1.11", "@types/node": "^22.13.5", "@vitejs/plugin-vue": "^6.0.0", @@ -38,8 +39,7 @@ "tailwind-merge": "^3.2.0", "tailwindcss": "^4.1.1", "tw-animate-css": "^1.2.5", - "vue": "^3.5.13", - "ziggy-js": "^2.4.2" + "vue": "^3.5.13" }, "optionalDependencies": { "@rollup/rollup-linux-x64-gnu": "4.9.5", diff --git a/resources/js/app.ts b/resources/js/app.ts index 792a46cf..9f2f6d81 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -4,7 +4,6 @@ import { createInertiaApp } from '@inertiajs/vue3'; import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; import type { DefineComponent } from 'vue'; import { createApp, h } from 'vue'; -import { ZiggyVue } from 'ziggy-js'; import { initializeTheme } from './composables/useAppearance'; const appName = import.meta.env.VITE_APP_NAME || 'Laravel'; @@ -15,7 +14,6 @@ createInertiaApp({ setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) - .use(ZiggyVue) .mount(el); }, progress: { diff --git a/resources/js/components/AppHeader.vue b/resources/js/components/AppHeader.vue index 51296fdd..e5e3307f 100644 --- a/resources/js/components/AppHeader.vue +++ b/resources/js/components/AppHeader.vue @@ -10,8 +10,9 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/co import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import UserMenuContent from '@/components/UserMenuContent.vue'; import { getInitials } from '@/composables/useInitials'; +import { dashboard } from '@/routes'; import type { BreadcrumbItem, NavItem } from '@/types'; -import { Link, usePage } from '@inertiajs/vue3'; +import { InertiaLinkProps, Link, usePage } from '@inertiajs/vue3'; import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-vue-next'; import { computed } from 'vue'; @@ -26,16 +27,17 @@ const props = withDefaults(defineProps(), { const page = usePage(); const auth = computed(() => page.props.auth); -const isCurrentRoute = computed(() => (url: string) => page.url === url); +const isCurrentRoute = computed(() => (url: NonNullable) => page.url === (typeof url === 'string' ? url : url.url)); const activeItemStyles = computed( - () => (url: string) => (isCurrentRoute.value(url) ? 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ''), + () => (url: NonNullable) => + isCurrentRoute.value(typeof url === 'string' ? url : url.url) ? 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : '', ); const mainNavItems: NavItem[] = [ { title: 'Dashboard', - href: '/dashboard', + href: dashboard(), icon: LayoutGrid, }, ]; @@ -88,7 +90,7 @@ const rightNavItems: NavItem[] = [ - + @@ -139,7 +141,11 @@ const rightNavItems: NavItem[] = [