Skip to content

Commit 21e50ce

Browse files
Merge pull request #151 from laravel/replace-ziggy-with-wayfinder
Replace Ziggy with Wayfinder
2 parents c9e6a6c + cc76d1b commit 21e50ce

34 files changed

+101
-103
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434
- name: Install Node Dependencies
3535
run: npm ci
3636

37-
- name: Build Assets
38-
run: npm run build
39-
4037
- name: Install Dependencies
4138
run: composer install --no-interaction --prefer-dist --optimize-autoloader
4239

40+
- name: Build Assets
41+
run: npm run build
42+
4343
- name: Copy Environment File
4444
run: cp .env.example .env
4545

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
/public/build
55
/public/hot
66
/public/storage
7+
/resources/js/actions
8+
/resources/js/routes
9+
/resources/js/wayfinder
710
/storage/*.key
811
/storage/pail
912
/vendor

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
resources/js/components/ui/*
2-
resources/js/ziggy.js
32
resources/views/mail/*

app/Http/Middleware/HandleInertiaRequests.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Illuminate\Foundation\Inspiring;
66
use Illuminate\Http\Request;
77
use Inertia\Middleware;
8-
use Tighten\Ziggy\Ziggy;
98

109
class HandleInertiaRequests extends Middleware
1110
{
@@ -46,10 +45,6 @@ public function share(Request $request): array
4645
'auth' => [
4746
'user' => $request->user(),
4847
],
49-
'ziggy' => fn (): array => [
50-
...(new Ziggy)->toArray(),
51-
'location' => $request->url(),
52-
],
5348
'sidebarOpen' => ! $request->hasCookie('sidebar_state') || $request->cookie('sidebar_state') === 'true',
5449
];
5550
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"inertiajs/inertia-laravel": "^2.0",
1414
"laravel/framework": "^12.0",
1515
"laravel/tinker": "^2.10.1",
16-
"tightenco/ziggy": "^2.4"
16+
"laravel/wayfinder": "^0.1.9"
1717
},
1818
"require-dev": {
1919
"fakerphp/faker": "^1.23",

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"devDependencies": {
1414
"@eslint/js": "^9.19.0",
15+
"@laravel/vite-plugin-wayfinder": "^0.1.3",
1516
"@types/node": "^22.13.5",
1617
"eslint": "^9.17.0",
1718
"eslint-config-prettier": "^10.0.1",

resources/js/components/app-header.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/comp
99
import { UserMenuContent } from '@/components/user-menu-content';
1010
import { useInitials } from '@/hooks/use-initials';
1111
import { cn } from '@/lib/utils';
12+
import { dashboard } from '@/routes';
1213
import { type BreadcrumbItem, type NavItem, type SharedData } from '@/types';
1314
import { Link, usePage } from '@inertiajs/react';
1415
import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-react';
@@ -18,7 +19,7 @@ import AppLogoIcon from './app-logo-icon';
1819
const mainNavItems: NavItem[] = [
1920
{
2021
title: 'Dashboard',
21-
href: '/dashboard',
22+
href: dashboard(),
2223
icon: LayoutGrid,
2324
},
2425
];
@@ -78,7 +79,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
7879
{rightNavItems.map((item) => (
7980
<a
8081
key={item.title}
81-
href={item.href}
82+
href={typeof item.href === 'string' ? item.href : item.href.url}
8283
target="_blank"
8384
rel="noopener noreferrer"
8485
className="flex items-center space-x-2 font-medium"
@@ -94,7 +95,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
9495
</Sheet>
9596
</div>
9697

97-
<Link href="/dashboard" prefetch className="flex items-center space-x-2">
98+
<Link href={dashboard()} prefetch className="flex items-center space-x-2">
9899
<AppLogo />
99100
</Link>
100101

@@ -108,7 +109,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
108109
href={item.href}
109110
className={cn(
110111
navigationMenuTriggerStyle(),
111-
page.url === item.href && activeItemStyles,
112+
page.url === (typeof item.href === 'string' ? item.href : item.href.url) && activeItemStyles,
112113
'h-9 cursor-pointer px-3',
113114
)}
114115
>
@@ -135,7 +136,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
135136
<Tooltip>
136137
<TooltipTrigger>
137138
<a
138-
href={item.href}
139+
href={typeof item.href === 'string' ? item.href : item.href.url}
139140
target="_blank"
140141
rel="noopener noreferrer"
141142
className="group ml-1 inline-flex h-9 w-9 items-center justify-center rounded-md bg-transparent p-0 text-sm font-medium text-accent-foreground ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"

resources/js/components/app-sidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NavFooter } from '@/components/nav-footer';
22
import { NavMain } from '@/components/nav-main';
33
import { NavUser } from '@/components/nav-user';
44
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/components/ui/sidebar';
5+
import { dashboard } from '@/routes';
56
import { type NavItem } from '@/types';
67
import { Link } from '@inertiajs/react';
78
import { BookOpen, Folder, LayoutGrid } from 'lucide-react';
@@ -10,7 +11,7 @@ import AppLogo from './app-logo';
1011
const mainNavItems: NavItem[] = [
1112
{
1213
title: 'Dashboard',
13-
href: '/dashboard',
14+
href: dashboard(),
1415
icon: LayoutGrid,
1516
},
1617
];
@@ -35,7 +36,7 @@ export function AppSidebar() {
3536
<SidebarMenu>
3637
<SidebarMenuItem>
3738
<SidebarMenuButton size="lg" asChild>
38-
<Link href="/dashboard" prefetch>
39+
<Link href={dashboard()} prefetch>
3940
<AppLogo />
4041
</Link>
4142
</SidebarMenuButton>

resources/js/components/delete-user.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { destroy } from '@/actions/App/Http/Controllers/Settings/ProfileController';
12
import HeadingSmall from '@/components/heading-small';
23
import InputError from '@/components/input-error';
34
import { Button } from '@/components/ui/button';
@@ -31,8 +32,7 @@ export default function DeleteUser() {
3132
</DialogDescription>
3233

3334
<Form
34-
method="delete"
35-
action={route('profile.destroy')}
35+
{...destroy.form()}
3636
options={{
3737
preserveScroll: true,
3838
}}

0 commit comments

Comments
 (0)