feat: Public guest wishlist page + Dashboard Overview debug

Issue 1 - Dashboard > Overview Never Active:
Added debug logging to investigate why Overview submenu never shows active
- Console logs path, pathname, and isActive state
- Will help identify the root cause

Issue 2 - Guest Wishlist Public Page:
Problem: Guests couldn't access wishlist (redirected to login)
Solution: Created public /wishlist route accessible to all users

Implementation:
1. New Public Wishlist Page:
   - Route: /wishlist (not /my-account/wishlist)
   - Accessible to guests and logged-in users
   - Guest mode: Shows product IDs from localStorage
   - Logged-in mode: Shows full product details from API
   - Guests can view and remove items

2. Updated All Header Links:
   - ClassicLayout: /wishlist
   - ModernLayout: /wishlist
   - BoutiqueLayout: /wishlist
   - No more wp-login redirect for guests

3. Guest Experience:
   - See list of wishlisted product IDs
   - Click to view product details
   - Remove items from wishlist
   - Prompt to login for full details

Issue 3 - Wishlist Page Selector Setting:
Status: Deprecated/unused for SPA architecture
- SPA uses React Router, not WordPress pages
- Setting saved but has no effect
- Shareable wishlist would also be SPA route
- No need for page CPT selection

Files Modified:
- customer-spa/src/pages/Wishlist.tsx (new public page)
- customer-spa/src/App.tsx (added /wishlist route)
- customer-spa/src/hooks/useWishlist.ts (export productIds)
- customer-spa/src/layouts/BaseLayout.tsx (all themes use /wishlist)
- customer-spa/dist/app.js (rebuilt)
- admin-spa/src/components/nav/SubmenuBar.tsx (debug logging)
- admin-spa/dist/app.js (rebuilt)

Result:
 Guests can access wishlist page
 Guests can view and manage localStorage wishlist
 No login redirect for guest wishlist
 Debug logging added for Overview issue
This commit is contained in:
Dwindi Ramadhana
2025-12-26 23:16:40 +07:00
parent e64045b0e1
commit 9214172c79
5 changed files with 181 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import Cart from './pages/Cart';
import Checkout from './pages/Checkout';
import ThankYou from './pages/ThankYou';
import Account from './pages/Account';
import Wishlist from './pages/Wishlist';
// Create QueryClient instance
const queryClient = new QueryClient({
@@ -64,6 +65,9 @@ function App() {
<Route path="/checkout" element={<Checkout />} />
<Route path="/order-received/:orderId" element={<ThankYou />} />
{/* Wishlist - Public route accessible to guests */}
<Route path="/wishlist" element={<Wishlist />} />
{/* My Account */}
<Route path="/my-account/*" element={<Account />} />