diff --git a/src/lib/app-context/navigation-handler.model.ts b/src/lib/app-context/navigation-handler.model.ts index adeb7435..a93700c5 100644 --- a/src/lib/app-context/navigation-handler.model.ts +++ b/src/lib/app-context/navigation-handler.model.ts @@ -2,4 +2,4 @@ // but we removed the path property from the model and // made the url property required. So for backwards compatibility // we need to leave the property named path. -export type NavigationHandler = (route: { label: string, path: string }) => void +export type NavigationHandler = (route: { label: string, path: string, isMarketingUrl?: boolean }) => void diff --git a/src/lib/components/LinksMenu.svelte b/src/lib/components/LinksMenu.svelte index 9ed85dfe..e7806456 100644 --- a/src/lib/components/LinksMenu.svelte +++ b/src/lib/components/LinksMenu.svelte @@ -45,10 +45,10 @@ ) } - function handleNavigation(ev: MouseEvent) { + function handleNavigation(ev: MouseEvent, menuItem: NavMenuItem) { if (typeof navigationHandler === 'function') { ev.preventDefault() - navigationHandler({label: '', path: (ev.target as HTMLAnchorElement).href}); + navigationHandler({label: '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); } } @@ -60,13 +60,13 @@ handleNavigation(ev, menuItem)} > {menuItem.label} {#if itemHasHoverMenu(menuItem)} diff --git a/src/lib/components/SubMenu.svelte b/src/lib/components/SubMenu.svelte index db48c3b4..ee896811 100644 --- a/src/lib/components/SubMenu.svelte +++ b/src/lib/components/SubMenu.svelte @@ -24,10 +24,10 @@ } }) - function handleNavigation(ev: MouseEvent) { + function handleNavigation(ev: MouseEvent, menuItem: NavMenuItem) { if (typeof navigationHandler === 'function') { ev.preventDefault() - navigationHandler({label: '', path: (ev.target as HTMLAnchorElement).href}); + navigationHandler({label: '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); } } @@ -41,7 +41,7 @@ class:active={activeRoute?.url === menuItem.url} target={menuItem.target ?? '_top'} href={menuItem.url} - on:click={handleNavigation} + on:click={(ev) => handleNavigation(ev, menuItem)} > {menuItem.label} diff --git a/src/lib/components/user-area/UserArea.svelte b/src/lib/components/user-area/UserArea.svelte index 75e9188e..4927775f 100644 --- a/src/lib/components/user-area/UserArea.svelte +++ b/src/lib/components/user-area/UserArea.svelte @@ -8,7 +8,6 @@ import { DISABLE_NUDGES } from "lib/config/profile-toasts.config"; import ToolSelector from '../tool-selector/ToolSelector.svelte'; - import VerticalSeparator from '../VerticalSeparator.svelte'; import UserAvatar from './UserAvatar.svelte'; import styles from './UserArea.module.scss' diff --git a/src/lib/marketing-navigation/MarketingNavigation.svelte b/src/lib/marketing-navigation/MarketingNavigation.svelte index 1aeed4f3..90c85db9 100644 --- a/src/lib/marketing-navigation/MarketingNavigation.svelte +++ b/src/lib/marketing-navigation/MarketingNavigation.svelte @@ -24,7 +24,7 @@ $: menuItems = customMenuItems ?? getMainNavItems(isAuthenticated) let activeRoute: NavMenuItem[] = []; - $: activeRoute = getActiveRoute(menuItems, 0, $windowLocation) + $: activeRoute = getActiveRoute(menuItems, undefined, $windowLocation) let primaryRoute: NavMenuItem; let secondaryRoute: NavMenuItem; diff --git a/types/src/lib/app-context/navigation-handler.model.d.ts b/types/src/lib/app-context/navigation-handler.model.d.ts index b639a93c..c74b9db7 100644 --- a/types/src/lib/app-context/navigation-handler.model.d.ts +++ b/types/src/lib/app-context/navigation-handler.model.d.ts @@ -1,4 +1,5 @@ export declare type NavigationHandler = (route: { label: string; path: string; + isMarketingUrl?: boolean; }) => void;