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
44 changes: 43 additions & 1 deletion public/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions src/lib/components/LinksMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { classnames } from "lib/utils/classnames";
import { getPublicPath } from 'lib/utils/paths';
import SubMenu from "./SubMenu.svelte";
import { NavigationHandler } from "../app-context/navigation-handler.model";
const chevronDownIconUrl = getPublicPath(`/assets/ic-chevron-down.svg`);

export let ref: Element | undefined = undefined;
Expand All @@ -13,12 +14,13 @@
export let activeRoute: NavMenuItem = undefined;
export let activeRoutePath: NavMenuItem[] = [];
export let vertical: boolean = false;
export let navigationHandler: NavigationHandler | undefined = undefined;
let hoveredMenuItem: NavMenuItem = undefined;
let hoveredElement: HTMLElement = undefined;
let isPopupMenuActive: boolean = false;

function isActiveMenu(menuItem: NavMenuItem) {
return activeRoute?.url !== undefined && menuItem.url === activeRoute?.url
function isActiveMenu(menuItem: NavMenuItem, activeMenuItem: NavMenuItem) {
return activeMenuItem?.url !== undefined && menuItem.url === activeMenuItem?.url
}

function itemHasHoverMenu(menuItem: NavMenuItem) {
Expand All @@ -42,6 +44,13 @@
itemHasHoverMenu(menuItem) && 'has-menu',
)
}

function handleNavigation(ev: MouseEvent) {
if (typeof navigationHandler === 'function') {
ev.preventDefault()
navigationHandler({label: '', path: (ev.target as HTMLAnchorElement).href});
}
}
</script>

<div class={classnames(styles.linksMenuWrap, vertical && styles.vertical)} bind:this={ref}>
Expand All @@ -50,13 +59,14 @@
<div class={styles.menuItemWrap}>
<a
class={getNavItemClassNames(menuItem)}
class:active={isActiveMenu(menuItem)}
class:active={isActiveMenu(menuItem, activeRoute)}
class:hover={isPopupMenuActive && hoveredMenuItem?.url === menuItem.url}
href={menuItem.url}
target={menuItem.target ?? '_top'}
data-key={menuItem.url}
on:mouseover={handleMouseover(menuItem)}
on:focus={handleMouseover(menuItem)}
on:click={handleNavigation}
>
{menuItem.label}
{#if itemHasHoverMenu(menuItem)}
Expand All @@ -68,6 +78,7 @@
menuItems={hoveredMenuItem?.children}
bind:isHovering={isPopupMenuActive}
activeRoute={activeRoutePath[1] ?? activeRoute}
navigationHandler={navigationHandler}
/>
{/if}
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/lib/components/SubMenu.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script lang="ts">
import type { NavMenuItem } from 'lib/functions/nav-menu-item.model';
import { NavigationHandler } from "../app-context/navigation-handler.model";
import { onMount } from 'svelte';
import styles from './SubMenu.module.scss';

export let menuItems: NavMenuItem[] = [];
export let isHovering: boolean = false;
export let activeRoute: NavMenuItem = undefined;
export let navigationHandler: NavigationHandler | undefined = undefined;

let elWrap: HTMLElement | undefined;

Expand All @@ -21,6 +23,13 @@
elWrap?.removeEventListener('mouseleave', handleMouseEv)
}
})

function handleNavigation(ev: MouseEvent) {
if (typeof navigationHandler === 'function') {
ev.preventDefault()
navigationHandler({label: '', path: (ev.target as HTMLAnchorElement).href});
}
}
</script>

