Skip to content

Commit df549d5

Browse files
Merge pull request #5428 from topcoder-platform/develop
Release 2021/03/11 (v1.8.2)
2 parents 1f9f3be + 25d33a5 commit df549d5

File tree

10 files changed

+44
-12
lines changed

10 files changed

+44
-12
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ workflows:
283283
filters:
284284
branches:
285285
only:
286-
- gigwork-updates
286+
- route-redirects
287287
# This is alternate dev env for parallel testing
288288
- "build-qa":
289289
context : org-global
290290
filters:
291291
branches:
292292
only:
293-
- free
293+
- tco-leaderboard-fix
294294
# This is beta env for production soft releases
295295
- "build-prod-beta":
296296
context : org-global

src/shared/actions/recruitCRM.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { redux } from 'topcoder-react-utils';
22
import Service from 'services/recruitCRM';
33
import _ from 'lodash';
4+
import { getCustomField } from 'utils/gigs';
45

56
/**
67
* Jobs page fetch init
@@ -60,7 +61,7 @@ function normalizeRecruitPayload(job, payload) {
6061
`Date Available: ${new Date(payload.availFrom).toDateString()}`,
6162
`Heard About Gig: ${payload.reffereal}`,
6263
`Why fit: ${payload.whyFit}`,
63-
`Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(s => s.label).join(',')}`,
64+
`Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(() => getCustomField(job.custom_fields, 'Timezone')).join(',')}`,
6465
`Am I ok to work the duration? ${payload.durationConfirm.filter(s => s.value).map(s => s.label).join(',')}`,
6566
`Notes: ${payload.notes}`,
6667
];

src/shared/components/Contentful/Route.jsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import LoadingIndicator from 'components/LoadingIndicator';
1010
import MetaTags from 'components/MetaTags';
1111
import PT from 'prop-types';
1212
import React from 'react';
13-
import { Route, Switch } from 'react-router-dom';
13+
import { Route, Switch, Redirect } from 'react-router-dom';
1414
import Viewport from 'components/Contentful/Viewport';
1515
import PasswordScreen from 'components/Contentful/PasswordScreen';
16+
import { isomorphy } from 'topcoder-react-utils';
1617

1718
// Concatenates a base and segment and handles optional trailing slashes
1819
const buildUrl = (base, segment) => `${_.trimEnd(base, '/')}/${_.trim(segment, '/')}`;
@@ -117,6 +118,29 @@ ChildRoutesLoader.propTypes = {
117118
url: PT.string.isRequired,
118119
};
119120

121+
function RedirectWithStatus({ from, to, status }) {
122+
return (
123+
<Route
124+
render={({ staticContext }) => {
125+
if (to[0] !== '/' && isomorphy.isClientSide()) {
126+
window.location.href = to;
127+
return null;
128+
}
129+
// there is no `staticContext` on the client, so
130+
// we need to guard against that here
131+
if (staticContext) staticContext.status = status;
132+
return <Redirect from={from} to={to} />;
133+
}}
134+
/>
135+
);
136+
}
137+
138+
RedirectWithStatus.propTypes = {
139+
from: PT.string.isRequired,
140+
to: PT.string.isRequired,
141+
status: PT.number.isRequired,
142+
};
143+
120144
export default function ContentfulRoute(props) {
121145
const {
122146
baseUrl,
@@ -145,7 +169,10 @@ export default function ContentfulRoute(props) {
145169
render={(data) => {
146170
const { fields } = Object.values(data.entries.items)[0];
147171
const url = path || buildUrl(baseUrl, fields.url);
148-
return (
172+
const redirectToUrl = _.trim(fields.redirectToUrl);
173+
return redirectToUrl ? (
174+
<RedirectWithStatus status={301} from={url} to={redirectToUrl} />
175+
) : (
149176
<Route
150177
/* This route prevents fetching data about child routes and their
151178
* rendering, if they already known to not match. */

src/shared/components/Gigs/GigApply/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default function GigApply(props) {
121121
errorMsg={formErrors.email}
122122
value={formData.email}
123123
required
124+
readonly
124125
/>
125126
<TextInput
126127
placeholder="Phone Including Country Code"
@@ -289,7 +290,7 @@ export default function GigApply(props) {
289290
<div styleName="cta-buttons">
290291
<Link to={`${config.URL.AUTH}/member?retUrl=${encodeURIComponent(retUrl)}`} styleName="primaryBtn">Login</Link>
291292
</div>
292-
<p styleName="regTxt">Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
293+
<p styleName="regTxt">Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>here</a>.</p>
293294
</div>
294295
</div>
295296
</div>

src/shared/components/Gigs/GigDetails/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default function GigDetails(props) {
108108
<div styleName="infos-item">
109109
<IconTimezone />
110110
<div styleName="infos-data">
111-
Timezone
111+
Working Hours
112112
<strong>{getCustomField(job.custom_fields, 'Timezone')}</strong>
113113
</div>
114114
</div>

src/shared/components/Gigs/LoginModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function LoginModal({ retUrl, onCancel }) {
4040
LOGIN
4141
</PrimaryButton>
4242
</div>
43-
<p className={modalStyle.regTxt}>Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
43+
<p className={modalStyle.regTxt}>Not a member? It is free to <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>register</a>!</p>
4444
</div>
4545
</Modal>
4646
);

src/shared/components/Gigs/ReferralModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function ReferralModal({
105105
LOGIN
106106
</PrimaryButton>
107107
</div>
108-
<p className={modalStyle.regTxt}>Not a member? Register <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}`}>here</a>.</p>
108+
<p className={modalStyle.regTxt}>Not a member? It is free to <a href={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp&utm_source=gig_listing`}>register</a>!</p>
109109
</div>
110110
)}
111111
</Modal>

src/shared/containers/tco/Leaderboard/ChallengeHistoryModal/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import ChallengeHistoryModal from 'components/Leaderboard/ChallengeHistoryModal';
33
import PT from 'prop-types';
44
import actions from 'actions/leaderboard';
@@ -14,9 +14,9 @@ function ChallengeHistoryModalContainer({
1414
isCopilot,
1515
isAlgo,
1616
}) {
17-
if (!challenges && !loading) {
17+
useEffect(() => {
1818
getChallengesHistory(dataUrl, competitor);
19-
}
19+
}, [competitor]);
2020

2121
return (
2222
<ChallengeHistoryModal

src/shared/routes/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ function Routes({ communityId }) {
9797
path="/community/(competitive-programming|data-science|design|development|qa)/how-to-compete"
9898
/>
9999
<Redirect
100+
exact
100101
from="/community/gigs"
101102
to="/gigs"
102103
/>

src/shared/utils/gigs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import _ from 'lodash';
1010
*/
1111
export function getSalaryType(data) {
1212
switch (data.id) {
13+
case 1: return 'monthly';
1314
case 2: return 'annual';
1415
case 3: return 'week';
16+
case 4: return 'daily';
1517
case 5: return 'hourly';
1618
default: return 'n/a';
1719
}

0 commit comments

Comments
 (0)