Skip to content

Commit 7ee6533

Browse files
authored
Merge pull request #3544 from topcoder-platform/feature-contentful
Feature contentful
2 parents 107840d + 21c6208 commit 7ee6533

File tree

9 files changed

+67
-91
lines changed

9 files changed

+67
-91
lines changed

.circleci/config.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,14 @@ workflows:
175175
branches:
176176
only:
177177
- develop
178-
- hot-fix
179-
- survey_tc
180-
- fix-groups-updates
181-
- sort_registrations_submissions
182178
# This is alternate dev env for parallel testing
183179
- "build-test":
184180
context : org-global
185181
filters:
186182
branches:
187183
only:
188184
- develop
185+
- feature-contentful
189186
# This is beta env for production soft releases
190187
- "build-prod-beta":
191188
context : org-global

src/assets/images/img-Topcoder.png

52.2 KB
Loading

src/assets/images/new-arrow-left.svg

+7-10
Loading

src/assets/images/new-arrow-right.svg

+7-10
Loading

src/server/tc-communities/zurich/metadata.json

+4-18
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,10 @@
2222
"url": "https://www.topcoder.com"
2323
}],
2424
"footerText": "© Copyright Topcoder, 2019",
25-
"menuItems": [
26-
{
27-
"title": "Home",
28-
"url": "/"
29-
}, {
30-
"title": "How it works",
31-
"url": "/learn"
32-
}, {
33-
"title": "Catalog",
34-
"url": "/catalog"
35-
}, {
36-
"title": "FAQ",
37-
"url": "/faq"
38-
}, {
39-
"title": "Challenges",
40-
"url": "/challenges?communityId=zurich"
41-
}
42-
],
25+
"menuItems": [{
26+
"navigationMenu": "2rUBPkaTK3UInCz4h7GOZG",
27+
"spaceName": "zurich"
28+
}],
4329
"hideSearch": true,
4430
"newsFeed": "http://www.topcoder.com/feed",
4531
"subdomains": ["zurich", "community-zurich"],

src/shared/components/Contentful/ContentSlider/ContentSlider.jsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ContentSlider extends Component {
6363
onKeyPress={previousSlide}
6464
role="button"
6565
tabIndex={0}
66-
className={theme.control}
66+
className={theme.controlLeft}
6767
>
6868
<ArrowPrev />
6969
</a>
@@ -74,7 +74,7 @@ class ContentSlider extends Component {
7474
onKeyPress={nextSlide}
7575
role="button"
7676
tabIndex={0}
77-
className={theme.control}
77+
className={theme.controlRight}
7878
>
7979
<ArrowNext />
8080
</a>
@@ -109,7 +109,8 @@ ContentSlider.propTypes = {
109109
theme: PT.shape({
110110
container: PT.string,
111111
content: PT.string,
112-
control: PT.string,
112+
controlLeft: PT.string,
113+
controlRight: PT.string,
113114
multiContent: PT.any,
114115
singleContent: PT.any,
115116
}),

src/shared/components/Contentful/ContentSlider/themes/default.scss

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,18 @@
1818
width: 100%;
1919
}
2020

21-
.control {
21+
.controlLeft,
22+
.controlRight {
2223
border: 0;
2324
color: white;
2425
cursor: pointer;
2526
display: flex;
2627
}
28+
29+
.controlLeft {
30+
margin-left: 25px;
31+
}
32+
33+
.controlRight {
34+
margin-right: 25px;
35+
}

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
);

src/shared/routes/Communities/Zurich/Routes.jsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { connect } from 'react-redux';
1313
import Error404 from 'components/Error404';
1414
import FAQ from 'components/tc-communities/communities/zurich/FAQ';
1515
import Footer from 'components/tc-communities/communities/zurich/Footer';
16-
import Header from 'containers/tc-communities/Header';
1716
import Home from 'containers/tc-communities/zurich/Home';
1817
import Learn from 'components/tc-communities/communities/zurich/Learn';
1918
import ContentfulRoute from 'components/Contentful/Route';
@@ -22,8 +21,8 @@ import React from 'react';
2221
import theme from 'components/tc-communities/communities/zurich/theme';
2322
import { ThemeProvider } from 'react-css-super-themr';
2423
import { Route, Switch, Redirect } from 'react-router-dom';
25-
import { config } from 'topcoder-react-utils';
2624
import Viewport from 'components/Contentful/Viewport';
25+
import ContentfulMenu from 'components/Contentful/Menu';
2726

2827
function Zurich({ base, meta, userGroups }) {
2928
// Only members of `Requestor`|`Approver` gropus
@@ -65,15 +64,19 @@ function Zurich({ base, meta, userGroups }) {
6564
path={`${base}/forbidden`}
6665
/>
6766
<Route
68-
component={({ match }) => (
67+
component={() => (
6968
<ThemeProvider theme={theme}>
7069
<div>
71-
<Header
72-
baseUrl={base}
73-
pageId={match.params.pageId || 'home'}
74-
hideJoinNow
75-
logoutRedirect={config.URL.COMMUNITIES.ZURICH}
76-
/>
70+
{
71+
meta.menuItems ? (
72+
<ContentfulMenu
73+
id={meta.menuItems[0].navigationMenu}
74+
spaceName={meta.menuItems[0].spaceName}
75+
environment={meta.menuItems[0].environment}
76+
baseUrl={base}
77+
/>
78+
) : null
79+
}
7780
<Switch>
7881
<Route
7982
component={() => ChallengeListing({

0 commit comments

Comments
 (0)