Skip to content

Commit ab38c80

Browse files
committed
Update new Navi to Contentful integration
1 parent bec5232 commit ab38c80

File tree

1 file changed

+22
-36
lines changed
  • src/shared/containers/Contentful/MenuLoader

1 file changed

+22
-36
lines changed

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

+22-36
Original file line numberDiff line numberDiff line change
@@ -78,56 +78,42 @@ class MenuLoaderContainer extends React.Component {
7878
// eslint-disable-next-line global-require
7979
const { TopNav, LoginNav } = require('navigation-component');
8080
const logoToUse = !_.isEmpty(menuLogo) ? <img src={menuLogo.fields.file.url} alt="menu logo" /> : <Logo />;
81+
const comboMenu = _.clone(config.HEADER_MENU);
82+
comboMenu[1].subMenu = _.clone(menu[0].subMenu);
83+
let normalizedProfile = auth.profile && _.clone(auth.profile);
84+
if (auth.profile) {
85+
normalizedProfile.photoURL = (_.has(auth.profile, 'photoURL') && auth.profile.photoURL !== null)
86+
? `${config.CDN.PUBLIC}/avatar/${encodeURIComponent(auth.profile.photoURL)}?size=32` : '';
87+
} else {
88+
normalizedProfile = null;
89+
}
8190
return (
8291
<div>
8392
<TopNav
84-
menu={menu}
85-
logo={logoToUse}
86-
currentLevel1Id={activeLevel1Id}
87-
onChangeLevel1Id={this.handleChangeLevel1Id}
88-
path={path}
89-
openMore={openMore}
90-
setOpenMore={this.handleChangeOpenMore}
91-
loggedIn={!_.isEmpty(auth.profile)}
92-
// profileHandle={auth.profile ? auth.profile.handle : ''}
93+
menu={comboMenu}
9394
rightMenu={(
9495
<LoginNav
9596
loggedIn={!_.isEmpty(auth.profile)}
9697
notificationButtonState="none"
9798
notifications={[]}
98-
accountMenu={[
99-
{
100-
title: 'Settings',
101-
href: '/settings/profile',
102-
},
103-
{ separator: true },
104-
{
105-
title: 'Help',
106-
href: config.URL.HELP,
107-
},
108-
{
109-
title: 'About Topcoder',
110-
href: `${config.URL.BASE}/about/`,
111-
},
112-
{
113-
title: 'Log Out',
114-
href: `${config.URL.BASE}/logout`,
115-
},
116-
]}
99+
accountMenu={config.ACCOUNT_MENU}
117100
switchText={config.ACCOUNT_MENU_SWITCH_TEXT}
118101
onSwitch={this.handleSwitchMenu}
119102
onMenuOpen={this.handleCloseOpenMore}
120103
showNotification={false}
121-
profile={{
122-
...auth.profile,
123-
roles: auth.user ? auth.user.roles : [],
124-
}}
125-
authURLs={{
126-
href: `${config.URL.AUTH}/member/registration?utm_source=community-app-main`,
127-
location: `${config.URL.AUTH}/member?retUrl=%S&utm_source=community-app-main`,
128-
}}
104+
profile={normalizedProfile}
105+
authURLs={config.HEADER_AUTH_URLS}
129106
/>
130107
)}
108+
logo={logoToUse}
109+
theme={config.HEADER_MENU_THEME}
110+
currentLevel1Id={activeLevel1Id}
111+
onChangeLevel1Id={this.handleChangeLevel1Id}
112+
path={path}
113+
openMore={openMore}
114+
setOpenMore={this.handleChangeOpenMore}
115+
loggedIn={!_.isEmpty(auth.profile)}
116+
profileHandle={auth.profile ? auth.profile.handle : ''}
131117
/>
132118
</div>
133119
);

0 commit comments

Comments
 (0)