Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a1377f8

Browse files
authored
Merge pull request #65 from topcoder-platform/dev-1_5
[DEV] Version 1.5
2 parents f219e3f + 83d1df1 commit a1377f8

File tree

11 files changed

+66
-30
lines changed

11 files changed

+66
-30
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ workflows:
7777
branches:
7878
only:
7979
- dev
80+
- dev-1_5
8081

8182
# Production builds are exectuted only on tagged commits to the
8283
# master branch.

config/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module.exports = (() => {
44
const env = process.env.APPENV || "dev";
55

6+
console.info(`APPENV: "${env}"`);
7+
68
// for security reason don't let to require any arbitrary file defined in process.env
79
if (["prod", "dev"].indexOf(env) < 0) {
810
return require("./dev");

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"start": "node server.js",
55
"dev": "webpack-dev-server --port 8501 --host 0.0.0.0",
66
"dev-https": "webpack-dev-server --https --port 8501 --host 0.0.0.0",
7-
"build": "webpack --mode=${APPMODE:-development} --env.config=${APPENV:-dev}",
7+
"build": "webpack --mode=${APPMODE:-production} --env.config=${APPENV:-prod}",
88
"analyze": "webpack --mode=production --env.analyze=true",
99
"lint": "eslint src --ext js",
1010
"format": "prettier --write \"./**\"",

src/components/LayoutContainer/index.jsx

-18
This file was deleted.

src/components/Page/index.jsx

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Page
3+
*
4+
* Handles common stuff for pages.
5+
* Should wrap each page.
6+
*/
7+
import React, { useEffect } from "react";
8+
import PT from "prop-types";
9+
import "./styles.module.scss";
10+
import { formatPageTitle } from "utils/format";
11+
12+
const Page = ({ children, title }) => {
13+
// set page title and triggering analytics
14+
useEffect(() => {
15+
// we set title manually like this instead of using `react-helmet` because of the issue:
16+
// https://github.com/nfl/react-helmet/issues/189
17+
document.title = formatPageTitle(title);
18+
19+
// call analytics if the parent Frame app initialized it
20+
if (window.analytics && typeof window.analytics.page === "function") {
21+
window.analytics.page();
22+
}
23+
}, [title]);
24+
25+
return <div styleName="page">{children}</div>;
26+
};
27+
28+
Page.propTypes = {
29+
children: PT.node,
30+
title: PT.string,
31+
};
32+
33+
export default Page;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.container {
1+
.page {
22
padding: 0 35px 32px;
33
}

src/routes/MyTeamsDetails/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import React from "react";
88
import PT from "prop-types";
9-
import LayoutContainer from "components/LayoutContainer";
9+
import Page from "components/Page";
1010
import PageHeader from "components/PageHeader";
1111
import { useData } from "hooks/useData";
1212
import { getTeamById } from "services/teams";
@@ -20,7 +20,7 @@ const MyTeamsDetails = ({ teamId }) => {
2020
const [team, loadingError] = useData(getTeamById, teamId);
2121

2222
return (
23-
<LayoutContainer>
23+
<Page title="Team Details">
2424
{!team ? (
2525
<LoadingIndicator error={loadingError} />
2626
) : (
@@ -31,7 +31,7 @@ const MyTeamsDetails = ({ teamId }) => {
3131
<TeamPositions positions={team.jobs || []} teamId={teamId} />
3232
</>
3333
)}
34-
</LayoutContainer>
34+
</Page>
3535
);
3636
};
3737

src/routes/MyTeamsList/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import React, { useCallback, useState, useEffect } from "react";
77
import _ from "lodash";
8-
import LayoutContainer from "components/LayoutContainer";
8+
import Page from "components/Page";
99
import PageHeader from "components/PageHeader";
1010
import Input from "components/Input";
1111
import Pagination from "components/Pagination";
@@ -60,7 +60,7 @@ const MyTeamsList = () => {
6060
);
6161

6262
return (
63-
<LayoutContainer>
63+
<Page title="My Teams">
6464
<PageHeader
6565
title="My Teams"
6666
aside={
@@ -95,7 +95,7 @@ const MyTeamsList = () => {
9595
)}
9696
</>
9797
)}
98-
</LayoutContainer>
98+
</Page>
9999
);
100100
};
101101

src/routes/PositionDetails/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import React, { useCallback, useState } from "react";
77
import PT from "prop-types";
8-
import LayoutContainer from "components/LayoutContainer";
8+
import Page from "components/Page";
99
import LoadingIndicator from "components/LoadingIndicator";
1010
import PageHeader from "components/PageHeader";
1111
import { CANDIDATE_STATUS } from "constants";
@@ -30,7 +30,7 @@ const PositionDetails = ({ teamId, positionId }) => {
3030
);
3131

3232
return (
33-
<LayoutContainer>
33+
<Page title="Job Details">
3434
{!position ? (
3535
<LoadingIndicator error={error} />
3636
) : (
@@ -53,7 +53,7 @@ const PositionDetails = ({ teamId, positionId }) => {
5353
/>
5454
</>
5555
)}
56-
</LayoutContainer>
56+
</Page>
5757
);
5858
};
5959

src/utils/format.js

+14
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,17 @@ export const formatDateRange = (startDate, endDate) => {
167167

168168
return `${startDateStr} - ${endDateStr}`;
169169
};
170+
171+
/**
172+
* Format page title to show in the browser header.
173+
*
174+
* @param {string} pageTitle page title
175+
*/
176+
export const formatPageTitle = (pageTitle) => {
177+
let formattedPageTitle = "TaaS | Topcoder";
178+
if (pageTitle) {
179+
formattedPageTitle = pageTitle + " | " + formattedPageTitle;
180+
}
181+
182+
return formattedPageTitle;
183+
};

webpack.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const path = require("path");
66
const autoprefixer = require("autoprefixer");
77

88

9-
const cssLocalIdent = process.env.APPMODE === "production"
9+
const cssLocalIdent = process.env.APPMODE === "production"
1010
? "[hash:base64:6]"
1111
: "teams_[path][name]___[local]___[hash:base64:6]";
1212

@@ -18,6 +18,10 @@ module.exports = (webpackConfigEnv) => {
1818
});
1919

2020
return webpackMerge.smart(defaultConfig, {
21+
output: {
22+
// path: path.resolve(__dirname, 'dist'),
23+
publicPath: 'taas-app',
24+
},
2125
// modify the webpack config however you'd like to by adding to this object
2226
module: {
2327
rules: [

0 commit comments

Comments
 (0)