Skip to content

Commit c62d8a4

Browse files
authored
Refactor home to dashboard (#21)
1 parent d0df5c2 commit c62d8a4

File tree

22 files changed

+37
-37
lines changed

22 files changed

+37
-37
lines changed

app/Http/Controllers/Auth/ConfirmedPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public function store(ConfirmPasswordRequest $request): RedirectResponse
2121
{
2222
$request->session()->passwordConfirmed();
2323

24-
return redirect()->intended('home');
24+
return redirect()->intended('dashboard');
2525
}
2626
}

app/Http/Controllers/Auth/EmailVerificationNotificationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function middleware(): array
2525
public function store(#[CurrentUser] User $user): RedirectResponse
2626
{
2727
if ($user->hasVerifiedEmail()) {
28-
return redirect()->intended('home');
28+
return redirect()->intended('dashboard');
2929
}
3030

3131
$user->sendEmailVerificationNotification();

app/Http/Controllers/Auth/RegisteredUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public function store(
2828

2929
$request->session()->regenerate();
3030

31-
return redirect('home');
31+
return redirect('dashboard');
3232
}
3333
}

app/Http/Controllers/Auth/VerifiedEmailController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public static function middleware(): array
2828
public function show(#[CurrentUser] User $user): RedirectResponse|Response
2929
{
3030
return $user->hasVerifiedEmail()
31-
? redirect()->intended('home')
31+
? redirect()->intended('dashboard')
3232
: Inertia::render('auth/verify-email', ['status' => session('status')]);
3333
}
3434

3535
public function store(EmailVerificationRequest $request): RedirectResponse
3636
{
3737
$request->fulfill();
3838

39-
return redirect()->intended('home');
39+
return redirect()->intended('dashboard');
4040
}
4141
}

app/Http/Requests/Auth/LoginRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function authenticate(): RedirectResponse
4949

5050
$this->session()->regenerate();
5151

52-
return redirect()->intended('home');
52+
return redirect()->intended('dashboard');
5353
}
5454

