Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/app-context/navigation-handler.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/lib/components/LinksMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
}
</script>
Expand All @@ -60,13 +60,13 @@
<a
class={getNavItemClassNames(menuItem)}
class:active={isActiveMenu(menuItem, activeRoute)}
class:hover={isPopupMenuActive && hoveredMenuItem?.url === menuItem.url}
class:hover={isPopupMenuActive && hoveredMenuItem?.label === menuItem.label}
href={menuItem.url}
target={menuItem.target ?? '_top'}
data-key={menuItem.url}
on:mouseover={handleMouseover(menuItem)}
on:focus={handleMouseover(menuItem)}
on:click={handleNavigation}
on:click={(ev) => handleNavigation(ev, menuItem)}
>
{menuItem.label}
{#if itemHasHoverMenu(menuItem)}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/SubMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
}
</script>
Expand All @@ -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}
</a>
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/user-area/UserArea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/marketing-navigation/MarketingNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions types/src/lib/app-context/navigation-handler.model.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export declare type NavigationHandler = (route: {
label: string;
path: string;
isMarketingUrl?: boolean;
}) => void;