diff --git a/src/constants/index.js b/src/constants/index.js index a46a7e77..431787d9 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -298,3 +298,9 @@ export const STATUS_OPTIONS = [ */ export const DISABLED_DESCRIPTION_MESSAGE = "You may not edit a Job Description that is currently posted to Topcoder.com. Please contact support@topcoder.com."; + +/** + * The media URL to be shown on Interview popup + */ +export const INTERVIEW_POPUP_MEDIA_URL = + "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"; diff --git a/src/routes/JobForm/index.jsx b/src/routes/JobForm/index.jsx index 05bc0a29..880f22e2 100644 --- a/src/routes/JobForm/index.jsx +++ b/src/routes/JobForm/index.jsx @@ -8,6 +8,8 @@ import React, { useState, useEffect } from "react"; import PT from "prop-types"; import { toastr } from "react-redux-toastr"; +import _ from "lodash"; +import store from "../../store"; import Page from "components/Page"; import PageHeader from "components/PageHeader"; import { useData } from "hooks/useData"; @@ -61,8 +63,10 @@ const JobForm = ({ teamId, jobId }) => { // as we are using `PUT` method (not `PATCH`) we have send ALL the fields // fields which we don't send would become `null` otherwise - const getRequestData = (values) => - _.pick(values, [ + const getRequestData = (values) => { + const externalId = _.get(store.getState(), "authUser.userId"); + values.externalId = externalId && _.toString(externalId); + return _.pick(values, [ "projectId", "externalId", "description", @@ -76,6 +80,7 @@ const JobForm = ({ teamId, jobId }) => { "skills", "status", ]); + }; useEffect(() => { if (skills && job && !options) { diff --git a/src/routes/PositionDetails/actions/index.js b/src/routes/PositionDetails/actions/index.js index 9d34101e..da23e614 100644 --- a/src/routes/PositionDetails/actions/index.js +++ b/src/routes/PositionDetails/actions/index.js @@ -8,7 +8,6 @@ import { patchCandidateInterview, } from "services/teams"; import { ACTION_TYPE } from "constants"; -import { getFakeInterviews } from "utils/helpers"; /** * Load Team Position details (team job) @@ -22,13 +21,6 @@ export const loadPosition = (teamId, positionId) => ({ type: ACTION_TYPE.LOAD_POSITION, payload: async () => { const response = await getPositionDetails(teamId, positionId); - - // inject mock interview data to candidates list - for (const candidate of response.data.candidates) { - const fakeInterviews = getFakeInterviews(candidate); - _.set(candidate, "interviews", fakeInterviews); - } - return response.data; }, meta: { diff --git a/src/routes/PositionDetails/components/InterviewConfirmPopup/index.jsx b/src/routes/PositionDetails/components/InterviewConfirmPopup/index.jsx index fc287fa4..c2b6ac79 100644 --- a/src/routes/PositionDetails/components/InterviewConfirmPopup/index.jsx +++ b/src/routes/PositionDetails/components/InterviewConfirmPopup/index.jsx @@ -6,6 +6,7 @@ import React from "react"; import PT from "prop-types"; import SimpleModal from "components/SimpleModal"; +import { INTERVIEW_POPUP_MEDIA_URL } from "constants"; import "./styles.module.scss"; function InterviewConfirmPopup({ open, onClose }) { @@ -38,7 +39,7 @@ function InterviewConfirmPopup({ open, onClose }) {
diff --git a/src/routes/PositionDetails/components/InterviewDetailsPopup/index.jsx b/src/routes/PositionDetails/components/InterviewDetailsPopup/index.jsx index ed7df2fa..28dbf1e6 100644 --- a/src/routes/PositionDetails/components/InterviewDetailsPopup/index.jsx +++ b/src/routes/PositionDetails/components/InterviewDetailsPopup/index.jsx @@ -4,8 +4,7 @@ * Popup that allows user to schedule an interview * Calls addInterview action */ -import React, { useEffect, useState, useCallback } from "react"; -import { getAuthUserProfile } from "@topcoder/micro-frontends-navbar-app"; +import React, { useCallback } from "react"; import { Form } from "react-final-form"; import arrayMutators from "final-form-arrays"; import { FieldArray } from "react-final-form-arrays"; @@ -21,10 +20,6 @@ import RadioFieldGroup from "components/RadioFieldGroup"; /* Validators for Form */ -const validateExists = (value) => { - return value ? undefined : "Required"; -}; - const validateIsEmail = (value) => { if (!value) return undefined; return /\S+@\S+\.\S+/.test(value) ? undefined : "Please enter valid email"; @@ -33,11 +28,6 @@ const validateIsEmail = (value) => { const validator = (values) => { const errors = {}; - errors.myemail = - validateExists(values.myemail) || validateIsEmail(values.myemail); - errors.email2 = - validateExists(values.email2) || validateIsEmail(values.email2); - errors.emails = []; if (values.emails) { for (const email of values.emails) { @@ -51,42 +41,28 @@ const validator = (values) => { /********************* */ function InterviewDetailsPopup({ open, onClose, candidate, openNext }) { - const [isLoading, setIsLoading] = useState(true); - const [myEmail, setMyEmail] = useState(""); - const [myId, setMyId] = useState(""); const dispatch = useDispatch(); - useEffect(() => { - getAuthUserProfile().then((res) => { - setMyEmail(res.email || ""); - setMyId(res.userId); - setIsLoading(false); - }); - }, []); - const onSubmitCallback = useCallback( async (formData) => { - const secondaryEmails = + const attendeesList = formData.emails?.filter( (email) => typeof email === "string" && email.length > 0 ) || []; const interviewData = { xaiTemplate: formData.time, - attendeesList: [formData.myemail, formData.email2, ...secondaryEmails], - round: candidate.interviews.length + 1, - createdBy: myId, + attendeesList, }; await dispatch(addInterview(candidate.id, interviewData)); }, - [dispatch, candidate, myId] + [dispatch, candidate] ); - return isLoading ? null : ( + return ( @@ -164,32 +140,6 @@ function InterviewDetailsPopup({ open, onClose, candidate, openNext }) { Please provide email addresses for all parties you would like involved with the interview. -diff --git a/src/routes/PositionDetails/components/InterviewDetailsPopup/styles.module.scss b/src/routes/PositionDetails/components/InterviewDetailsPopup/styles.module.scss index bdd9262d..6df0786e 100644 --- a/src/routes/PositionDetails/components/InterviewDetailsPopup/styles.module.scss +++ b/src/routes/PositionDetails/components/InterviewDetailsPopup/styles.module.scss @@ -43,7 +43,7 @@ background: #fff; margin: 10px 0 0 0; padding: 0; - color: blue; + color: #0D61BF; border: none; border-radius: 0; @@ -60,15 +60,17 @@ } .array-input { - width: 95% + width: 100% } .remove-item { - display: flex; - flex-direction: column; - justify-content: flex-end; - margin-bottom: 10px; + position: absolute; + right: 45px; + margin-top: 33px; font-size: 33px; color: #EF476F; cursor: pointer; + &:focus { + outline: none; + } } \ No newline at end of file diff --git a/src/routes/PositionDetails/components/LatestInterview/index.jsx b/src/routes/PositionDetails/components/LatestInterview/index.jsx index 6a74cc2c..de78b88b 100644 --- a/src/routes/PositionDetails/components/LatestInterview/index.jsx +++ b/src/routes/PositionDetails/components/LatestInterview/index.jsx @@ -9,7 +9,7 @@ import "./styles.module.scss"; import { formatDate } from "utils/format"; function LatestInterview({ interviews }) { - if (!interviews.length) { + if (!interviews || !interviews.length) { return
; } diff --git a/src/routes/PositionDetails/components/PositionCandidates/index.jsx b/src/routes/PositionDetails/components/PositionCandidates/index.jsx index a84f42f7..ede24193 100644 --- a/src/routes/PositionDetails/components/PositionCandidates/index.jsx +++ b/src/routes/PositionDetails/components/PositionCandidates/index.jsx @@ -272,14 +272,15 @@ const PositionCandidates = ({ position, statusFilterKey, updateCandidate }) => { > Schedule Another Interview - {candidate.interviews.length > 0 && ( - - )} + {candidate.interviews && + candidate.interviews.length > 0 && ( + + )}