5555
/**

app/Http/Requests/Auth/TwoFactorLoginRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function authenticate(): RedirectResponse
6060

6161
$this->session()->regenerate();
6262

63-
return redirect()->intended('home');
63+
return redirect()->intended('dashboard');
6464
}
6565

6666
private function getChallengedUser(): ?User

lang/en/general.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
'copied' => 'Copied',
1313
'copy' => 'Copy',
1414
'copyright_notice' => 'Copyright © :year Moon Pixels Ltd. All rights reserved.',
15+
'dashboard' => 'Dashboard',
1516
'delete' => 'Delete',
1617
'disable' => 'Disable',
1718
'email' => 'Email',
1819
'enable' => 'Enable',
1920
'follow_us' => 'Follow us on :name',
2021
'github' => 'GitHub',
21-
'home' => 'Home',
2222
'language' => 'Language',
2323
'name' => 'Name',
2424
'password' => 'Password',

lang/en/navigation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
return [
66
'account_settings' => 'Account settings',
7+
'dashboard' => 'Dashboard',
78
'general' => 'General',
8-
'home' => 'Home',
99
'preferences' => 'Preferences',
1010
'security' => 'Security',
1111
];

lang/fr/general.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
'copied' => 'Copié',
1313
'copy' => 'Copier',
1414
'copyright_notice' => 'Copyright © :year Moon Pixels Ltd. Tous droits réservés.',
15+
'dashboard' => 'Tableau de bord',
1516
'delete' => 'Supprimer',
1617
'disable' => 'Désactiver',
1718
'email' => 'Email',
1819
'enable' => 'Activer',
1920
'follow_us' => 'Suivez-nous sur :name',
2021
'github' => 'GitHub',
21-
'home' => 'Accueil',
2222
'language' => 'Langue',
2323
'name' => 'Nom',
2424
'password' => 'Mot de passe',

lang/fr/navigation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
return [
66
'account_settings' => 'Paramètres du compte',
7+
'dashboard' => 'Tableau de bord',
78
'general' => 'Général',
8-
'home' => 'Accueil',
99
'preferences' => 'Préférences',
1010
'security' => 'Sécurité',
1111
];

resources/js/components/app-sidebar.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { UserAvatar, UserDetails, UserDropdown } from '@/components/user-dropdow
1414
import { useMobileNavigation } from '@/hooks/use-mobile-navigation'
1515
import { Link } from '@inertiajs/react'
1616
import { useLaravelReactI18n } from 'laravel-react-i18n'
17-
import { ChevronsUpDown, Home } from 'lucide-react'
17+
import { ChevronsUpDown, LayoutDashboard } from 'lucide-react'
1818

1919
export function AppSidebar() {
2020
const { t } = useLaravelReactI18n()
@@ -23,10 +23,10 @@ export function AppSidebar() {
2323

2424
const primaryNavItems = [
2525
{
26-
label: t('navigation.home'),
27-
href: route('home'),
28-
isActive: route().current('home*'),
29-
icon: Home,
26+
label: t('navigation.dashboard'),
27+
href: route('dashboard'),
28+
isActive: route().current('dashboard*'),
29+
icon: LayoutDashboard,
3030
},
3131
]
3232

@@ -35,7 +35,7 @@ export function AppSidebar() {
3535
<SidebarHeader>
3636
<SidebarMenu>
3737
<SidebarMenuItem>
38-
<Link href={route('home')} className="block p-2" onClick={cleanup} prefetch>
38+
<Link href={route('dashboard')} className="block p-2" onClick={cleanup} prefetch>
3939
<Logo className="h-6 w-auto" />
4040
</Link>
4141
</SidebarMenuItem>

resources/js/components/mobile-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function MobileHeader() {
1212
<div className="flex h-14 w-full items-center justify-between px-4 sm:px-6">
1313
<SidebarTrigger />
1414

15-
<Link href={route('home')}>
15+
<Link href={route('dashboard')}>
1616
<Logo className="h-6 w-auto" />
1717
</Link>
1818

resources/js/components/page-breadcrumbs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export function PageBreadcrumbs({ items }: PageBreadcrumbsProps) {
2626
<Breadcrumb>
2727
<BreadcrumbList>
2828
<BreadcrumbItem>
29-
{route().current('home') ? (
30-
<BreadcrumbPage>{t('navigation.home')}</BreadcrumbPage>
29+
{route().current('dashboard') ? (
30+
<BreadcrumbPage>{t('navigation.dashboard')}</BreadcrumbPage>
3131
) : (
3232
<BreadcrumbLink asChild>
33-
<Link href={route('home')}>{t('navigation.home')}</Link>
33+
<Link href={route('dashboard')}>{t('navigation.dashboard')}</Link>
3434
</BreadcrumbLink>
3535
)}
3636
</BreadcrumbItem>

resources/js/layouts/guest-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function GuestLayout({ children }: PropsWithChildren) {
1111
return (
1212
<div className="flex min-h-dvh w-full flex-col">
1313
<header className="flex h-16 shrink-0 items-center justify-between px-4">
14-
<Link href={route('home')}>
14+
<Link href={route('dashboard')}>
1515
<Logo className="h-6 w-auto" />
1616
</Link>
1717
</header>

resources/js/pages/home.tsx renamed to resources/js/pages/dashboard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { AuthenticatedLayout } from '@/layouts/authenticated-layout'
44
import { Head } from '@inertiajs/react'
55
import { useLaravelReactI18n } from 'laravel-react-i18n'
66

7-
export default function Home() {
7+
export default function Dashboard() {
88
const { t } = useLaravelReactI18n()
99

1010
return (
1111
<AuthenticatedLayout>
12-
<Head title={t('general.home')} />
12+
<Head title={t('general.dashboard')} />
1313

14-
<PageHeader>{t('general.home')}</PageHeader>
14+
<PageHeader>{t('general.dashboard')}</PageHeader>
1515

1616
<div className="py-10">
1717
<Text size="sm" variant="muted">

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Route::get('/', fn () => redirect()->route('login'));
1313

1414
Route::middleware(['auth', 'verified'])->group(function (): void {
15-
Route::get('home', fn () => Inertia::render('home'))->name('home');
15+
Route::get('dashboard', fn () => Inertia::render('dashboard'))->name('dashboard');
1616

1717
Route::controller(AccountAvatarController::class)->group(function (): void {
1818
Route::put('account/avatar', 'update')->name('account.avatar.update');

tests/Feature/Controllers/Auth/AuthenticatedSessionController/CreateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
->assertOk();
1414
});
1515

16-
test('user is redirected to the home page if already authenticated', function (): void {
16+
test('user is redirected to the dashboard page if already authenticated', function (): void {
1717
$this->actingAs($this->user)
1818
->get(route('login'))
19-
->assertRedirect(route('home'));
19+
->assertRedirect(route('dashboard'));
2020
});

tests/Feature/Controllers/Auth/AuthenticatedSessionController/StoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
test('users can authenticate using the login page', function (): void {
1212
$this->post(route('login'), getLoginData($this->user))
13-
->assertRedirect(route('home'));
13+
->assertRedirect(route('dashboard'));
1414

1515
$this->assertAuthenticated();
1616
});
@@ -57,7 +57,7 @@
5757
$user = User::factory()->withUnconfirmedTwoFactorAuth()->create();
5858

5959
$this->post(route('login'), getLoginData($user))
60-
->assertRedirect(route('home'));
60+
->assertRedirect(route('dashboard'));
6161
});
6262

6363
function getLoginData(User $user, bool $remember = false): array

tests/Feature/Controllers/Auth/RegisteredUserController/StoreTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
test('new users can register', function (): void {
99
$this->post(route('register'), getRegistrationData())
1010
->assertValid()
11-
->assertRedirect(route('home'));
11+
->assertRedirect(route('dashboard'));
1212

1313
$this->assertAuthenticated();
1414

@@ -25,7 +25,7 @@
2525
test('users are registered with the default locale when no locale is provided', function (): void {
2626
$this->post(route('register'), getRegistrationData(['language' => null]))
2727
->assertValid()
28-
->assertRedirect(route('home'));
28+
->assertRedirect(route('dashboard'));
2929

3030
$user = User::sole();
3131

@@ -35,7 +35,7 @@
3535
test('users are registered with the default locale when an invalid locale is provided', function (): void {
3636
$this->post(route('register'), getRegistrationData(['language' => 'invalid-locale']))
3737
->assertValid()
38-
->assertRedirect(route('home'));
38+
->assertRedirect(route('dashboard'));
3939

4040
$user = User::sole();
4141

tests/Feature/Controllers/Auth/TwoFactorAuthenticatedSessionController/StoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'code' => $validOtp,
2222
])
2323
->assertValid()
24-
->assertRedirect(route('home'))
24+
->assertRedirect(route('dashboard'))
2525
->assertSessionMissing(['login.id', 'login.remember']);
2626

2727
$this->assertAuthenticatedAs($this->user);
@@ -42,7 +42,7 @@
4242
'is_recovery' => true,
4343
])
4444
->assertValid()
45-
->assertRedirect(route('home'))
45+
->assertRedirect(route('dashboard'))
4646
->assertSessionMissing(['login.id', 'login.remember']);
4747

4848
$this->assertAuthenticatedAs($this->user);

tests/Feature/Controllers/Auth/VerifiedEmailController/ShowTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
$this->user->markEmailAsVerified();
1919

2020
$this->get(route('verification.notice'))
21-
->assertRedirect(route('home'));
21+
->assertRedirect(route('dashboard'));
2222
});

tests/Feature/Controllers/Auth/VerifiedEmailController/StoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
);
2323

2424
$this->get($verificationUrl)
25-
->assertRedirect(route('home'));
25+
->assertRedirect(route('dashboard'));
2626

2727
expect($this->user->hasVerifiedEmail())->toBeTrue();
2828

0 commit comments

Comments
 (0)