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

Commit 8c82401

Browse files
authored
Merge pull request #528 from mahidulalvi-bonic/feature/interview-update
Integrated calendar connection functionality with Nylas & TAAS APIs.
2 parents 05ddcb5 + 263a659 commit 8c82401

File tree

9 files changed

+226
-23
lines changed

9 files changed

+226
-23
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,16 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t
136136
nvm use # or make sure to use Node 10
137137
npm i # to install dependencies
138138

139-
# set environment variables:
139+
# set environment variables:
140140

141141
export STRIPE_PUBLIC_KEY=""
142142

143+
# get the below client id from Nylas app settings in Nylas account
144+
export NYLAS_CLIENT_ID=""
145+
146+
# configure the below JWT secret by matching with the one set in TAAS APIS
147+
export NYLAS_CONNECT_CALENDAR_JWT_SECRET=""
148+
143149
npm run dev
144150

145151
# this host TaaS App as http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js

package-lock.json

+109-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070
"final-form": "^4.20.1",
7171
"final-form-arrays": "^3.0.2",
7272
"immutability-helper": "^3.1.1",
73+
"jsonwebtoken": "^8.5.1",
7374
"lodash": "^4.17.20",
7475
"moment": "^2.29.1",
7576
"moment-timezone": "^0.5.33",
7677
"prop-types": "^15.7.2",
78+
"query-string": "^7.0.1",
7779
"react": "^16.12.0",
7880
"react-avatar": "^3.9.7",
7981
"react-datepicker": "^3.8.0",

src/routes/PositionDetails/components/InterviewPopup/ConnectCalendar/index.jsx

+32-12
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import PT from "prop-types";
44
import { BUTTON_SIZE, BUTTON_TYPE } from "constants";
55
import GoogleLogo from "../../../../../assets/images/icon-google.svg";
66
import MicrosoftLogo from "../../../../../assets/images/icon-microsoft.svg";
7-
import { deleteCalendar } from "../../../../../services/interviews";
8-
import React, { useState } from "react";
7+
import { connectCalendar, deleteCalendar } from "../../../../../services/interviews";
8+
import React, { useEffect, useState } from "react";
99
import { toastr } from "react-redux-toastr";
10+
import { useLocation } from "@reach/router";
1011
import Spinner from "components/CenteredSpinner";
1112
import "./styles.module.scss";
1213

@@ -22,6 +23,7 @@ const ConnectCalendar = ({
2223
userProfile,
2324
onGoingBack,
2425
onCalendarRemoved,
26+
candidate,
2527
}) => {
2628
const [showLoader, setLoader] = useState();
2729

@@ -42,6 +44,13 @@ const ConnectCalendar = ({
4244
});
4345
};
4446

47+
const handleConnectCalendar = () => {
48+
// construct the appRedirectUrl with current window url and added query params
49+
const appRedirectUrl = `${window.location.href}?interviewWithCandidate=${candidate.id}`;
50+
51+
return connectCalendar(userProfile.id, appRedirectUrl)
52+
};
53+
4554
return (
4655
<div styleName="connect-calendar">
4756
{!isConnected && (
@@ -72,16 +81,26 @@ const ConnectCalendar = ({
7281
<div styleName="switch-calendar">Switch to a New calendar</div>
7382
</>
7483
)}
75-
<div styleName="button-wrapper">
76-
<Button size={BUTTON_SIZE.SMALL} styleName={cn("button", "google-btn")}>
77-
<GoogleLogo styleName="icons-wrapper" />
78-
Sign in with google
79-
</Button>
80-
<Button size={BUTTON_SIZE.SMALL}>
81-
<MicrosoftLogo styleName="icons-wrapper" />
82-
Sign in with microsoft
83-
</Button>
84-
</div>
84+
{showLoader && <Spinner stype="Oval" width="20" height="20" />}
85+
{!showLoader && <>
86+
<div styleName="button-wrapper">
87+
<Button
88+
size={BUTTON_SIZE.SMALL}
89+
styleName={cn("button", "google-btn")}
90+
onClick={() => handleConnectCalendar()}
91+
>
92+
<GoogleLogo styleName="icons-wrapper" />
93+
Sign in with google
94+
</Button>
95+
<Button
96+
size={BUTTON_SIZE.SMALL}
97+
onClick={() => handleConnectCalendar()}
98+
>
99+
<MicrosoftLogo styleName="icons-wrapper" />
100+
Sign in with microsoft
101+
</Button>
102+
</div>
103+
</>}
85104

86105
<div styleName="description">
87106
Our calendar integration only checks the duration and free/busy status
@@ -118,6 +137,7 @@ ConnectCalendar.propTypes = {
118137
}),
119138
onCalendarRemoved: PT.func,
120139
onGoingBack: PT.func,
140+
candidate: PT.object,
121141
};
122142

123143
export default ConnectCalendar;

src/routes/PositionDetails/components/InterviewPopup/ConnectCalendar/styles.module.scss

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
font-size: 14px;
3939
line-height: 24px;
4040
color: #2a2a2a;
41+
margin-top: 16px;
4142
}
4243

4344
// Section shown when email is connected

src/routes/PositionDetails/components/InterviewPopup/index.jsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ const InterviewPopup = ({
164164
return <ScheduleInterview onClick={onChangeStage} />;
165165
case POPUP_STAGES.CONNECT_CALENDAR:
166166
return (
167-
<ConnectCalendar isConnected={false} onGoingBack={onGoingBack} />
167+
<ConnectCalendar
168+
userProfile={v5UserProfile}
169+
isConnected={false}
170+
onGoingBack={onGoingBack}
171+
candidate={candidate}
172+
/>
168173
);
169174
case POPUP_STAGES.MANAGE_CALENDAR:
170175
const calendar = getCalendar(userSettings);
@@ -175,6 +180,7 @@ const InterviewPopup = ({
175180
calendar={calendar}
176181
onGoingBack={onGoingBack}
177182
onCalendarRemoved={onCalendarRemoved}
183+
candidate={candidate}
178184
/>
179185
);
180186
case POPUP_STAGES.MANAGE_AVAILABILITY:

0 commit comments

Comments
 (0)