Header: account and wishlist links no longer depend on login
Both links are now the same for every visitor, so the header can be
cached:
- Account always goes to route('account'); the auth middleware sends
guests to login, and after login they land back on the account page
(url.intended) instead of home.
- Wishlist always goes to route('wishlist'); WishlistController::guest
already redirects logged-in users to account.wishlist.
- One neutral label, storefront.nav.account, on desktop and mobile.
header.blade.php no longer calls auth().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fc7880187
commit
702609da1e
1 file changed
+11
-9
@@ -45,9 +45,10 @@
|
||||
</a>
|
||||
@endforeach
|
||||
|
||||
{{-- Wishlist — the account page, or the cookie-based guest page --}}
|
||||
{{-- Wishlist — always the guest page, which sends logged-in users on
|
||||
to the account version, so the header doesn't depend on login --}}
|
||||
<a
|
||||
href="{{ auth()->check() ? route('account.wishlist') : route('wishlist') }}"
|
||||
href="{{ route('wishlist') }}"
|
||||
class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
|
||||
aria-label="{{ __('storefront.account.nav_wishlist') }}"
|
||||
@if (request()->routeIs('account.wishlist', 'wishlist')) aria-current="page" @endif
|
||||
@@ -55,13 +56,14 @@ class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 tra
|
||||
<x-ui.icon name="heart" :size="40" />
|
||||
</a>
|
||||
|
||||
{{-- Account — the account page, or login for guests. [data-account-link]
|
||||
is the island target shared with the mobile menu's link. --}}
|
||||
{{-- Account — always the account page; the auth middleware sends
|
||||
guests to login. [data-account-link] is the island target shared
|
||||
with the mobile menu's link. --}}
|
||||
<a
|
||||
data-account-link
|
||||
href="{{ auth()->check() ? route('account') : route('login') }}"
|
||||
href="{{ route('account') }}"
|
||||
class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
|
||||
aria-label="{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}"
|
||||
aria-label="{{ __('storefront.nav.account') }}"
|
||||
>
|
||||
<x-ui.icon name="user" :size="40" />
|
||||
</a>
|
||||
@@ -180,7 +182,7 @@ class="mobile-menu fixed inset-x-0 top-20 bottom-auto m-0 max-h-[calc(100dvh-5re
|
||||
<ul class="flex flex-col gap-4 border-t border-black pt-6">
|
||||
<li>
|
||||
<a
|
||||
href="{{ auth()->check() ? route('account.wishlist') : route('wishlist') }}"
|
||||
href="{{ route('wishlist') }}"
|
||||
class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
|
||||
@if (request()->routeIs('account.wishlist', 'wishlist')) aria-current="page" @endif
|
||||
>
|
||||
@@ -191,11 +193,11 @@ class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
|
||||
<li>
|
||||
<a
|
||||
data-account-link
|
||||
href="{{ auth()->check() ? route('account') : route('login') }}"
|
||||
href="{{ route('account') }}"
|
||||
class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
|
||||
>
|
||||
<x-ui.icon name="user" :size="28" />
|
||||
<span>{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}</span>
|
||||
<span>{{ __('storefront.nav.account') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
@foreach ($altLocales ?? [] as $altLocale)
|
||||
|
||||
Reference in new issue
Block a user