Skip to content

Commit 9a4a45b

Browse files
committed
Replace Ziggy with Wayfinder
1 parent ba8c79a commit 9a4a45b

26 files changed

+63
-57
lines changed

.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.6"
1717
},
1818
"require-dev": {
1919
"fakerphp/faker": "^1.23",

package-lock.json

Lines changed: 8 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/delete-user.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Label } from '@/components/ui/label';
99
import HeadingSmall from '@/components/heading-small';
1010

1111
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
12+
import { destroy as profileControllerDestroy } from '@/actions/App/Http/Controllers/Settings/ProfileController';
1213

1314
export default function DeleteUser() {
1415
const passwordInput = useRef<HTMLInputElement>(null);
@@ -17,7 +18,7 @@ export default function DeleteUser() {
1718
const deleteUser: FormEventHandler = (e) => {
1819
e.preventDefault();
1920

20-
destroy(route('profile.destroy'), {
21+
destroy(profileControllerDestroy.url(), {
2122
preserveScroll: true,
2223
onSuccess: () => closeModal(),
2324
onError: () => passwordInput.current?.focus(),

resources/js/components/user-menu-content.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { useMobileNavigation } from '@/hooks/use-mobile-navigation';
44
import { type User } from '@/types';
55
import { Link, router } from '@inertiajs/react';
66
import { LogOut, Settings } from 'lucide-react';
7+
import { edit as profileEditRoute } from '@/routes/profile';
8+
import { logout as logoutRoute } from '@/routes';
79

810
interface UserMenuContentProps {
911
user: User;
@@ -27,15 +29,15 @@ export function UserMenuContent({ user }: UserMenuContentProps) {
2729
<DropdownMenuSeparator />
2830
<DropdownMenuGroup>
2931
<DropdownMenuItem asChild>
30-
<Link className="block w-full" href={route('profile.edit')} as="button" prefetch onClick={cleanup}>
32+
<Link className="block w-full" href={profileEditRoute.url()} as="button" prefetch onClick={cleanup}>
3133
<Settings className="mr-2" />
3234
Settings
3335
</Link>
3436
</DropdownMenuItem>
3537
</DropdownMenuGroup>
3638
<DropdownMenuSeparator />
3739
<DropdownMenuItem asChild>
38-
<Link className="block w-full" method="post" href={route('logout')} as="button" onClick={handleLogout}>
40+
<Link className="block w-full" method="post" href={logoutRoute.url()} as="button" onClick={handleLogout}>
3941
<LogOut className="mr-2" />
4042
Log out
4143
</Link>

resources/js/layouts/auth/auth-card-layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import AppLogoIcon from '@/components/app-logo-icon';
22
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
33
import { Link } from '@inertiajs/react';
44
import { type PropsWithChildren } from 'react';
5+
import { home as homeRoute } from '@/routes';
56

67
export default function AuthCardLayout({
78
children,
@@ -15,7 +16,7 @@ export default function AuthCardLayout({
1516
return (
1617
<div className="flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10">
1718
<div className="flex w-full max-w-md flex-col gap-6">
18-
<Link href={route('home')} className="flex items-center gap-2 self-center font-medium">
19+
<Link href={homeRoute.url()} className="flex items-center gap-2 self-center font-medium">
1920
<div className="flex h-9 w-9 items-center justify-center">
2021
<AppLogoIcon className="size-9 fill-current text-black dark:text-white" />
2122
</div>

resources/js/layouts/auth/auth-simple-layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AppLogoIcon from '@/components/app-logo-icon';
22
import { Link } from '@inertiajs/react';
33
import { type PropsWithChildren } from 'react';
4+
import { home as homeRoute } from '@/routes';
45

56
interface AuthLayoutProps {
67
name?: string;
@@ -14,7 +15,7 @@ export default function AuthSimpleLayout({ children, title, description }: Props
1415
<div className="w-full max-w-sm">
1516
<div className="flex flex-col gap-8">
1617
<div className="flex flex-col items-center gap-4">
17-
<Link href={route('home')} className="flex flex-col items-center gap-2 font-medium">
18+
<Link href={homeRoute.url()} className="flex flex-col items-center gap-2 font-medium">
1819
<div className="mb-1 flex h-9 w-9 items-center justify-center rounded-md">
1920
<AppLogoIcon className="size-9 fill-current text-[var(--foreground)] dark:text-white" />
2021
</div>

0 commit comments

Comments
 (0)