{#if menuItems?.length}
Expand All @@ -32,6 +41,7 @@
class:active={activeRoute?.url === menuItem.url}
target={menuItem.target ?? '_top'}
href={menuItem.url}
on:click={handleNavigation}
>
{menuItem.label}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/TcLogo.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

img {
display: block;
height: 32px;
height: 64px;
}

.min {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/TopNavbar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

.topNavbarInner {
@include maxViewWidth;
padding: 18px 32px;
padding: 16px 32px;
display: flex;
align-items: center;
flex: 1 1 auto;
margin: 0 auto;

@include tablet {
padding: 18px 16px;
padding: 16px 16px;
}

@include mobile {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/config/hosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TC_DOMAIN: string = {


// export const WP_HOST_URL: string = `http://localhost:5173`;
export const WP_HOST_URL: string = `https://www.${TC_DOMAIN}`;
export const MARKETING_HOST_URL: string = `https://www.${TC_DOMAIN}`;
export const CHALLENGE_HOST: string = `https://www.${TC_DOMAIN}`;
export const COMMUNITY_HOST: string = `https://www.${TC_DOMAIN}`;

Expand Down
82 changes: 55 additions & 27 deletions src/lib/config/nav-menu/all-nav-items.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { getWordpressUrl } from "../../utils/paths";
import { getMarketingUrl } from "../../utils/paths";
import type { NavMenuItem } from "../../functions/nav-menu-item.model";

import {
CHALLENGE_HOST,
COMMUNITY_HOST,
CONNECT_HOST,
ONLINE_REVIEW_HOST,
SELF_SERVICE_HOST,
TALENT_SEARCH_HOST,
TCACADEMY_HOST,
THRIVE_HOST,
PLATFORM_APP_HOST,
WALLETAPP_HOST,
WORK_MANAGER_HOST,
Expand All @@ -19,54 +17,59 @@ import {
export const allNavItems: {[key: string]: NavMenuItem} = {
login: {
label: 'Login',
url: `${AUTH0_AUTHENTICATOR_URL}?retUrl=${encodeURIComponent(getWordpressUrl('/home'))}`
url: `${AUTH0_AUTHENTICATOR_URL}?retUrl=${encodeURIComponent(getMarketingUrl('/home'))}`
},
freelancer: {
label: 'I\'m a Freelancer',
url: getWordpressUrl('/freelancer'),
marketingPathname: '/freelancer',
url: getMarketingUrl('/freelancer'),
},
community: {
label: 'Community',
},
solutions: {
label: 'Solutions',
},
resources: {
label: 'Resources',
},
opportunities: {
label: 'Opportunities',
url: getWordpressUrl('/challenges'),
url: `${CHALLENGE_HOST}/challenges`,
},
mmTournament: {
label: 'Marathon Match Tournament',
icon: 'mm-tournament',
description: 'Join the Excitement',
url: getWordpressUrl('/marathon-match-tournament'),
marketingPathname: '/marathon-match-tournament',
url: getMarketingUrl('/marathon-match-tournament'),
},
aiHub: {
label: 'AI Hub',
icon: 'ai-hub',
description: 'Collaborate, Compete, Create',
url: getWordpressUrl('/ai-hub'),
marketingPathname: '/ai-hub',
url: getMarketingUrl('/ai-hub'),
},
howItWorks: {
label: 'How it works',
url: getWordpressUrl('/how-it-works'),
marketingPathname: '/how-it-works',
url: getMarketingUrl('/how-it-works'),
},
statistics: {
label: 'Statistics',
url: getWordpressUrl('/community/statistics'),
marketingPathname: '/community/statistics',
url: getMarketingUrl('/community/statistics'),
},
demo: {
label: 'Demo',
url: getWordpressUrl('/customer/demo'),
marketingPathname: '/customer/demo',
url: getMarketingUrl('/customer/demo'),
},
product: {
label: 'Product',
url: getWordpressUrl('/customer/product'),
},
customerStories: {
label: 'Customer Stories',
url: getWordpressUrl('/customer-stories'),
},
talent: {
label: 'The Talent',
url: getWordpressUrl('/talent'),
marketingPathname: '/customer/product',
url: getMarketingUrl('/customer/product'),
},
support: {
label: 'Support',
Expand All @@ -84,7 +87,8 @@ export const allNavItems: {[key: string]: NavMenuItem} = {
label: 'Articles',
icon: 'articles',
description: 'Get insights and tips about Topcoder',
url: getWordpressUrl('/thrive'),
marketingPathname: '/thrive',
url: getMarketingUrl('/thrive'),
},
bookADemo: {
label: 'Book a Demo',
Expand All @@ -106,7 +110,8 @@ export const allNavItems: {[key: string]: NavMenuItem} = {
},
home: {
label: 'Home',
url: getWordpressUrl(''),
marketingPathname: '/',
url: getMarketingUrl('/'),
},
marathonMatchesApp: {
label: 'Marathon Matches',
Expand Down Expand Up @@ -136,7 +141,7 @@ export const allNavItems: {[key: string]: NavMenuItem} = {
label: 'Community Home',
description: 'Recent challenges and news.',
icon: 'topcrowd',
url: getWordpressUrl('/home'),
url: `${COMMUNITY_HOST}/home`,
},
talentSearchApp: {
label: 'Meet our Talent',
Expand Down Expand Up @@ -170,14 +175,37 @@ export const allNavItems: {[key: string]: NavMenuItem} = {
},
bugHunt: {
label: 'Bug Hunt',
url: getWordpressUrl('/customer/product/bughunt'),
marketingPathname: '/customer/product/bughunt',
url: getMarketingUrl('/customer/product/bughunt'),
},
platform: {
label: 'Platform',
url: getWordpressUrl('/customer/product'),
marketingPathname: '/customer/product',
url: getMarketingUrl('/customer/product'),
},
innovationChallenges: {
label: 'Innovation Challenges',
url: getWordpressUrl('/innovation-challenges'),
}
marketingPathname: '/innovation-challenges',
url: getMarketingUrl('/innovation-challenges'),
},
tcSolutions: {
label: 'Topcoder Solutions',
marketingPathname: '/topcoder-solutions',
url: getMarketingUrl('/topcoder-solutions'),
},
projectLifecycle: {
label: 'Project Lifecycle',
marketingPathname: '/project-lifecycle',
url: getMarketingUrl('/project-lifecycle'),
},
customerStories: {
label: 'Customer Stories',
marketingPathname: '/customer-stories',
url: getMarketingUrl('/customer-stories'),
},
talent: {
label: 'The Talent',
marketingPathname: '/talent',
url: getMarketingUrl('/talent'),
},
}
14 changes: 7 additions & 7 deletions src/lib/config/nav-menu/footer-nav-items.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getWordpressUrl } from "lib/utils/paths";
import { getMarketingUrl } from "lib/utils/paths";
import type { NavMenuItem } from "../../functions/nav-menu-item.model";

import { allNavItems } from "./all-nav-items.config";
Expand All @@ -10,15 +10,15 @@ export const footerNavItems: NavMenuItem = {
children: [
{
label: 'How it Works',
url: getWordpressUrl('/how-it-works'),
url: getMarketingUrl('/how-it-works'),
},
{
label: 'The Talent',
url: getWordpressUrl('/talent'),
url: getMarketingUrl('/talent'),
},
{
label: 'Customer Stories',
url: getWordpressUrl('/customer-stories'),
url: getMarketingUrl('/customer-stories'),
},
]
},
Expand All @@ -27,7 +27,7 @@ export const footerNavItems: NavMenuItem = {
children: [
{
label: 'I\'m a Freelancer',
url: getWordpressUrl('/freelancer'),
url: getMarketingUrl('/freelancer'),
},
allNavItems.opportunities,
allNavItems.mmTournament,
Expand All @@ -42,11 +42,11 @@ export const footerNavItems: NavMenuItem = {
allNavItems.support,
{
label: 'Terms and Conditions',
url: getWordpressUrl('/community/how-it-works/terms')
url: getMarketingUrl('/community/how-it-works/terms')
},
{
label: 'Privacy Policy',
url: getWordpressUrl('/privacy')
url: getMarketingUrl('/privacy')
},
]
},
Expand Down
21 changes: 17 additions & 4 deletions src/lib/config/nav-menu/main-navigation.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,30 @@ import { allNavItems } from "./all-nav-items.config";

export const mainNavigationItems: NavMenuItem[] = [
allNavItems.howItWorks,
allNavItems.talent,
allNavItems.customerStories,
allNavItems.freelancer,
{
...allNavItems.solutions,
children: [
allNavItems.tcSolutions,
allNavItems.projectLifecycle,
allNavItems.customerStories,
allNavItems.talent,
],
},
{
...allNavItems.community,
children: [
allNavItems.freelancer,
allNavItems.opportunities,
allNavItems.mmTournament,
allNavItems.aiHub,
allNavItems.articles,
allNavItems.statistics,
]
},
{
...allNavItems.resources,
children: [
// allNavItems.blog,
allNavItems.articles,
],
},
]
1 change: 1 addition & 0 deletions src/lib/footer-navigation/FooterNavigation.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
margin-top: 0;
margin-bottom: 16px;
font-family: $nunito;
color: inherit;
}

p {
Expand Down
Loading