From 3aaee45981a411c8e4fa12ee8c3424c4f26ada97 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Fri, 26 Dec 2025 22:32:15 +0700 Subject: [PATCH] fix: Dashboard path and guest wishlist access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue 1 - Dashboard Always Active: Problem: Dashboard menu showed active on all routes Root Cause: Navigation tree used path='/' which matched all routes Solution: Changed dashboard path from '/' to '/dashboard' in NavigationRegistry - Main menu path: '/' → '/dashboard' - Overview submenu: '/' → '/dashboard' - SPA already had redirect from '/' to '/dashboard' Result: Dashboard only active on dashboard routes ✅ Issue 2 - Guest Wishlist Blocked: Problem: Heart icon required login despite enable_guest_wishlist setting Root Cause: Wishlist icon had user?.isLoggedIn check in frontend Solution: Removed isLoggedIn check from wishlist icon visibility - Backend already checks enable_guest_wishlist setting in check_permission() - Frontend now shows icon when module enabled + show_in_header setting - Guests can click and access wishlist (backend enforces permission) Result: Guest wishlist fully functional ✅ Files Modified (2): - includes/Compat/NavigationRegistry.php (dashboard path) - customer-spa/src/layouts/BaseLayout.tsx (removed login check) - admin-spa/dist/app.js + customer-spa/dist/app.js (rebuilt) Both issues resolved! --- customer-spa/src/layouts/BaseLayout.tsx | 2 +- includes/Compat/NavigationRegistry.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/customer-spa/src/layouts/BaseLayout.tsx b/customer-spa/src/layouts/BaseLayout.tsx index 58958f7..39dd037 100644 --- a/customer-spa/src/layouts/BaseLayout.tsx +++ b/customer-spa/src/layouts/BaseLayout.tsx @@ -135,7 +135,7 @@ function ClassicLayout({ children }: BaseLayoutProps) { ))} {/* Wishlist */} - {headerSettings.elements.wishlist && isEnabled('wishlist') && (wishlistSettings.show_in_header ?? true) && user?.isLoggedIn && ( + {headerSettings.elements.wishlist && isEnabled('wishlist') && (wishlistSettings.show_in_header ?? true) && ( Wishlist diff --git a/includes/Compat/NavigationRegistry.php b/includes/Compat/NavigationRegistry.php index 43682d7..9525eda 100644 --- a/includes/Compat/NavigationRegistry.php +++ b/includes/Compat/NavigationRegistry.php @@ -109,10 +109,10 @@ class NavigationRegistry { [ 'key' => 'dashboard', 'label' => __('Dashboard', 'woonoow'), - 'path' => '/', + 'path' => '/dashboard', 'icon' => 'layout-dashboard', 'children' => [ - ['label' => __('Overview', 'woonoow'), 'mode' => 'spa', 'path' => '/', 'exact' => true], + ['label' => __('Overview', 'woonoow'), 'mode' => 'spa', 'path' => '/dashboard', 'exact' => true], ['label' => __('Revenue', 'woonoow'), 'mode' => 'spa', 'path' => '/dashboard/revenue'], ['label' => __('Orders', 'woonoow'), 'mode' => 'spa', 'path' => '/dashboard/orders'], ['label' => __('Products', 'woonoow'), 'mode' => 'spa', 'path' => '/dashboard/products'],