Skip to content

Commit 173c555

Browse files
committed
Implement #5564
1 parent fe5d80c commit 173c555

File tree

4 files changed

+114
-0
lines changed

4 files changed

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

src/shared/routes/Communities/Routes.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import tco18 from './TCO18';
3838
import tco19 from './TCO19';
3939
import tco20 from './TCO20';
4040
import tco21 from './TCO21';
41+
import tco22 from './TCO22';
4142
import Mobile from './Mobile';
4243
import Zurich from './Zurich';
4344
import Comcast from './Comcast';
@@ -64,6 +65,7 @@ const TCOs = {
6465
tco19,
6566
tco20,
6667
tco21,
68+
tco22,
6769
};
6870

6971
export default function Communities({
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Routing of TCO22 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 Settings from 'routes/Settings';
14+
15+
export default function TCO22({ 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+
<Route
40+
component={() => <Settings base={`${base}/settings`} />}
41+
path={`${base}/settings`}
42+
/>
43+
<ContentfulRoute
44+
baseUrl={base}
45+
error404={<Error404 />}
46+
id="6Ewcb5fkc67JOMhud6RoBs"
47+
/>
48+
</Switch>
49+
</div>
50+
);
51+
}
52+
53+
TCO22.defaultProps = {
54+
base: '',
55+
};
56+
57+
TCO22.propTypes = {
58+
base: PT.string,
59+
meta: PT.shape().isRequired,
60+
};
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="tco22-community/chunk"
15+
renderClientAsync={() => import(/* webpackChunkName: "tco22-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)