-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathreviewInfoStage.tsx
165 lines (157 loc) · 4.91 KB
/
reviewInfoStage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import { FC, useState, useEffect } from "react";
import { ReviewStage } from "pages/review";
import { ReviewSplitPanelPage } from "../shared/reviewSplitPanelPage";
import Button from "@components/common/Button";
import Image from "next/image";
import WarningIcon from "@components/icons/warning.icon";
import { ApplicationDTO } from "types";
import { ReviewAnswers } from "./reviewAnswers";
import { ConflictModalProps } from "types";
import { extractShortAnswerData } from "pages/review";
const ConflictModal: FC<ConflictModalProps> = ({ name, open, onClose }) => {
return open ? (
<>
{/* Overlay */}
<div
className="fixed inset-0 flex justify-center items-end md:items-center md:p-4 bg-black bg-opacity-20 z-40"
style={{ margin: "0" }}
onClick={onClose}
>
{/* Modal */}
<div
className="md:max-w-[310px] relative flex flex-col px-6 md:px-12 pt-4 pb-4 rounded-t-3xl md:rounded-3xl bg-white shadow-lg"
onClick={(e) => e.stopPropagation()}
>
{/* Modal content */}
<div className="flex justify-between space-x-8 ">
{/* Description */}
<div className="flex flex-col justify-between space-y-4 text-center">
<div>
<h6 className="mb-1 text-blue">Report a conflict</h6>
<p className="text-[16px] font-source text-charcoal-500">
Do you know {name} and want to report a conflict?
</p>
</div>
<div className="flex justify-center space-x-6">
<Button
variant="secondary"
onClick={onClose}
className="whitespace-nowrap"
>
No
</Button>
<Button
variant="primary"
onClick={onClose}
className="whitespace-nowrap"
>
Yes
</Button>
</div>
</div>
</div>
</div>
</div>
</>
) : null;
};
export interface ReviewStageProps {
name: string;
application: ApplicationDTO | undefined;
scores: Map<ReviewStage, number>;
}
export const ReviewInfoStage: React.FC<ReviewStageProps> = ({
name,
application,
scores,
}) => {
const [questions, setQuestions] = useState<string[]>([]);
const [answers, setAnswers] = useState<string[]>([]);
useEffect(() => {
const shortAnswerStr = application?.shortAnswerQuestions[0];
if (!shortAnswerStr) {
return;
}
const shortAnswerJSON = JSON.parse(shortAnswerStr);
const { extractedAnswers } = extractShortAnswerData(shortAnswerJSON);
setQuestions([
...questions,
"Email",
"Program",
"Academic Term",
"Where did you hear about us?",
"How many times have you applied to Blueprint in the past?",
"Pronouns",
"Will you be in an academic (school) term or a co-op term?",
"Position",
]);
setAnswers([
...answers,
application?.email ?? "",
application?.program ?? "",
application?.academicYear ?? "",
application?.heardFrom ?? "",
application?.timesApplied ?? "",
application?.pronouns ?? "",
application?.academicOrCoop ?? "",
application?.firstChoiceRole ?? "",
...extractedAnswers,
]);
}, [application]);
const [modalOpen, setModalOpen] = useState(false);
return (
<ReviewSplitPanelPage
studentName={name}
rightTitle="Basic Information"
rightTitleButton={
<Button
variant="secondary"
onClick={() => setModalOpen(true)}
className="whitespace-nowrap"
size="sm"
>
<div className="flex place-items-center space-x-2">
<WarningIcon />
<p>Conflict</p>
</div>
</Button>
}
currentStage={ReviewStage.INFO}
leftContent={
<div className="flex flex-col place-items-center justify-center absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 space-y-8 place-content-center h-full m-auto w-full">
<div className="">
<Image
height={87}
width={440}
alt=""
src="/common/review-page-banner.svg"
/>
</div>
<div>
<Image
height={300}
width={330}
alt=""
src="/common/review-page-people.svg"
/>
</div>
</div>
}
rightContent={
<>
{/* Modal */}
<ConflictModal
name={name}
open={modalOpen}
onClose={() => setModalOpen(false)}
/>
<div className="flex flex-col gap-4">
<ReviewAnswers questions={questions} answers={answers} />
</div>
</>
}
scores={scores}
application={application}
></ReviewSplitPanelPage>
);
};