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

Commit d0a35d6

Browse files
authored
Merge pull request #578 from yoution/issue-562
fix: issue #562
2 parents 488a7f4 + 4c9db9f commit d0a35d6

File tree

2 files changed

+196
-7
lines changed

2 files changed

+196
-7
lines changed

src/server/misc/routes/index.html

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title></title>
6+
<style>
7+
html {
8+
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
9+
-webkit-font-smoothing: antialiased;
10+
font-size: 10pt;
11+
}
12+
.top-bar {
13+
margin-top: 20px;
14+
display: flex;
15+
flex-direction: row;
16+
align-items: center;
17+
justify-content: space-between;
18+
min-width: 600px;
19+
width: 100%;
20+
}
21+
.top-bar h1 {
22+
margin: 0;
23+
font-weight: 500;
24+
height: 90px;
25+
display: flex;
26+
align-items: center;
27+
justify-content: center;
28+
font-size: 2em;
29+
flex-shrink: 0;
30+
flex: 1 1;
31+
}
32+
.shadowed-content {
33+
margin: auto;
34+
width: 100%;
35+
max-width: 900px;
36+
box-sizing: border-box;
37+
text-align: left;
38+
border: 1px solid transparent;
39+
border-radius: 6px;
40+
box-shadow: none;
41+
position: relative;
42+
border: 1px solid #d6d6d6;
43+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
44+
}
45+
46+
.slot-cancelview {
47+
display: flex;
48+
flex-direction: row;
49+
position: relative;
50+
box-sizing: border-box;
51+
align-items: center;
52+
z-index: 200;
53+
background: #fff;
54+
border-radius: 6px;
55+
height: 420px;
56+
width: 100%;
57+
}
58+
.slot-cancelview h2 {
59+
font-size: 2.1rem;
60+
line-height: 3rem;
61+
font-weight: 400;
62+
}
63+
64+
.slot-cancelview h4 {
65+
margin: 10px;
66+
font-size: 1.2rem;
67+
line-height: 1.7rem;
68+
font-weight: 400;
69+
}
70+
.left-panel {
71+
margin-top: 40px;
72+
display: flex;
73+
align-items: center;
74+
justify-content:center;
75+
padding-bottom: 70px ;
76+
flex: 1 1;
77+
}
78+
79+
.left-panel p{
80+
opacity: 0.6;
81+
}
82+
.booking-summary {
83+
text-align: center;
84+
}
85+
86+
.divider {
87+
align-self: stretch;
88+
width: 1px ;
89+
flex-grow: 0;
90+
border-left: 1px solid #eee;
91+
margin-top: 20px;
92+
margin-bottom: 20px;
93+
}
94+
95+
.right-panel {
96+
box-sizing: border-box;
97+
flex: 1.4 1;
98+
display: flex;
99+
justify-content: center;
100+
align-items: center;
101+
flex-direction: column;
102+
}
103+
.right-panel form {
104+
padding: 30px 70px 0;
105+
}
106+
.right-panel form h3 {
107+
margin-bottom: 15px;
108+
font-size: 1.17em;
109+
font-weight: bold;
110+
}
111+
.right-panel form button {
112+
margin: 20px auto;
113+
}
114+
.tick-mark {
115+
position: relative;
116+
display: inline-block;
117+
width: 45px;
118+
height: 50px;
119+
margin-bottom: 30px;
120+
}
121+
.tick-mark::before {
122+
position: absolute;
123+
left: 0;
124+
top: 50%;
125+
height: 50%;
126+
width: 6px;
127+
background-color: #336699;
128+
content: "";
129+
transform: translateX(10px) rotate(-45deg);
130+
transform-origin: left bottom;
131+
}
132+
.tick-mark::after {
133+
position: absolute;
134+
left: 0;
135+
bottom: 0;
136+
height: 6px;
137+
width: 100%;
138+
background-color: #336699;
139+
content: "";
140+
transform: translateX(10px) rotate(-45deg);
141+
transform-origin: left bottom;
142+
}
143+
</style>
144+
</head>
145+
<body>
146+
<div class="top-bar">
147+
<h1><%= jobTitle %></h1>
148+
</div>
149+
<div class="shadowed-content">
150+
<div class="slot-cancelview">
151+
<div class="left-panel">
152+
<div class="booking-summary">
153+
<h2>
154+
<%= week %><br />
155+
<%= startDate %>
156+
</h2>
157+
<h4><%= startTime %> - <%= endTime %><br/><%= page_slug %> virtual calendar</h4>
158+
<p><%= tz %></p>
159+
</div>
160+
</div>
161+
<div class="divider"></div>
162+
<div class="right-panel">
163+
<div class='tick-mark'></div>
164+
<h3>You're all set.</h3>
165+
<div class="label">Your response has been recorded</div>
166+
</div>
167+
</div>
168+
</div>
169+
</body>
170+
</html>

src/server/misc/routes/interview-thank-you-page.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,46 @@
22
* Custom Interview Thank You Page
33
*/
44
const url = require("url");
5+
const axios = require("axios");
6+
const _ = require("lodash");
7+
const moment = require("moment");
8+
const fs = require("fs");
9+
10+
// eslint-disable-next-line
11+
const content = fs.readFileSync(__dirname + "/index.html");
12+
513
/**
614
* Render custom HTML thank you page for scheduled or rescheduled interview.
715
*
816
* @param {import("express").Request} req express request
917
* @param {import("express").Response} res express response
1018
*/
11-
function getInterviewThankYouPageController(req, res) {
19+
async function getInterviewThankYouPageController(req, res) {
1220
const query = req.query;
1321
const fullURL = url.format({
1422
protocol: req.protocol,
1523
host: req.get("host"),
1624
pathname: req.originalUrl,
1725
});
26+
const { data: nylasHtml } = await axios.get(
27+
`https://schedule.nylas.com/${query.page_slug}`
28+
);
29+
// extract json object from html file
30+
const nylasconfig = JSON.parse(
31+
nylasHtml.match(/window.nylasWindowContext.page = (.*);<\/script>/)[1]
32+
);
33+
const object = {
34+
jobTitle: nylasconfig.name,
35+
page_slug: query.page_slug,
36+
tz: query.tz,
37+
week: moment.unix(query.start_time).format("dddd"),
38+
startDate: moment.unix(query.start_time).format("MMMM DD, yyyy"),
39+
startTime: moment.unix(query.start_time).format("H:mm A"),
40+
endTime: moment.unix(query.end_time).format("H:mm A"),
41+
};
1842

1943
res.set("Content-Type", "text/html");
20-
res.send(
21-
`<h1>Thank you page (under construction)</h1>
22-
<pre>
23-
URL: ${fullURL}
24-
query: ${JSON.stringify(query, null, 2)}</pre>`
25-
);
44+
res.send(_.template(content)(object));
2645
}
2746

2847
module.exports = getInterviewThankYouPageController;

0 commit comments

Comments
 (0)