diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fe405c05b..3b0049b420 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -283,14 +283,14 @@ workflows: filters: branches: only: - - gigwork-updates + - route-redirects # This is alternate dev env for parallel testing - "build-qa": context : org-global filters: branches: only: - - free + - tco-leaderboard-fix # This is beta env for production soft releases - "build-prod-beta": context : org-global diff --git a/src/shared/actions/recruitCRM.js b/src/shared/actions/recruitCRM.js index 0cd9290b51..1b9b127f25 100644 --- a/src/shared/actions/recruitCRM.js +++ b/src/shared/actions/recruitCRM.js @@ -1,6 +1,7 @@ import { redux } from 'topcoder-react-utils'; import Service from 'services/recruitCRM'; import _ from 'lodash'; +import { getCustomField } from 'utils/gigs'; /** * Jobs page fetch init @@ -60,7 +61,7 @@ function normalizeRecruitPayload(job, payload) { `Date Available: ${new Date(payload.availFrom).toDateString()}`, `Heard About Gig: ${payload.reffereal}`, `Why fit: ${payload.whyFit}`, - `Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(s => s.label).join(',')}`, + `Able to work during timezone? ${payload.timezoneConfirm.filter(s => s.value).map(() => getCustomField(job.custom_fields, 'Timezone')).join(',')}`, `Am I ok to work the duration? ${payload.durationConfirm.filter(s => s.value).map(s => s.label).join(',')}`, `Notes: ${payload.notes}`, ]; diff --git a/src/shared/components/Contentful/Route.jsx b/src/shared/components/Contentful/Route.jsx index 8085e1ccc0..8af288d58f 100644 --- a/src/shared/components/Contentful/Route.jsx +++ b/src/shared/components/Contentful/Route.jsx @@ -10,9 +10,10 @@ import LoadingIndicator from 'components/LoadingIndicator'; import MetaTags from 'components/MetaTags'; import PT from 'prop-types'; import React from 'react'; -import { Route, Switch } from 'react-router-dom'; +import { Route, Switch, Redirect } from 'react-router-dom'; import Viewport from 'components/Contentful/Viewport'; import PasswordScreen from 'components/Contentful/PasswordScreen'; +import { isomorphy } from 'topcoder-react-utils'; // Concatenates a base and segment and handles optional trailing slashes const buildUrl = (base, segment) => `${_.trimEnd(base, '/')}/${_.trim(segment, '/')}`; @@ -117,6 +118,29 @@ ChildRoutesLoader.propTypes = { url: PT.string.isRequired, }; +function RedirectWithStatus({ from, to, status }) { + return ( + { + if (to[0] !== '/' && isomorphy.isClientSide()) { + window.location.href = to; + return null; + } + // there is no `staticContext` on the client, so + // we need to guard against that here + if (staticContext) staticContext.status = status; + return ; + }} + /> + ); +} + +RedirectWithStatus.propTypes = { + from: PT.string.isRequired, + to: PT.string.isRequired, + status: PT.number.isRequired, +}; + export default function ContentfulRoute(props) { const { baseUrl, @@ -145,7 +169,10 @@ export default function ContentfulRoute(props) { render={(data) => { const { fields } = Object.values(data.entries.items)[0]; const url = path || buildUrl(baseUrl, fields.url); - return ( + const redirectToUrl = _.trim(fields.redirectToUrl); + return redirectToUrl ? ( + + ) : ( Login -

Not a member? Register here.

+

Not a member? Register here.

diff --git a/src/shared/components/Gigs/GigDetails/index.jsx b/src/shared/components/Gigs/GigDetails/index.jsx index 1eca1ab48d..c6faae5040 100644 --- a/src/shared/components/Gigs/GigDetails/index.jsx +++ b/src/shared/components/Gigs/GigDetails/index.jsx @@ -108,7 +108,7 @@ export default function GigDetails(props) {
- Timezone + Working Hours {getCustomField(job.custom_fields, 'Timezone')}
diff --git a/src/shared/components/Gigs/LoginModal/index.jsx b/src/shared/components/Gigs/LoginModal/index.jsx index 978cc6bdea..7bc255789b 100644 --- a/src/shared/components/Gigs/LoginModal/index.jsx +++ b/src/shared/components/Gigs/LoginModal/index.jsx @@ -40,7 +40,7 @@ function LoginModal({ retUrl, onCancel }) { LOGIN -

Not a member? Register here.

+

Not a member? It is free to register!

); diff --git a/src/shared/components/Gigs/ReferralModal/index.jsx b/src/shared/components/Gigs/ReferralModal/index.jsx index 912ac39602..25820d8c44 100644 --- a/src/shared/components/Gigs/ReferralModal/index.jsx +++ b/src/shared/components/Gigs/ReferralModal/index.jsx @@ -105,7 +105,7 @@ function ReferralModal({ LOGIN -

Not a member? Register here.

+

Not a member? It is free to register!

)} diff --git a/src/shared/containers/tco/Leaderboard/ChallengeHistoryModal/index.jsx b/src/shared/containers/tco/Leaderboard/ChallengeHistoryModal/index.jsx index 0680acbe4f..165c8c4a7a 100644 --- a/src/shared/containers/tco/Leaderboard/ChallengeHistoryModal/index.jsx +++ b/src/shared/containers/tco/Leaderboard/ChallengeHistoryModal/index.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import ChallengeHistoryModal from 'components/Leaderboard/ChallengeHistoryModal'; import PT from 'prop-types'; import actions from 'actions/leaderboard'; @@ -14,9 +14,9 @@ function ChallengeHistoryModalContainer({ isCopilot, isAlgo, }) { - if (!challenges && !loading) { + useEffect(() => { getChallengesHistory(dataUrl, competitor); - } + }, [competitor]); return ( diff --git a/src/shared/utils/gigs.js b/src/shared/utils/gigs.js index fa08f36579..3c9ba53a8c 100644 --- a/src/shared/utils/gigs.js +++ b/src/shared/utils/gigs.js @@ -10,8 +10,10 @@ import _ from 'lodash'; */ export function getSalaryType(data) { switch (data.id) { + case 1: return 'monthly'; case 2: return 'annual'; case 3: return 'week'; + case 4: return 'daily'; case 5: return 'hourly'; default: return 'n/a'; }