Skip to content

Commit 3803a8f

Browse files
Merge pull request #5637 from topcoder-platform/navi-tco
Navi tco
2 parents 15e0eb1 + 45bbbd7 commit 3803a8f

File tree

6 files changed

+154
-10
lines changed

6 files changed

+154
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ workflows:
364364
filters:
365365
branches:
366366
only:
367-
- new-tabs-theme
367+
- free
368368
# This is stage env for production QA releases
369369
- "build-prod-staging":
370370
context : org-global

package-lock.json

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
"money": "^0.2.0",
8989
"morgan": "^1.9.0",
9090
"multer": "^1.4.2",
91-
"navigation-component": "topcoder-platform/navigation-component#develop",
91+
"navigation-component": "github:topcoder-platform/navigation-component#develop",
92+
"navigation-component-tco": "github:topcoder-platform/navigation-component-tco#new-dev",
9293
"node-forge": "^0.7.5",
9394
"nuka-carousel": "^4.5.3",
9495
"postcss": "^6.0.23",

src/shared/components/Contentful/Menu/index.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ export default function ContentfulMenu(props) {
244244
render={(menuData) => {
245245
const { fields } = Object.values(menuData.entries.items)[0];
246246
if (!fields) return null;
247-
if (fields.theme === 'General - light' || fields.theme === 'General - dark') {
247+
if (
248+
fields.theme === 'General - light'
249+
|| fields.theme === 'General - dark'
250+
|| fields.theme === 'TCO22 - dark'
251+
|| fields.theme === 'TCO22 - light'
252+
) {
248253
// New navi style menu
249254
// we deligate to special custom component and lib
250255
return (

src/shared/containers/Contentful/MenuLoader/index.jsx

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class MenuLoaderContainer extends React.Component {
7878
return <LoadingIndicator />;
7979
}
8080
if (isomorphy.isClientSide()) {
81-
// eslint-disable-next-line global-require
82-
const { TopNav, LoginNav } = require('navigation-component');
8381
const logoToUse = !_.isEmpty(menuLogo) ? <img src={menuLogo.fields.file.url} alt="menu logo" /> : <Logo />;
8482
const menuTheme = fields.theme.split('- ');
8583
let normalizedProfile = auth.profile && _.clone(auth.profile);
@@ -89,12 +87,14 @@ class MenuLoaderContainer extends React.Component {
8987
} else {
9088
normalizedProfile = null;
9189
}
92-
return (
93-
<div>
94-
<TopNav
90+
if (fields.theme.indexOf('TCO22') !== -1) {
91+
// eslint-disable-next-line global-require
92+
const { TopNav: TopNavTCO, LoginNav: LoginNavTCO } = require('navigation-component-tco');
93+
return (
94+
<TopNavTCO
9595
menu={menu}
9696
rightMenu={(
97-
<LoginNav
97+
<LoginNavTCO
9898
loggedIn={!_.isEmpty(auth.profile)}
9999
notificationButtonState="none"
100100
notifications={[]}
@@ -117,8 +117,41 @@ class MenuLoaderContainer extends React.Component {
117117
loggedIn={!_.isEmpty(auth.profile)}
118118
profileHandle={auth.profile ? auth.profile.handle : ''}
119119
logoLink={fields.logoLink}
120+
backToTcUrl={fields.backToTcUrl}
121+
backToTcUrlText={fields.backToTcUrlText}
120122
/>
121-
</div>
123+
);
124+
}
125+
// eslint-disable-next-line global-require
126+
const { TopNav, LoginNav } = require('navigation-component');
127+
return (
128+
<TopNav
129+
menu={menu}
130+
rightMenu={(
131+
<LoginNav
132+
loggedIn={!_.isEmpty(auth.profile)}
133+
notificationButtonState="none"
134+
notifications={[]}
135+
accountMenu={config.ACCOUNT_MENU}
136+
switchText={config.ACCOUNT_MENU_SWITCH_TEXT}
137+
onSwitch={this.handleSwitchMenu}
138+
onMenuOpen={this.handleCloseOpenMore}
139+
profile={normalizedProfile}
140+
auth={auth}
141+
authURLs={config.HEADER_AUTH_URLS}
142+
/>
143+
)}
144+
logo={logoToUse}
145+
theme={menuTheme[1]}
146+
currentLevel1Id={activeLevel1Id}
147+
onChangeLevel1Id={this.handleChangeLevel1Id}
148+
path={path}
149+
openMore={openMore}
150+
setOpenMore={this.handleChangeOpenMore}
151+
loggedIn={!_.isEmpty(auth.profile)}
152+
profileHandle={auth.profile ? auth.profile.handle : ''}
153+
logoLink={fields.logoLink}
154+
/>
122155
);
123156
}
124157
// no SSR for navi component yet

src/shared/utils/contentful.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export function menuItemBuilder(baseUrl, item) {
103103
title: item.fields.naviMenuLinkText || item.fields.name,
104104
href: item.fields.viewport ? target(baseUrl, item) : null,
105105
id: item.sys.id,
106+
imageSrc: item.fields.naviMenuLinkImage ? `https:${item.fields.naviMenuLinkImage.fields.file.url}` : null,
106107
};
107108
case 'navigationMenuItem':
108109
return {

0 commit comments

Comments
 (0)