From e7051837c1001f017ab73cab090d6080364e4435 Mon Sep 17 00:00:00 2001 From: dengjun Date: Sat, 17 Jul 2021 18:07:48 +0800 Subject: [PATCH 01/24] API update finished --- .circleci/config.yml | 2 +- src/api/app-constants.js | 54 +++++++++++ src/api/common/helper.js | 108 ++++++++++++++++++++++ src/api/docs/swagger.yaml | 6 ++ src/api/services/JobApplicationService.js | 26 +++++- 5 files changed, 193 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0cb6119..f7c459c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,7 +76,7 @@ workflows: filters: branches: only: - - dev + - gigs-filter # Production builds are exectuted only on tagged commits to the # master branch. diff --git a/src/api/app-constants.js b/src/api/app-constants.js index c9b6691..495ed42 100644 --- a/src/api/app-constants.js +++ b/src/api/app-constants.js @@ -11,6 +11,60 @@ const Scopes = { ALL_PROFILE: "all:earn-profile", }; +const MY_GIGS_JOB_STATUS = { + APPLIED: "applied", + SKILLS_TEST: "skills-test", + PHONE_SCREEN: "phone-screen", + SCREEN_PASS: "open", + INTERVIEW: "interview", + SELECTED: "selected", + OFFERED: "offered", + PLACED: "placed", + REJECTED_OTHER: "rejected - other", + REJECTED_PRE_SCREEN: "rejected-pre-screen", + CLIENT_REJECTED_INTERVIEW: "client rejected - interview", + CLIENT_REJECTED_SCREENING: "client rejected - screening", + JOB_CLOSED: "job-closed", +}; + +const JOB_APPLICATION_STATUS_MAPPER = { + open_jobs: { + statuses: [ + MY_GIGS_JOB_STATUS.SKILLS_TEST, + MY_GIGS_JOB_STATUS.PHONE_SCREEN, + MY_GIGS_JOB_STATUS.SCREEN_PASS, + MY_GIGS_JOB_STATUS.INTERVIEW, + MY_GIGS_JOB_STATUS.SELECTED, + MY_GIGS_JOB_STATUS.OFFERED, + MY_GIGS_JOB_STATUS.PLACED, + ], + }, + completed_jobs: { + statuses: [MY_GIGS_JOB_STATUS.PLACED], + }, + archived_jobs: { + statuses: [ + MY_GIGS_JOB_STATUS.SKILLS_TEST, + MY_GIGS_JOB_STATUS.PHONE_SCREEN, + MY_GIGS_JOB_STATUS.SCREEN_PASS, + MY_GIGS_JOB_STATUS.INTERVIEW, + MY_GIGS_JOB_STATUS.SELECTED, + MY_GIGS_JOB_STATUS.OFFERED, + MY_GIGS_JOB_STATUS.JOB_CLOSED, + MY_GIGS_JOB_STATUS.REJECTED_OTHER, + MY_GIGS_JOB_STATUS.REJECTED_PRE_SCREEN, + MY_GIGS_JOB_STATUS.CLIENT_REJECTED_INTERVIEW, + MY_GIGS_JOB_STATUS.CLIENT_REJECTED_SCREENING, + MY_GIGS_JOB_STATUS.PLACED, + ], + }, +}; + +const MIN_HOUR_PER_WEEK_TO_WITHDRAW = 20; + module.exports = { Scopes, + MY_GIGS_JOB_STATUS, + JOB_APPLICATION_STATUS_MAPPER, + MIN_HOUR_PER_WEEK_TO_WITHDRAW, }; diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 802346b..3c13fbf 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -4,6 +4,7 @@ const _ = require("lodash"); const config = require("config"); +const constants = require("../app-constants"); const logger = require("./logger"); const httpStatus = require("http-status"); const Interceptor = require("express-interceptor"); @@ -265,10 +266,18 @@ async function getCurrentUserDetails(token) { */ async function getJobCandidates(criteria) { const token = await getM2MToken(); + let body = { statuses: [] }; + if (criteria.status) { + body = constants.JOB_APPLICATION_STATUS_MAPPER[criteria.status] || { + statuses: [], + }; + } + delete criteria.status; const url = `${config.API.V5}/jobCandidates`; const res = await request .get(url) .query(criteria) + .send(body) .set("Authorization", `Bearer ${token}`) .set("Accept", "application/json"); localLogger.debug({ @@ -283,6 +292,103 @@ async function getJobCandidates(criteria) { }; } +/** + * + * @param {*} jobCandidates + * @param {*} userId + * @returns + */ +async function handlePlacedJobCandidates(jobCandidates, userId) { + if (!jobCandidates || jobCandidates.length == 0 || !userId) { + return; + } + const placedJobs = jobCandidates.filter( + (item) => item.status == constants.MY_GIGS_JOB_STATUS.PLACED + ); + if (placedJobs.length == 0) { + return; + } + const token = await getM2MToken(); + const url = `${config.API.V5}/resourceBookings`; + const criteria = { + userId: userId, + page: 1, + perPage: placedJobs.length, + }; + const body = { + jobIds: _.map(placedJobs, "jobId"), + }; + const res = await request + .get(url) + .query(criteria) + .send(body) + .set("Authorization", `Bearer ${token}`) + .set("Accept", "application/json"); + localLogger.debug({ + context: "handlePlacedJobCandidates", + message: `response body: ${JSON.stringify(res.body)}`, + }); + if (res.body && res.body.length == 0) { + return; + } + // Handle placed job status with RB result + const rbRes = res.body; + _.each(rbRes, (rb) => { + const jc = jobCandidates.find( + (item) => item.userId == rb.userId && item.jobId == rb.jobId + ); + if (jc) { + // jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed' + jc.completed = new Date(rb.endDate) <= new Date(); + } + }); + return; +} + +function handleArchivedJobCandidates(jobCandidates, jobs) { + if ( + !jobCandidates || + jobCandidates.length == 0 || + !jobs || + jobs.length == 0 + ) { + return; + } + // find at least one placed jobCandidate whose job is having hoursPerWeek >= 20 + // if true, assign all open application with a withdraw status = true + // else, assign all open application with a withdraw status = false + let assignWithDraw = false; + const jcs = jobCandidates.filter( + (item) => + item.status == constants.MY_GIGS_JOB_STATUS.PLACED && !item.completed + ); + _.each(jcs, (jc) => { + const job = _.find(jobs, ["id", jc.jobId]); + if (job.hoursPerWeek >= constants.MIN_HOUR_PER_WEEK_TO_WITHDRAW) { + assignWithDraw = true; + return; + } + }); + + const openJobs = [ + constants.MY_GIGS_JOB_STATUS.SKILLS_TEST, + constants.MY_GIGS_JOB_STATUS.PHONE_SCREEN, + constants.MY_GIGS_JOB_STATUS.SCREEN_PASS, + constants.MY_GIGS_JOB_STATUS.INTERVIEW, + constants.MY_GIGS_JOB_STATUS.SELECTED, + constants.MY_GIGS_JOB_STATUS.OFFERED, + ]; + _.each(jobCandidates, (jobCandidate) => { + if (openJobs.indexOf(jobCandidate.status) >= 0) { + jobCandidate.withdraw = assignWithDraw; + } else if (jobCandidate.status == constants.MY_GIGS_JOB_STATUS.PLACED) { + jobCandidate.withdraw = !!jobCandidate.completed; + } else { + jobCandidate.withdraw = true; + } + }); +} + /** * Return jobs by given criteria * @param {string} criteria the search criteria @@ -467,6 +573,8 @@ module.exports = { getM2MToken, getCurrentUserDetails, getJobCandidates, + handlePlacedJobCandidates, + handleArchivedJobCandidates, getJobs, getMember, getMemberTraits, diff --git a/src/api/docs/swagger.yaml b/src/api/docs/swagger.yaml index f438d06..4a5f7c2 100644 --- a/src/api/docs/swagger.yaml +++ b/src/api/docs/swagger.yaml @@ -49,6 +49,12 @@ paths: type: string default: desc enum: ["desc", "asc"] + - in: query + name: status + required: false + schema: + type: string + enum: ["open_jobs", "completed_jobs", "archived_jobs"] responses: "200": description: OK diff --git a/src/api/services/JobApplicationService.js b/src/api/services/JobApplicationService.js index cee5854..cce38bc 100644 --- a/src/api/services/JobApplicationService.js +++ b/src/api/services/JobApplicationService.js @@ -18,6 +18,7 @@ async function getMyJobApplications(currentUser, criteria) { const perPage = criteria.perPage; const sortBy = criteria.sortBy; const sortOrder = criteria.sortOrder; + const status = criteria.status || ""; const emptyResult = { total: 0, page, @@ -44,16 +45,32 @@ async function getMyJobApplications(currentUser, criteria) { perPage, sortBy, sortOrder, + status, }); // if no candidates found then return empty result if (jobCandidates.result.length === 0) { return emptyResult; } - const jobIds = _.map(jobCandidates.result, "jobId"); + let jcResult = jobCandidates.result; + // handle placed status for completed_jobs, archived_jobs query + if (status && status != "open_jobs") { + await helper.handlePlacedJobCandidates(jobCandidates.result, userId); + jcResult = jobCandidates.result.filter( + (item) => + item.status != "placed" || (item.status == "placed" && item.completed) + ); + } + + const jobIds = _.map(jcResult, "jobId"); // get jobs of current user by calling taas-api const { result: jobs } = await helper.getJobs({ jobIds, page: 1, perPage }); + + if (status && status == "archived_jobs") { + helper.handleArchivedJobCandidates(jcResult, jobs); + jcResult = jcResult.filter((item) => item.withdraw); + } // apply desired structure - const jobApplications = _.map(jobCandidates.result, (jobCandidate) => { + const jobApplications = _.map(jcResult, (jobCandidate) => { const job = _.find(jobs, ["id", jobCandidate.jobId]); return { title: job.title, @@ -92,6 +109,11 @@ getMyJobApplications.schema = Joi.object() perPage: Joi.perPage(), sortBy: Joi.string().valid("id", "status").default("id"), sortOrder: Joi.string().valid("desc", "asc").default("desc"), + status: Joi.string().valid( + "open_jobs", + "completed_jobs", + "archived_jobs" + ), }) .required(), }) From 82dcf75c94375103d58384eb44587dde04556fdb Mon Sep 17 00:00:00 2001 From: dengjun Date: Sat, 17 Jul 2021 18:38:53 +0800 Subject: [PATCH 02/24] Add Redirection Link Finished --- src/App.jsx | 3 +++ src/constants/index.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index b53e71c..7c551c9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -38,6 +38,9 @@ const App = () => { selected={selectedMenuItem} onSelect={(item) => { setSelectedMenuItem(item); + if (item == "Gigs") { + window.location.href = `${process.env.URL.BASE}/gigs`; + } }} isLoggedIn={isLoggedIn} /> diff --git a/src/constants/index.js b/src/constants/index.js index a250274..ca216b7 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -29,6 +29,10 @@ export const NAV_MENU = { name: "Challenges", path: "/earn/find/challenges", }, + { + name: "Gigs", + path: "", + }, ], }, ], From 30b4fdab4b1d49eaeaf40d21f894bb7bbba554da Mon Sep 17 00:00:00 2001 From: dengjun Date: Sun, 18 Jul 2021 01:45:51 +0800 Subject: [PATCH 03/24] Add Filter Completed --- package.json | 2 +- src/App.jsx | 42 ++++++++++-- src/actions/filter.js | 12 ++++ src/actions/myGigs.js | 8 +-- src/constants/index.js | 12 ++++ src/containers/MyGigs/JobListing/index.jsx | 12 +++- src/containers/MyGigs/index.jsx | 6 +- .../MyGigsFilter/GigsFilter/index.jsx | 36 ++++++++++ .../MyGigsFilter/GigsFilter/styles.scss | 28 ++++++++ src/containers/MyGigsFilter/index.jsx | 65 +++++++++++++++++++ src/reducers/filter.js | 15 +++++ src/reducers/lookup.js | 2 + src/services/myGigs.js | 4 +- src/utils/myGig.js | 13 ++++ 14 files changed, 242 insertions(+), 15 deletions(-) create mode 100644 src/containers/MyGigsFilter/GigsFilter/index.jsx create mode 100644 src/containers/MyGigsFilter/GigsFilter/styles.scss create mode 100644 src/containers/MyGigsFilter/index.jsx diff --git a/package.json b/package.json index 74a8c8c..0022b46 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dev-https": "cross-env APPMODE=development webpack-dev-server --https --port 8008", "build": "webpack --mode=${APPMODE:-development} --env.config=${APPENV:-dev}", "analyze": "webpack --mode=production --env.analyze=true", - "lint": "eslint src --ext js,jsx", + "lint": "eslint src --ext js,jsx --fix", "format": "prettier --write \"./**\"", "test": "cross-env BABEL_ENV=test jest", "watch-tests": "cross-env BABEL_ENV=test jest --watch", diff --git a/src/App.jsx b/src/App.jsx index 7c551c9..0ab5705 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,6 +5,7 @@ import React, { useState, useLayoutEffect, useEffect, useRef } from "react"; import { Router, useLocation, Redirect } from "@reach/router"; import Challenges from "./containers/Challenges"; import Filter from "./containers/Filter"; +import MyGigsFilter from "./containers/MyGigsFilter"; import MyGigs from "./containers/MyGigs"; import Menu from "./components/Menu"; import { disableSidebarForRoute } from "@topcoder/micro-frontends-navbar-app"; @@ -12,7 +13,7 @@ import * as constants from "./constants"; import actions from "./actions"; import * as utils from "./utils"; import store from "./store"; -import { initialChallengeFilter } from "./reducers/filter"; +import { initialChallengeFilter, initialGigFilter } from "./reducers/filter"; import _ from "lodash"; import { usePreviousLocation } from "./utils/hooks"; import { useSelector } from "react-redux"; @@ -49,7 +50,7 @@ const App = () => { const location = useLocation(); const previousLocation = usePreviousLocation(); - const getChallengesDebounced = useRef(_.debounce((f) => f(), 500)); + const getDataDebounced = useRef(_.debounce((f) => f(), 500)); useEffect(() => { store.dispatch(actions.lookup.checkIsLoggedIn()); @@ -77,12 +78,44 @@ const App = () => { if (diff) { store.dispatch(actions.filter.updateFilter(updatedFilter)); } - getChallengesDebounced.current(() => + getDataDebounced.current(() => store.dispatch(actions.challenges.getChallenges(updatedFilter)) ); } }, [location]); + useEffect(() => { + if (location.pathname === "/earn/my-gigs" && isLoggedIn) { + if (!location.search) { + store.dispatch( + actions.myGigs.getMyGigs( + constants.GIGS_FILTER_STATUSES_PARAM[initialGigFilter.status] + ) + ); + return; + } + const params = utils.url.parseUrlQuery(location.search); + if (_.keys(params).length == 1 && params.externalId) { + return; + } + const updatedGigFilter = { + status: params.status || "Open Applications", + }; + const currentGig = store.getState().filter.gig; + const diff = !_.isEqual(updatedGigFilter, currentGig); + if (diff) { + store.dispatch(actions.filter.updateGigFilter(updatedGigFilter)); + } + getDataDebounced.current(() => + store.dispatch( + actions.myGigs.getMyGigs( + constants.GIGS_FILTER_STATUSES_PARAM[updatedGigFilter.status] + ) + ) + ); + } + }, [location, isLoggedIn]); + const varsRef = useRef(); varsRef.current = { previousLocation }; @@ -111,7 +144,8 @@ const App = () => {
{menu}
- + {location.pathname === "/earn/find/challenges" && } + {location.pathname === "/earn/my-gigs" && }
{ +const JobListing = ({ jobs, loadMore, total, numLoaded, gigStatus }) => { const scrollLock = useScrollLock(); const [page, setPage] = useState(1); @@ -17,13 +18,17 @@ const JobListing = ({ jobs, loadMore, total, numLoaded }) => { const nextPage = page + 1; scrollLock(true); setPage(nextPage); - loadMore(nextPage); + loadMore(constants.GIGS_FILTER_STATUSES_PARAM[gigStatus], nextPage); }; useEffect(() => { varsRef.current.scrollLock(false); }, [jobs]); + useEffect(() => { + setPage(1); + }, [gigStatus]); + return (
{jobs.map((job, index) => ( @@ -32,7 +37,7 @@ const JobListing = ({ jobs, loadMore, total, numLoaded }) => {
))} - {numLoaded < total && ( + {numLoaded < total && page * constants.PER_PAGE < total && (
@@ -46,6 +51,7 @@ JobListing.propTypes = { loadMore: PT.func, total: PT.number, numLoaded: PT.number, + gigStatus: PT.string, }; export default JobListing; diff --git a/src/containers/MyGigs/index.jsx b/src/containers/MyGigs/index.jsx index 4f7e2ae..9ad30ee 100644 --- a/src/containers/MyGigs/index.jsx +++ b/src/containers/MyGigs/index.jsx @@ -28,6 +28,7 @@ const MyGigs = ({ getAllCountries, checkingGigs, startCheckingGigs, + gigStatus, }) => { const location = useLocation(); const params = utils.url.parseUrlQuery(location.search); @@ -46,7 +47,7 @@ const MyGigs = ({ if (propsRef.current.params.externalId) { propsRef.current.startCheckingGigs(propsRef.current.params.externalId); } else { - propsRef.current.getMyGigs(); + // propsRef.current.getMyGigs(); } }, []); @@ -101,6 +102,7 @@ const MyGigs = ({ {!checkingGigs && myGigs && myGigs.length == 0 && } {!checkingGigs && myGigs && myGigs.length > 0 && ( ({ + gigStatus: state.filter.gig.status, checkingGigs: state.myGigs.checkingGigs, myGigs: state.myGigs.myGigs, total: state.myGigs.total, diff --git a/src/containers/MyGigsFilter/GigsFilter/index.jsx b/src/containers/MyGigsFilter/GigsFilter/index.jsx new file mode 100644 index 0000000..c62f014 --- /dev/null +++ b/src/containers/MyGigsFilter/GigsFilter/index.jsx @@ -0,0 +1,36 @@ +import React from "react"; +import PT from "prop-types"; +import _ from "lodash"; +import RadioButton from "../../../components/RadioButton"; +import * as utils from "../../../utils"; + +import "./styles.scss"; + +const GigsFilter = ({ gigStatus, gigsStatuses, updateGigFilter }) => { + const bucketOptions = utils.createRadioOptions(gigsStatuses, gigStatus); + + return ( +
+
+ { + const filterChange = { + status: utils.getSelectedRadioOption(newBucketOptions).label, + }; + updateGigFilter(filterChange); + }} + /> + +
+
+ ); +}; + +GigsFilter.propTypes = { + gigStatus: PT.string, + gigsStatuses: PT.arrayOf(PT.string), + updateGigFilter: PT.func, +}; + +export default GigsFilter; diff --git a/src/containers/MyGigsFilter/GigsFilter/styles.scss b/src/containers/MyGigsFilter/GigsFilter/styles.scss new file mode 100644 index 0000000..7e538c4 --- /dev/null +++ b/src/containers/MyGigsFilter/GigsFilter/styles.scss @@ -0,0 +1,28 @@ +@import "styles/variables"; +@import "styles/mixins"; + +$filter-padding-x: 4 * $base-unit; +$filter-padding-y: 3 * $base-unit; + +.filter { + padding: $filter-padding-y $filter-padding-x; + font-size: $font-size-sm; +} + +.buckets { + margin-bottom: 18px; + + > h3 { + margin-bottom: 15px; + font-size: inherit; + line-height: 19px; + } +} + +.buckets { + &.vertical-list { + > div > div { + margin: $base-unit 0; + } + } +} diff --git a/src/containers/MyGigsFilter/index.jsx b/src/containers/MyGigsFilter/index.jsx new file mode 100644 index 0000000..6e3dfcf --- /dev/null +++ b/src/containers/MyGigsFilter/index.jsx @@ -0,0 +1,65 @@ +import React, { useRef } from "react"; +import PT from "prop-types"; +import { useLocation } from "@reach/router"; +import { connect } from "react-redux"; +import GigsFilter from "./GigsFilter"; +import actions from "../../actions"; +import { updateQuery } from "../../utils/url"; + +const MyGigsFilter = ({ gigStatus, gigsStatuses, updateGigFilter }) => { + const location = useLocation(); + const propsRef = useRef(null); + propsRef.current = { location }; + + if (location.pathname === "/earn/my-gigs") { + return ( + { + updateGigFilter(gigFilterChanged); + updateQuery(gigFilterChanged); + }} + /> + ); + } + + return null; +}; + +MyGigsFilter.propTypes = { + gigStatus: PT.string, + gigsStatuses: PT.arrayOf(PT.string), + updateGigFilter: PT.func, +}; + +const mapStateToProps = (state) => ({ + state: state, + gigStatus: state.filter.gig.status, + gigsStatuses: state.lookup.gigsStatuses, +}); + +const mapDispatchToProps = { + updateGigFilter: actions.filter.updateGigFilter, + updateGigQuery: actions.filter.updateGigQuery, +}; + +const mergeProps = (stateProps, dispatchProps, ownProps) => ({ + ...ownProps, + ...stateProps, + ...dispatchProps, + updateQuery: (change) => + dispatchProps.updateGigQuery( + { + ...stateProps.state.filter.gig, + ...change, + }, + change + ), +}); + +export default connect( + mapStateToProps, + mapDispatchToProps, + mergeProps +)(MyGigsFilter); diff --git a/src/reducers/filter.js b/src/reducers/filter.js index fe27c0d..fe7a191 100644 --- a/src/reducers/filter.js +++ b/src/reducers/filter.js @@ -21,6 +21,9 @@ const defaultState = { bucket: constants.FILTER_BUCKETS[1], }, + gig: { + status: constants.GIGS_FILTER_STATUSES.OPEN_JOBS, + }, }; function onInitApp(state, { payload }) { @@ -41,13 +44,25 @@ function onClearChallengeFilter(state, { payload }) { return { ...state, challenge: { ...state.challenge, ...payload } }; } +function onUpdateGigFilter(state, { payload }) { + return { + ...state, + gig: { + ...state.gig, + ...payload, + }, + }; +} + export default handleActions( { INIT_APP: onInitApp, UPDATE_FILTER: onUpdateFilter, CLEAR_CHALLENGE_FILTER: onClearChallengeFilter, + UPDATE_GIG_FILTER: onUpdateGigFilter, }, defaultState ); export const initialChallengeFilter = _.cloneDeep(defaultState.challenge); +export const initialGigFilter = _.cloneDeep(defaultState.gig); diff --git a/src/reducers/lookup.js b/src/reducers/lookup.js index abfe8be..df5e02f 100644 --- a/src/reducers/lookup.js +++ b/src/reducers/lookup.js @@ -1,5 +1,6 @@ import { handleActions } from "redux-actions"; import * as constants from "../constants"; +import _ from "lodash"; const defaultState = { buckets: constants.FILTER_BUCKETS, @@ -9,6 +10,7 @@ const defaultState = { subCommunities: [], isLoggedIn: null, countries: [], + gigsStatuses: _.values(constants.GIGS_FILTER_STATUSES), }; function onGetTagsDone(state, { payload }) { diff --git a/src/services/myGigs.js b/src/services/myGigs.js index 03bbcd8..c523c10 100644 --- a/src/services/myGigs.js +++ b/src/services/myGigs.js @@ -82,9 +82,9 @@ const mapMyGigsData = (serverResponse) => { * @param {*} perPage item per page to request * @returns */ -async function getMyGigs(page, perPage) { +async function getMyGigs(status, page, perPage) { const response = await api.get( - `/earn-app/api/my-gigs/myJobApplications?page=${page}&perPage=${perPage}`, + `/earn-app/api/my-gigs/myJobApplications?status=${status}&page=${page}&perPage=${perPage}`, process.env.URL.PLATFORM_WEBSITE_URL ); diff --git a/src/utils/myGig.js b/src/utils/myGig.js index 2fc240b..efaa6d1 100644 --- a/src/utils/myGig.js +++ b/src/utils/myGig.js @@ -1,5 +1,7 @@ import codes from "country-calling-code"; import countries from "i18n-iso-countries"; +import _ from "lodash"; +import Joi from "joi"; import enLocale from "i18n-iso-countries/langs/en.json"; import * as constants from "../constants"; @@ -38,6 +40,17 @@ export function createTextImage(text) { return canvas.toDataURL(); } +const queryScheme = { + bucket: Joi.string(), +}; + +export function createGigParams(filter) { + let params = _.pick(filter, Object.keys(queryScheme)); + return { + status: constants.GIGS_FILTER_STATUSES_PARAM[params.status || "open_jobs"], + }; +} + function validateTextRequired(value) { value = (value || "").trim(); From 14703103c6da54da835c3cd9a2b2d1b708ed8702 Mon Sep 17 00:00:00 2001 From: dengjun Date: Sun, 18 Jul 2021 10:22:35 +0800 Subject: [PATCH 04/24] V1 filter --- src/api/common/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 3c13fbf..4024083 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -366,7 +366,7 @@ function handleArchivedJobCandidates(jobCandidates, jobs) { const job = _.find(jobs, ["id", jc.jobId]); if (job.hoursPerWeek >= constants.MIN_HOUR_PER_WEEK_TO_WITHDRAW) { assignWithDraw = true; - return; + return false; } }); From 832f173d4405cceb32417d52a15eadff3ca901c9 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 19 Jul 2021 20:38:16 +0800 Subject: [PATCH 05/24] adjusting APIs --- src/api/app-constants.js | 2 ++ src/api/common/helper.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/api/app-constants.js b/src/api/app-constants.js index 495ed42..9469978 100644 --- a/src/api/app-constants.js +++ b/src/api/app-constants.js @@ -30,6 +30,7 @@ const MY_GIGS_JOB_STATUS = { const JOB_APPLICATION_STATUS_MAPPER = { open_jobs: { statuses: [ + MY_GIGS_JOB_STATUS.APPLIED, MY_GIGS_JOB_STATUS.SKILLS_TEST, MY_GIGS_JOB_STATUS.PHONE_SCREEN, MY_GIGS_JOB_STATUS.SCREEN_PASS, @@ -44,6 +45,7 @@ const JOB_APPLICATION_STATUS_MAPPER = { }, archived_jobs: { statuses: [ + MY_GIGS_JOB_STATUS.APPLIED, MY_GIGS_JOB_STATUS.SKILLS_TEST, MY_GIGS_JOB_STATUS.PHONE_SCREEN, MY_GIGS_JOB_STATUS.SCREEN_PASS, diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 4024083..04d2b9f 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -339,7 +339,7 @@ async function handlePlacedJobCandidates(jobCandidates, userId) { ); if (jc) { // jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed' - jc.completed = new Date(rb.endDate) <= new Date(); + jc.completed = endDate ? new Date(rb.endDate) <= new Date() : false; } }); return; @@ -371,6 +371,7 @@ function handleArchivedJobCandidates(jobCandidates, jobs) { }); const openJobs = [ + constants.MY_GIGS_JOB_STATUS.APPLIED, constants.MY_GIGS_JOB_STATUS.SKILLS_TEST, constants.MY_GIGS_JOB_STATUS.PHONE_SCREEN, constants.MY_GIGS_JOB_STATUS.SCREEN_PASS, @@ -382,7 +383,7 @@ function handleArchivedJobCandidates(jobCandidates, jobs) { if (openJobs.indexOf(jobCandidate.status) >= 0) { jobCandidate.withdraw = assignWithDraw; } else if (jobCandidate.status == constants.MY_GIGS_JOB_STATUS.PLACED) { - jobCandidate.withdraw = !!jobCandidate.completed; + jobCandidate.withdraw = false; } else { jobCandidate.withdraw = true; } From 0aa35c89eace9a4f4e5d91e9db630f50a4df06ae Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 19 Jul 2021 21:12:47 +0800 Subject: [PATCH 06/24] fix: issue --- src/api/common/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 04d2b9f..1407ddb 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -339,7 +339,7 @@ async function handlePlacedJobCandidates(jobCandidates, userId) { ); if (jc) { // jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed' - jc.completed = endDate ? new Date(rb.endDate) <= new Date() : false; + jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false; } }); return; From d2de697030cb0d47b93cb30a6ae003c69d0914f0 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 19 Jul 2021 22:06:30 +0800 Subject: [PATCH 07/24] fix: archived jobs --- src/api/common/helper.js | 12 +++++------- src/api/services/JobApplicationService.js | 13 +++++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 1407ddb..74df5f1 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -334,13 +334,11 @@ async function handlePlacedJobCandidates(jobCandidates, userId) { // Handle placed job status with RB result const rbRes = res.body; _.each(rbRes, (rb) => { - const jc = jobCandidates.find( - (item) => item.userId == rb.userId && item.jobId == rb.jobId - ); - if (jc) { - // jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed' - jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false; - } + _.each(jobCandidates, (jc) => { + if (rb.userId == jc.userId && rb.jobId == jc.userId) { + jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false; + } + }); }); return; } diff --git a/src/api/services/JobApplicationService.js b/src/api/services/JobApplicationService.js index cce38bc..3308be8 100644 --- a/src/api/services/JobApplicationService.js +++ b/src/api/services/JobApplicationService.js @@ -55,10 +55,11 @@ async function getMyJobApplications(currentUser, criteria) { // handle placed status for completed_jobs, archived_jobs query if (status && status != "open_jobs") { await helper.handlePlacedJobCandidates(jobCandidates.result, userId); - jcResult = jobCandidates.result.filter( - (item) => - item.status != "placed" || (item.status == "placed" && item.completed) - ); + if (status == "completed_jobs") { + jcResult = jobCandidates.result.filter( + (item) => item.status == "placed" && item.completed + ); + } } const jobIds = _.map(jcResult, "jobId"); @@ -66,6 +67,10 @@ async function getMyJobApplications(currentUser, criteria) { const { result: jobs } = await helper.getJobs({ jobIds, page: 1, perPage }); if (status && status == "archived_jobs") { + jcResult = jobCandidates.result.filter( + (item) => + item.status != "placed" || (item.status == "placed" && !item.completed) + ); helper.handleArchivedJobCandidates(jcResult, jobs); jcResult = jcResult.filter((item) => item.withdraw); } From e00c48e5ff7dc88fe38a24b91bbde92c7d081220 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 19 Jul 2021 22:36:44 +0800 Subject: [PATCH 08/24] fix: completed jobs --- src/api/common/helper.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 74df5f1..1407ddb 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -334,11 +334,13 @@ async function handlePlacedJobCandidates(jobCandidates, userId) { // Handle placed job status with RB result const rbRes = res.body; _.each(rbRes, (rb) => { - _.each(jobCandidates, (jc) => { - if (rb.userId == jc.userId && rb.jobId == jc.userId) { - jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false; - } - }); + const jc = jobCandidates.find( + (item) => item.userId == rb.userId && item.jobId == rb.jobId + ); + if (jc) { + // jc.completed = (new Date(rb.endDate) <= new Date()) && rb.status == 'placed' + jc.completed = rb.endDate ? new Date(rb.endDate) <= new Date() : false; + } }); return; } From d67e7d7c514d7993bdd0f4763fb80f4893dcff8b Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 19 Jul 2021 22:39:23 +0800 Subject: [PATCH 09/24] fix: skills url format --- src/containers/MyGigs/modals/UpdateGigProfile/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/MyGigs/modals/UpdateGigProfile/index.jsx b/src/containers/MyGigs/modals/UpdateGigProfile/index.jsx index 9f407c1..851c744 100644 --- a/src/containers/MyGigs/modals/UpdateGigProfile/index.jsx +++ b/src/containers/MyGigs/modals/UpdateGigProfile/index.jsx @@ -272,7 +272,7 @@ const UpdateGigProfile = ({
Update your skills from Topcoder Profile page From 6b6b6984747bf29b40a378c55b1e8eea017db008 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Tue, 20 Jul 2021 13:15:47 +0800 Subject: [PATCH 10/24] fix: adding gig external Id --- src/api/docs/swagger.yaml | 5 +++++ src/api/services/JobApplicationService.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/api/docs/swagger.yaml b/src/api/docs/swagger.yaml index 4a5f7c2..e9a12c6 100644 --- a/src/api/docs/swagger.yaml +++ b/src/api/docs/swagger.yaml @@ -266,6 +266,7 @@ components: - status - remark - interview + - jobExternalId properties: title: type: string @@ -311,6 +312,10 @@ components: description: "The remark of candidate" interview: $ref: "#/components/schemas/Interview" + jobExternalId: + type: string + example: "51313517" + description: "The corresponding gig ID on community app" Payment: required: - min diff --git a/src/api/services/JobApplicationService.js b/src/api/services/JobApplicationService.js index 3308be8..4a2b94e 100644 --- a/src/api/services/JobApplicationService.js +++ b/src/api/services/JobApplicationService.js @@ -95,6 +95,7 @@ async function getMyJobApplications(currentUser, criteria) { : null, remark: jobCandidate.remark, duration: job.duration, + jobExternalId: job.externalId, }; }); return { From cb4a7ce6141f70420902a90db85e07063e1177c1 Mon Sep 17 00:00:00 2001 From: Dedy Wahyudi Date: Wed, 21 Jul 2021 12:41:30 +0700 Subject: [PATCH 11/24] add link to the Gig Title --- src/containers/MyGigs/JobListing/JobCard/index.jsx | 8 +++++++- src/services/myGigs.js | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/containers/MyGigs/JobListing/JobCard/index.jsx b/src/containers/MyGigs/JobListing/JobCard/index.jsx index 906f278..84253b7 100644 --- a/src/containers/MyGigs/JobListing/JobCard/index.jsx +++ b/src/containers/MyGigs/JobListing/JobCard/index.jsx @@ -55,7 +55,13 @@ const JobCard = ({ job }) => {
-

{job.title}

+

+ + {job.title} + +

  • diff --git a/src/services/myGigs.js b/src/services/myGigs.js index 03bbcd8..efda532 100644 --- a/src/services/myGigs.js +++ b/src/services/myGigs.js @@ -40,6 +40,7 @@ const mapMyGigsData = (serverResponse) => { return { label: (gigPhase || "").toUpperCase(), title: myGig.title, + jobExternalId: myGig.jobExternalId, paymentRangeFrom: myGig.payment.min, paymentRangeTo: myGig.payment.max, paymentRangeRateType: myGig.payment.frequency, From 827b30a64d8c95c2470d3c02b87e33841518ee8d Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 22 Jul 2021 11:07:51 +0800 Subject: [PATCH 12/24] adjust archived filter --- src/api/app-constants.js | 11 ++---- src/api/common/helper.js | 47 +---------------------- src/api/services/JobApplicationService.js | 18 ++------- 3 files changed, 9 insertions(+), 67 deletions(-) diff --git a/src/api/app-constants.js b/src/api/app-constants.js index 9469978..00e5c75 100644 --- a/src/api/app-constants.js +++ b/src/api/app-constants.js @@ -25,6 +25,8 @@ const MY_GIGS_JOB_STATUS = { CLIENT_REJECTED_INTERVIEW: "client rejected - interview", CLIENT_REJECTED_SCREENING: "client rejected - screening", JOB_CLOSED: "job-closed", + WITHDRAWN: "withdrawn", + WITHDRAWN_PRESCREEN: "withdrawn-prescreen", }; const JOB_APPLICATION_STATUS_MAPPER = { @@ -45,19 +47,14 @@ const JOB_APPLICATION_STATUS_MAPPER = { }, archived_jobs: { statuses: [ - MY_GIGS_JOB_STATUS.APPLIED, - MY_GIGS_JOB_STATUS.SKILLS_TEST, - MY_GIGS_JOB_STATUS.PHONE_SCREEN, - MY_GIGS_JOB_STATUS.SCREEN_PASS, - MY_GIGS_JOB_STATUS.INTERVIEW, - MY_GIGS_JOB_STATUS.SELECTED, - MY_GIGS_JOB_STATUS.OFFERED, MY_GIGS_JOB_STATUS.JOB_CLOSED, MY_GIGS_JOB_STATUS.REJECTED_OTHER, MY_GIGS_JOB_STATUS.REJECTED_PRE_SCREEN, MY_GIGS_JOB_STATUS.CLIENT_REJECTED_INTERVIEW, MY_GIGS_JOB_STATUS.CLIENT_REJECTED_SCREENING, MY_GIGS_JOB_STATUS.PLACED, + MY_GIGS_JOB_STATUS.WITHDRAWN, + MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN, ], }, }; diff --git a/src/api/common/helper.js b/src/api/common/helper.js index 1407ddb..24e8d06 100644 --- a/src/api/common/helper.js +++ b/src/api/common/helper.js @@ -293,6 +293,7 @@ async function getJobCandidates(criteria) { } /** + * Process placed job candidate to calculate the completed status * * @param {*} jobCandidates * @param {*} userId @@ -345,51 +346,6 @@ async function handlePlacedJobCandidates(jobCandidates, userId) { return; } -function handleArchivedJobCandidates(jobCandidates, jobs) { - if ( - !jobCandidates || - jobCandidates.length == 0 || - !jobs || - jobs.length == 0 - ) { - return; - } - // find at least one placed jobCandidate whose job is having hoursPerWeek >= 20 - // if true, assign all open application with a withdraw status = true - // else, assign all open application with a withdraw status = false - let assignWithDraw = false; - const jcs = jobCandidates.filter( - (item) => - item.status == constants.MY_GIGS_JOB_STATUS.PLACED && !item.completed - ); - _.each(jcs, (jc) => { - const job = _.find(jobs, ["id", jc.jobId]); - if (job.hoursPerWeek >= constants.MIN_HOUR_PER_WEEK_TO_WITHDRAW) { - assignWithDraw = true; - return false; - } - }); - - const openJobs = [ - constants.MY_GIGS_JOB_STATUS.APPLIED, - constants.MY_GIGS_JOB_STATUS.SKILLS_TEST, - constants.MY_GIGS_JOB_STATUS.PHONE_SCREEN, - constants.MY_GIGS_JOB_STATUS.SCREEN_PASS, - constants.MY_GIGS_JOB_STATUS.INTERVIEW, - constants.MY_GIGS_JOB_STATUS.SELECTED, - constants.MY_GIGS_JOB_STATUS.OFFERED, - ]; - _.each(jobCandidates, (jobCandidate) => { - if (openJobs.indexOf(jobCandidate.status) >= 0) { - jobCandidate.withdraw = assignWithDraw; - } else if (jobCandidate.status == constants.MY_GIGS_JOB_STATUS.PLACED) { - jobCandidate.withdraw = false; - } else { - jobCandidate.withdraw = true; - } - }); -} - /** * Return jobs by given criteria * @param {string} criteria the search criteria @@ -575,7 +531,6 @@ module.exports = { getCurrentUserDetails, getJobCandidates, handlePlacedJobCandidates, - handleArchivedJobCandidates, getJobs, getMember, getMemberTraits, diff --git a/src/api/services/JobApplicationService.js b/src/api/services/JobApplicationService.js index 4a2b94e..0720680 100644 --- a/src/api/services/JobApplicationService.js +++ b/src/api/services/JobApplicationService.js @@ -53,27 +53,17 @@ async function getMyJobApplications(currentUser, criteria) { } let jcResult = jobCandidates.result; // handle placed status for completed_jobs, archived_jobs query - if (status && status != "open_jobs") { + if (status && status == "completed_jobs") { await helper.handlePlacedJobCandidates(jobCandidates.result, userId); - if (status == "completed_jobs") { - jcResult = jobCandidates.result.filter( - (item) => item.status == "placed" && item.completed - ); - } + jcResult = jobCandidates.result.filter( + (item) => item.status == "placed" && item.completed + ); } const jobIds = _.map(jcResult, "jobId"); // get jobs of current user by calling taas-api const { result: jobs } = await helper.getJobs({ jobIds, page: 1, perPage }); - if (status && status == "archived_jobs") { - jcResult = jobCandidates.result.filter( - (item) => - item.status != "placed" || (item.status == "placed" && !item.completed) - ); - helper.handleArchivedJobCandidates(jcResult, jobs); - jcResult = jcResult.filter((item) => item.withdraw); - } // apply desired structure const jobApplications = _.map(jcResult, (jobCandidate) => { const job = _.find(jobs, ["id", jobCandidate.jobId]); From 9808c792fb27b40dde589dbecf5ca0165154d662 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 22 Jul 2021 11:29:34 +0800 Subject: [PATCH 13/24] fix: archived job --- src/api/app-constants.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/app-constants.js b/src/api/app-constants.js index 00e5c75..ca6b21e 100644 --- a/src/api/app-constants.js +++ b/src/api/app-constants.js @@ -52,7 +52,6 @@ const JOB_APPLICATION_STATUS_MAPPER = { MY_GIGS_JOB_STATUS.REJECTED_PRE_SCREEN, MY_GIGS_JOB_STATUS.CLIENT_REJECTED_INTERVIEW, MY_GIGS_JOB_STATUS.CLIENT_REJECTED_SCREENING, - MY_GIGS_JOB_STATUS.PLACED, MY_GIGS_JOB_STATUS.WITHDRAWN, MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN, ], From 55edd60fc843fd1ec892bb16441b9d55424b2387 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 22 Jul 2021 13:11:48 +0800 Subject: [PATCH 14/24] integrat withdraw status --- src/constants/index.js | 11 +++++++++++ src/containers/MyGigs/JobListing/JobCard/index.jsx | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/constants/index.js b/src/constants/index.js index a7d9321..0d84c42 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -126,6 +126,7 @@ export const MY_GIG_PHASE = { PLACED: "Placed", NOT_SELECTED: "Not Selected", JOB_CLOSED: "Job Closed", + WITHDRAWN: "Withdrawn", }; export const MY_GIG_PHASE_LABEL = { @@ -139,6 +140,7 @@ export const MY_GIG_PHASE_LABEL = { PLACED: "PLACED", NOT_SELECTED: "NOT SELECTED", JOB_CLOSED: "JOB CLOSED", + WITHDRAWN: "WITHDRAWN", }; export const MY_GIG_PHASE_STATUS = { @@ -165,6 +167,8 @@ export const MY_GIGS_JOB_STATUS = { CLIENT_REJECTED_INTERVIEW: "client rejected - interview", CLIENT_REJECTED_SCREENING: "client rejected - screening", JOB_CLOSED: "job-closed", + WITHDRAWN: "withdrawn", + WITHDRAWN_PRESCREEN: "withdrawn-prescreen", }; /** * Maps the status from API to gig status @@ -183,6 +187,8 @@ export const JOB_STATUS_MAPPER = { [MY_GIGS_JOB_STATUS.CLIENT_REJECTED_INTERVIEW]: MY_GIG_PHASE.NOT_SELECTED, [MY_GIGS_JOB_STATUS.CLIENT_REJECTED_SCREENING]: MY_GIG_PHASE.NOT_SELECTED, [MY_GIGS_JOB_STATUS.JOB_CLOSED]: MY_GIG_PHASE.JOB_CLOSED, + [MY_GIGS_JOB_STATUS.WITHDRAWN]: MY_GIG_PHASE.WITHDRAWN, + [MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN]: MY_GIG_PHASE.WITHDRAWN, }; /** @@ -207,6 +213,8 @@ export const JOB_STATUS_MESSAGE_MAPPER = { [MY_GIG_PHASE.NOT_SELECTED]: "You were not selected for this position.", [MY_GIG_PHASE.JOB_CLOSED]: "This position is no longer active. Please apply to other open gigs.", + [MY_GIG_PHASE.WITHDRAWN]: + "You withdrew your application for this gig or you have been placed in another gig.", }; export const ACTIONS_AVAILABLE_FOR_MY_GIG_PHASE = { @@ -320,6 +328,8 @@ export const PHASES_FOR_JOB_STATUS = { MY_GIG_PHASE.NOT_SELECTED, ], [MY_GIGS_JOB_STATUS.JOB_CLOSED]: [MY_GIG_PHASE.JOB_CLOSED], + [MY_GIGS_JOB_STATUS.WITHDRAWN]: [MY_GIG_PHASE.WITHDRAWN], + [MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN]: [MY_GIG_PHASE.WITHDRAWN], }; /** @@ -337,6 +347,7 @@ export const SORT_STATUS_ORDER = [ MY_GIG_PHASE.APPLIED, MY_GIG_PHASE.JOB_CLOSED, MY_GIG_PHASE.NOT_SELECTED, + MY_GIG_PHASE.WITHDRAWN, ]; export const PER_PAGE = 10; diff --git a/src/containers/MyGigs/JobListing/JobCard/index.jsx b/src/containers/MyGigs/JobListing/JobCard/index.jsx index 906f278..6ee7de8 100644 --- a/src/containers/MyGigs/JobListing/JobCard/index.jsx +++ b/src/containers/MyGigs/JobListing/JobCard/index.jsx @@ -129,6 +129,8 @@ const JobCard = ({ job }) => { {![ MY_GIGS_JOB_STATUS.JOB_CLOSED, MY_GIGS_JOB_STATUS.REJECTED_OTHER, + MY_GIGS_JOB_STATUS.WITHDRAWN, + MY_GIGS_JOB_STATUS.WITHDRAWN_PRESCREEN, ].includes(job.status) && ( +
    {MY_GIGS_STATUS_EMPTY_TEXT[gigStatus]}
    + {gigStatus == GIGS_FILTER_STATUSES.OPEN_JOBS && ( + Interested in getting a gig? + )} + {gigStatus == GIGS_FILTER_STATUSES.OPEN_JOBS && ( + + )}
); }; +Empty.defaultProps = { + gigStatus: GIGS_FILTER_STATUSES.OPEN_JOBS, +}; + +Empty.propTypes = { + gigStatus: PT.string, +}; + export default Empty; diff --git a/src/constants/index.js b/src/constants/index.js index 8f7e2d8..152179d 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -386,8 +386,14 @@ export const GIG_STATUS_TOOLTIP = { UNAVAILABLE: "You’re not open to take on new jobs.", }; -export const EMPTY_GIGS_TEXT = - "LOOKS LIKE YOU HAVEN'T APPLIED TO ANY GIG OPPORTUNITIES YET."; +export const MY_GIGS_STATUS_EMPTY_TEXT = { + [GIGS_FILTER_STATUSES.ACTIVE_JOBS]: "YOU DON'T HAVE ANY ACTIVE GIGS YET.", + [GIGS_FILTER_STATUSES.OPEN_JOBS]: + "LOOKS LIKE YOU HAVEN'T APPLIED TO ANY GIG OPPORTUNITIES YET.", + [GIGS_FILTER_STATUSES.COMPLETED_JOBS]: + "YOU DON'T HAVE ANY COMPLETED GIGS YET.", + [GIGS_FILTER_STATUSES.ARCHIVED_JOBS]: "YOU DON'T HAVE ANY ARCHIVED GIGS YET.", +}; export const CHECKING_GIG_TIMES = 3; diff --git a/src/containers/MyGigs/index.jsx b/src/containers/MyGigs/index.jsx index 9ad30ee..e30da7b 100644 --- a/src/containers/MyGigs/index.jsx +++ b/src/containers/MyGigs/index.jsx @@ -99,7 +99,9 @@ const MyGigs = ({
- {!checkingGigs && myGigs && myGigs.length == 0 && } + {!checkingGigs && myGigs && myGigs.length == 0 && ( + + )} {!checkingGigs && myGigs && myGigs.length > 0 && ( Date: Fri, 23 Jul 2021 16:41:09 +0800 Subject: [PATCH 23/24] restore ci branch --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f7c459c..0cb6119 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,7 +76,7 @@ workflows: filters: branches: only: - - gigs-filter + - dev # Production builds are exectuted only on tagged commits to the # master branch. From 09f453becab16a371c470ead6f34d3ca7f17ce97 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sat, 24 Jul 2021 12:20:07 +0800 Subject: [PATCH 24/24] fix: reset gig bucket --- src/App.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index 0ab5705..c50708b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -87,6 +87,8 @@ const App = () => { useEffect(() => { if (location.pathname === "/earn/my-gigs" && isLoggedIn) { if (!location.search) { + store.dispatch(actions.filter.updateGigFilter(initialGigFilter)); + store.dispatch( actions.myGigs.getMyGigs( constants.GIGS_FILTER_STATUSES_PARAM[initialGigFilter.status]