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

Commit 05ddcb5

Browse files
authored
Merge pull request #524 from yoution/issue-523
fix: issue #523
2 parents 61e9fcd + 70b473e commit 05ddcb5

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

src/constants/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ export const POSITION_STATUS = {
4848
CANCELLED: "cancelled",
4949
};
5050

51+
/**
52+
* Interview related constants
53+
*/
54+
export const INTERVIEW_STATUS = {
55+
SCHEDULING: "Scheduling",
56+
SCHEDULED: "Scheduled",
57+
REQUESTEDFORRESCHEDULE: "Requested for reschedule",
58+
RESCHEDULED: "Rescheduled",
59+
COMPLETED: "Completed",
60+
CANCELLED: "Cancelled",
61+
EXPIRED: "Expired",
62+
};
63+
5164
/**
5265
* Mapping between position status "server value" and human readable value
5366
*/

src/root.component.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import InputSkills from "./routes/CreateNewTeam/pages/InputSkills";
1919
import InputJobDescription from "./routes/CreateNewTeam/pages/InputJobDescription";
2020
import SelectRole from "./routes/CreateNewTeam/pages/SelectRole";
2121
import CreateTaasPayment from "./routes/CreateNewTeam/pages/CreateTaasPayment";
22+
import SchedulingPage from "./routes/SchedulingPage";
2223
import ReduxToastr from "react-redux-toastr";
2324
import store from "./store";
2425
import "./styles/main.vendor.scss";
@@ -50,6 +51,7 @@ export default function Root() {
5051
<InputSkills path="skills/*" />
5152
<SelectRole path="role/*" />
5253
</CreateNewTeam>
54+
<SchedulingPage path="/taas/interview/:interviewId" />
5355
</Router>
5456

5557
{/* Global config for Toastr popups */}

src/routes/SchedulingPage/index.jsx

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Scheduling Page
3+
*
4+
* Allows users to set up bookings for an interview in Nylas
5+
*/
6+
import React, { useEffect, useState } from "react";
7+
import { getAuthUserProfile } from "@topcoder/micro-frontends-navbar-app";
8+
import _ from "lodash";
9+
import Page from "components/Page";
10+
import LoadingIndicator from "components/LoadingIndicator";
11+
import PageHeader from "components/PageHeader";
12+
import { getInterview } from "services/interviews";
13+
import { INTERVIEW_STATUS } from "constants";
14+
import withAuthentication from "../../hoc/withAuthentication";
15+
16+
const SchedulingPage = ({ interviewId }) => {
17+
const [schedulingPageUrl, setSchedulingPageUrl] = useState(null);
18+
const [errorMessage, setErrorMessage] = useState(null);
19+
20+
// if there are some candidates to review, then show "To Review" tab by default
21+
useEffect(() => {
22+
getAuthUserProfile()
23+
.then((res) => {
24+
return {
25+
firstName: res.firstName,
26+
lastName: res.lastName,
27+
email: res.email,
28+
};
29+
})
30+
.then((profile) => {
31+
getInterview(interviewId)
32+
.then(({ data }) => {
33+
if (data.status === INTERVIEW_STATUS.SCHEDULING) {
34+
setSchedulingPageUrl(
35+
`https://schedule.nylas.com/${data.nylasPageSlug}?email=${
36+
profile.email
37+
}&name=${encodeURI(
38+
profile.firstName + " " + profile.lastName
39+
)}&prefilled_readonly=true`
40+
);
41+
} else {
42+
setErrorMessage("No interviews scheduled");
43+
}
44+
})
45+
.catch((err) => {
46+
setErrorMessage(err);
47+
});
48+
});
49+
}, [interviewId]);
50+
51+
return (
52+
<Page title="Schedule Interview">
53+
{!schedulingPageUrl ? (
54+
<LoadingIndicator error={errorMessage} />
55+
) : (
56+
<>
57+
<PageHeader title="Schedule Interview" />
58+
<iframe
59+
title="Nylas Scheduling Page"
60+
src={schedulingPageUrl}
61+
width="1020"
62+
height="900"
63+
/>
64+
</>
65+
)}
66+
</Page>
67+
);
68+
};
69+
70+
export default withAuthentication(SchedulingPage);

src/services/interviews.js

+9
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ export const confirmInterview = (candidateJobId, data) => {
1717
data
1818
);
1919
};
20+
21+
/**
22+
* Returns the interview page url for the given interview
23+
* @param {String} interviewId The interview id
24+
* @returns Promise
25+
*/
26+
export const getInterview = (interviewId) => {
27+
return axios.get(`${config.API.V5}/getInterview/${interviewId}`);
28+
};

0 commit comments

Comments
 (0)