diff --git a/admin-spa/src/App.tsx b/admin-spa/src/App.tsx index 574a791..3a164e0 100644 --- a/admin-spa/src/App.tsx +++ b/admin-spa/src/App.tsx @@ -132,6 +132,7 @@ function ActiveNavLink({ to, startsWith, end, className, children, childPaths }: function Sidebar() { const link = "flex items-center gap-2 rounded-md px-3 py-2 hover:bg-accent hover:text-accent-foreground shadow-none hover:shadow-none focus:shadow-none focus:outline-none focus:ring-0"; const active = "bg-secondary"; + const { main } = useActiveSection(); // Icon mapping const iconMap: Record = { @@ -153,19 +154,16 @@ function Sidebar() { @@ -177,6 +175,7 @@ function TopNav({ fullscreen = false }: { fullscreen?: boolean }) { const link = "inline-flex items-center gap-2 rounded-md px-3 py-2 hover:bg-accent hover:text-accent-foreground shadow-none hover:shadow-none focus:shadow-none focus:outline-none focus:ring-0"; const active = "bg-secondary"; const topClass = fullscreen ? 'top-16' : 'top-[calc(4rem+32px)]'; + const { main } = useActiveSection(); // Icon mapping (same as Sidebar) const iconMap: Record = { @@ -198,19 +197,16 @@ function TopNav({ fullscreen = false }: { fullscreen?: boolean }) {
{navTree.map((item: any) => { const IconComponent = iconMap[item.icon] || Package; - // Extract child paths for matching - const childPaths = item.children?.map((child: any) => child.path).filter(Boolean) || []; + const isActive = main.key === item.key; return ( - `${link} ${isActive ? active : ''}`} + to={item.path} + className={`${link} ${isActive ? active : ''}`} > {item.label} - + ); })}
diff --git a/customer-spa/src/layouts/BaseLayout.tsx b/customer-spa/src/layouts/BaseLayout.tsx index 39dd037..8c11669 100644 --- a/customer-spa/src/layouts/BaseLayout.tsx +++ b/customer-spa/src/layouts/BaseLayout.tsx @@ -365,6 +365,8 @@ function ModernLayout({ children }: BaseLayoutProps) { const storeName = (window as any).woonoowCustomer?.storeName || (window as any).woonoowCustomer?.siteTitle || 'Store Title'; const user = (window as any).woonoowCustomer?.user; const headerSettings = useHeaderSettings(); + const { isEnabled } = useModules(); + const { settings: wishlistSettings } = useModuleSettings('wishlist'); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [searchOpen, setSearchOpen] = useState(false); @@ -426,6 +428,11 @@ function ModernLayout({ children }: BaseLayoutProps) { ) )} + {headerSettings.elements.wishlist && isEnabled('wishlist') && (wishlistSettings.show_in_header ?? true) && ( + + Wishlist + + )} {headerSettings.elements.cart && ( Cart ({itemCount}) @@ -493,6 +500,8 @@ function BoutiqueLayout({ children }: BaseLayoutProps) { const storeName = (window as any).woonoowCustomer?.storeName || (window as any).woonoowCustomer?.siteTitle || 'BOUTIQUE'; const user = (window as any).woonoowCustomer?.user; const headerSettings = useHeaderSettings(); + const { isEnabled } = useModules(); + const { settings: wishlistSettings } = useModuleSettings('wishlist'); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [searchOpen, setSearchOpen] = useState(false); @@ -552,6 +561,11 @@ function BoutiqueLayout({ children }: BaseLayoutProps) { Account ))} + {headerSettings.elements.wishlist && isEnabled('wishlist') && (wishlistSettings.show_in_header ?? true) && ( + + Wishlist + + )} {headerSettings.elements.cart && ( Cart ({itemCount})