diff --git a/admin-spa/src/components/nav/SubmenuBar.tsx b/admin-spa/src/components/nav/SubmenuBar.tsx index 161d363..bfce836 100644 --- a/admin-spa/src/components/nav/SubmenuBar.tsx +++ b/admin-spa/src/components/nav/SubmenuBar.tsx @@ -26,8 +26,16 @@ export default function SubmenuBar({ items = [], fullscreen = false, headerVisib
{items.map((it) => { const key = `${it.label}-${it.path || it.href}`; - // Check if current path starts with the submenu path (for sub-pages like /settings/notifications/staff) - const isActive = !!it.path && (pathname === it.path || pathname.startsWith(it.path + '/')); + // Exact match for submenu items, or match with sub-paths (e.g., /settings/notifications matches /settings/notifications/staff) + // Special handling: if item has exact flag, only match exact path + let isActive = false; + if (it.path) { + if (it.exact) { + isActive = pathname === it.path; + } else { + isActive = pathname === it.path || pathname.startsWith(it.path + '/'); + } + } const cls = [ 'ui-ctrl inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 border text-sm whitespace-nowrap', 'focus:outline-none focus:ring-0 focus:shadow-none', diff --git a/customer-spa/src/hooks/useWishlist.ts b/customer-spa/src/hooks/useWishlist.ts index f8e4553..d78d9e8 100644 --- a/customer-spa/src/hooks/useWishlist.ts +++ b/customer-spa/src/hooks/useWishlist.ts @@ -49,11 +49,6 @@ export function useWishlist() { }, [isLoggedIn]); const addToWishlist = useCallback(async (productId: number) => { - if (!isLoggedIn) { - toast.error('Please login to add items to wishlist'); - return false; - } - try { await api.post('/account/wishlist', { product_id: productId }); await loadWishlist(); // Reload to get full product details @@ -64,11 +59,9 @@ export function useWishlist() { toast.error(message); return false; } - }, [isLoggedIn, loadWishlist]); + }, [loadWishlist]); const removeFromWishlist = useCallback(async (productId: number) => { - if (!isLoggedIn) return false; - try { await api.delete(`/account/wishlist/${productId}`); setItems(items.filter(item => item.product_id !== productId)); @@ -83,7 +76,7 @@ export function useWishlist() { toast.error('Failed to remove from wishlist'); return false; } - }, [isLoggedIn, items]); + }, [items]); const toggleWishlist = useCallback(async (productId: number) => { if (productIds.has(productId)) {