Skip to content

Commit c236857

Browse files
committed
Init TCO21 #4467
1 parent b1f1d08 commit c236857

File tree

6 files changed

+115
-8
lines changed

6 files changed

+115
-8
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"challengeFilter": {
3+
"tags": ["TCO", "TCO21"]
4+
},
5+
"communityId": "tco21",
6+
"communityName": "TCO21",
7+
"groupIds": [],
8+
"hideSearch": true,
9+
"logos": [{
10+
"img": "/community-app-assets/themes/tco/TCO21.svg",
11+
"url": "https://tco21.topcoder.com"
12+
}],
13+
"menuItems": [{
14+
"navigationMenu": "3UBKZJ0qMHAkqrobue73NB"
15+
}],
16+
"newsFeed": "http://www.topcoder.com/feed",
17+
"subdomains": ["tco21"],
18+
"description": "2021 Topcoder Open. The Ultimate Programming & Design Tournament",
19+
"image": "tco21.jpg"
20+
}

src/shared/actions/contentful.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,13 @@ async function getMenuDone(menuProps) {
181181
cR2.fields.childRoutes,
182182
cR3 => service.getEntry(cR3.sys.id).then(
183183
async (c3) => {
184-
const sI3 = menuItemBuilder(url2, c3);
184+
const url3 = urlTarget(url2, cR2);
185+
const sI3 = menuItemBuilder(url3, c3);
185186
if (c3.fields.childRoutes) {
186187
sI3.subMenu = await Promise.all(_.map(
187188
c3.fields.childRoutes,
188189
cR4 => service.getEntry(cR4.sys.id).then(
189-
c4 => menuItemBuilder(urlTarget(url2, c3), c4),
190+
c4 => menuItemBuilder(url3, c4),
190191
),
191192
));
192193
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ class MenuLoaderContainer extends React.Component {
7979
const { TopNav, LoginNav } = require('navigation-component');
8080
const logoToUse = !_.isEmpty(menuLogo) ? <img src={menuLogo.fields.file.url} alt="menu logo" /> : <Logo />;
8181
const menuTheme = fields.theme.split('- ');
82-
const comboMenu = _.flatten(_.map(menu, menuItem => menuItem.subMenu));
83-
// This is a hack fix that should be removed when possible!
84-
// Its orifing is in the https://github.com/topcoder-platform/navigation-component module
85-
// which breaks if there is NOT an menu item with id = `community`
86-
comboMenu[0].id = 'community';
8782
let normalizedProfile = auth.profile && _.clone(auth.profile);
8883
if (auth.profile) {
8984
normalizedProfile.photoURL = (_.has(auth.profile, 'photoURL') && auth.profile.photoURL !== null)
@@ -94,7 +89,7 @@ class MenuLoaderContainer extends React.Component {
9489
return (
9590
<div>
9691
<TopNav
97-
menu={comboMenu}
92+
menu={menu}
9893
rightMenu={(
9994
<LoginNav
10095
loggedIn={!_.isEmpty(auth.profile)}

src/shared/routes/Communities/Routes.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import tco17 from './TCO17';
3737
import tco18 from './TCO18';
3838
import tco19 from './TCO19';
3939
import tco20 from './TCO20';
40+
import tco21 from './TCO21';
4041
import Mobile from './Mobile';
4142
import Zurich from './Zurich';
4243
import Comcast from './Comcast';
@@ -62,6 +63,7 @@ const TCOs = {
6263
tco18,
6364
tco19,
6465
tco20,
66+
tco21,
6567
};
6668

6769
export default function Communities({
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Routing of TCO21 Community.
3+
*/
4+
5+
import Error404 from 'components/Error404';
6+
import PT from 'prop-types';
7+
import React from 'react';
8+
import { Route, Switch } from 'react-router-dom';
9+
import ContentfulRoute from 'components/Contentful/Route';
10+
import ContentfulMenu from 'components/Contentful/Menu';
11+
import Profile from 'routes/Profile';
12+
import ProfileStats from 'routes/ProfileStats';
13+
import Footer from 'components/TopcoderFooter';
14+
15+
export default function TCO21({ base, meta }) {
16+
return (
17+
<div>
18+
{
19+
meta.menuItems ? (
20+
<ContentfulMenu
21+
id={meta.menuItems[0].navigationMenu}
22+
spaceName={meta.menuItems[0].spaceName}
23+
environment={meta.menuItems[0].environment}
24+
baseUrl={base}
25+
/>
26+
) : null
27+
}
28+
<Switch>
29+
<Route
30+
render={props => <Profile {...props} meta={meta} />}
31+
exact
32+
path={`${base}/members/:handle([\\w\\-\\[\\].{}]{2,15})`}
33+
/>
34+
<Route
35+
render={props => <ProfileStats {...props} meta={meta} />}
36+
exact
37+
path={`${base}/members/:handle([\\w\\-\\[\\].{}]{2,15})/details`}
38+
/>
39+
<ContentfulRoute
40+
baseUrl={base}
41+
error404={<Error404 />}
42+
id="6wUJl6RRF6MxI3kR6DFq5t"
43+
/>
44+
</Switch>
45+
<Footer />
46+
</div>
47+
);
48+
}
49+
50+
TCO21.defaultProps = {
51+
base: '',
52+
};
53+
54+
TCO21.propTypes = {
55+
base: PT.string,
56+
meta: PT.shape().isRequired,
57+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Loader for the community's code chunks.
3+
*/
4+
5+
import LoadingIndicator from 'components/LoadingIndicator';
6+
import path from 'path';
7+
import PT from 'prop-types';
8+
import React from 'react';
9+
import { AppChunk, webpack } from 'topcoder-react-utils';
10+
11+
export default function ChunkLoader({ base, meta }) {
12+
return (
13+
<AppChunk
14+
chunkName="tco21-community/chunk"
15+
renderClientAsync={() => import(/* webpackChunkName: "tco21-community/chunk" */ './Routes')
16+
.then(({ default: Routes }) => (
17+
<Routes base={base} meta={meta} />
18+
))
19+
}
20+
renderPlaceholder={() => <LoadingIndicator />}
21+
renderServer={() => {
22+
const Routes = webpack.requireWeak(path.resolve(__dirname, './Routes'));
23+
return <Routes base={base} meta={meta} />;
24+
}}
25+
/>
26+
);
27+
}
28+
29+
ChunkLoader.propTypes = {
30+
base: PT.string.isRequired,
31+
meta: PT.shape().isRequired,
32+
};

0 commit comments

Comments
 (0)