1
|
|
|
import React from "react"; |
2
|
|
|
import { FormattedMessage, useIntl, IntlShape } from "react-intl"; |
3
|
|
|
import { |
4
|
|
|
ExperienceSkill, |
5
|
|
|
BaseExperienceAccordion, |
6
|
|
|
titleBarDateRange, |
7
|
|
|
baseExperienceMessages, |
8
|
|
|
} from "./BaseExperienceAccordion"; |
9
|
|
|
import { Locales, getLocale } from "../../../helpers/localize"; |
10
|
|
|
import { readableDate } from "../../../helpers/dates"; |
11
|
|
|
|
12
|
|
|
interface ExperienceEducationAccordionProps { |
13
|
|
|
educationType: string; |
14
|
|
|
areaOfStudy: string; |
15
|
|
|
institution: string; |
16
|
|
|
status: string; |
17
|
|
|
startDate: Date; |
18
|
|
|
endDate: Date | null; |
19
|
|
|
isActive: boolean; |
20
|
|
|
thesisTitle: string | null; |
21
|
|
|
relevantSkills: ExperienceSkill[]; |
22
|
|
|
irrelevantSkillCount: number; |
23
|
|
|
isEducationJustification: boolean; |
24
|
|
|
showSkillDetails: boolean; |
25
|
|
|
showButtons: boolean; |
26
|
|
|
handleDelete: () => void; |
27
|
|
|
handleEdit: () => void; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
const experienceEducationDetails = ({ |
31
|
|
|
locale, |
32
|
|
|
intl, |
33
|
|
|
educationType, |
34
|
|
|
areaOfStudy, |
35
|
|
|
institution, |
36
|
|
|
status, |
37
|
|
|
startDate, |
38
|
|
|
endDate, |
39
|
|
|
isActive, |
40
|
|
|
thesisTitle, |
41
|
|
|
}: { |
42
|
|
|
locale: Locales; |
43
|
|
|
intl: IntlShape; |
44
|
|
|
educationType: string; |
45
|
|
|
areaOfStudy: string; |
46
|
|
|
institution: string; |
47
|
|
|
status: string; |
48
|
|
|
startDate: Date; |
49
|
|
|
endDate: Date | null; |
50
|
|
|
isActive: boolean; |
51
|
|
|
thesisTitle: string | null; |
52
|
|
|
}): React.ReactElement => { |
53
|
|
|
const notApplicable = ( |
54
|
|
|
<p data-c-color="gray"> |
55
|
|
|
{intl.formatMessage(baseExperienceMessages.notApplicable)} |
56
|
|
|
</p> |
57
|
|
|
); |
58
|
|
|
const endDateOrNa = endDate ? ( |
59
|
|
|
<p>{readableDate(locale, endDate)}</p> |
60
|
|
|
) : ( |
61
|
|
|
notApplicable |
62
|
|
|
); |
63
|
|
|
return ( |
64
|
|
|
<> |
65
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
66
|
|
|
<p data-c-font-weight="bold"> |
67
|
|
|
{intl.formatMessage(baseExperienceMessages.experienceTypeLabel)} |
68
|
|
|
</p> |
69
|
|
|
<p> |
70
|
|
|
<i |
71
|
|
|
className="fas fa-book" |
72
|
|
|
data-c-color="c1" |
73
|
|
|
data-c-margin="right(.25)" |
74
|
|
|
/> |
75
|
|
|
<FormattedMessage |
76
|
|
|
id="experienceEducationAccordion.experienceTypeTitle" |
77
|
|
|
defaultMessage="Education Experience" |
78
|
|
|
/> |
79
|
|
|
</p> |
80
|
|
|
</div> |
81
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
82
|
|
|
<p data-c-font-weight="bold"> |
83
|
|
|
<FormattedMessage |
84
|
|
|
id="experienceEducationAccordion.educationTypeLabel" |
85
|
|
|
defaultMessage="Type of Education:" |
86
|
|
|
/> |
87
|
|
|
</p> |
88
|
|
|
{educationType ? <p>{educationType}</p> : notApplicable} |
89
|
|
|
</div> |
90
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
91
|
|
|
<p data-c-font-weight="bold"> |
92
|
|
|
<FormattedMessage |
93
|
|
|
id="experienceEducationAccordion.areaOfStudyLabel" |
94
|
|
|
defaultMessage="Area of Study:" |
95
|
|
|
/> |
96
|
|
|
</p> |
97
|
|
|
{areaOfStudy ? <p>{areaOfStudy}</p> : notApplicable} |
98
|
|
|
</div> |
99
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
100
|
|
|
<p data-c-font-weight="bold"> |
101
|
|
|
<FormattedMessage |
102
|
|
|
id="experienceEducationAccordion.institutionLabel" |
103
|
|
|
defaultMessage="Institution:" |
104
|
|
|
/> |
105
|
|
|
</p> |
106
|
|
|
{institution ? <p>{institution}</p> : notApplicable} |
107
|
|
|
</div> |
108
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
109
|
|
|
<p data-c-font-weight="bold"> |
110
|
|
|
<FormattedMessage |
111
|
|
|
id="experienceEducationAccordion.statusLabel" |
112
|
|
|
defaultMessage="Status:" |
113
|
|
|
/> |
114
|
|
|
</p> |
115
|
|
|
{status ? <p>{status}</p> : notApplicable} |
116
|
|
|
</div> |
117
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
118
|
|
|
<p data-c-font-weight="bold"> |
119
|
|
|
<FormattedMessage |
120
|
|
|
id="experienceEducationAccordion.startDate" |
121
|
|
|
defaultMessage="Start Date:" |
122
|
|
|
/> |
123
|
|
|
</p> |
124
|
|
|
{startDate ? ( |
125
|
|
|
<p>{readableDate(locale, startDate)}</p> |
126
|
|
|
) : ( |
127
|
|
|
{ notApplicable } |
128
|
|
|
)} |
129
|
|
|
</div> |
130
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
131
|
|
|
<p data-c-font-weight="bold"> |
132
|
|
|
<FormattedMessage |
133
|
|
|
id="experienceEducationAccordion.endDate" |
134
|
|
|
defaultMessage="End Date:" |
135
|
|
|
/> |
136
|
|
|
</p> |
137
|
|
|
{isActive ? ( |
138
|
|
|
<p>{intl.formatMessage(baseExperienceMessages.ongoing)}</p> |
139
|
|
|
) : ( |
140
|
|
|
endDateOrNa |
141
|
|
|
)} |
142
|
|
|
</div> |
143
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
144
|
|
|
<p data-c-font-weight="bold"> |
145
|
|
|
<FormattedMessage |
146
|
|
|
id="experienceEducationAccordion.thesisLabel" |
147
|
|
|
defaultMessage="Thesis Title:" |
148
|
|
|
/> |
149
|
|
|
</p> |
150
|
|
|
{thesisTitle ? <p>{thesisTitle}</p> : notApplicable} |
151
|
|
|
</div> |
152
|
|
|
</> |
153
|
|
|
); |
154
|
|
|
}; |
155
|
|
|
|
156
|
|
|
export const ExperienceEducationAccordion: React.FC<ExperienceEducationAccordionProps> = ({ |
157
|
|
|
educationType, |
158
|
|
|
areaOfStudy, |
159
|
|
|
institution, |
160
|
|
|
status, |
161
|
|
|
startDate, |
162
|
|
|
endDate, |
163
|
|
|
isActive, |
164
|
|
|
thesisTitle, |
165
|
|
|
relevantSkills, |
166
|
|
|
irrelevantSkillCount, |
167
|
|
|
isEducationJustification, |
168
|
|
|
showSkillDetails, |
169
|
|
|
showButtons, |
170
|
|
|
handleDelete, |
171
|
|
|
handleEdit, |
172
|
|
|
}) => { |
173
|
|
|
const intl = useIntl(); |
174
|
|
|
const locale = getLocale(intl.locale); |
175
|
|
|
const accordionTitle = ( |
176
|
|
|
<> |
177
|
|
|
<p> |
178
|
|
|
<FormattedMessage |
179
|
|
|
id="experienceEducationAccordion.title" |
180
|
|
|
defaultMessage="<b>{educationType} in {areaOfStudy}</b> - {institution}" |
181
|
|
|
description="Title of education accordion (this is the visible text when accordion is closed)." |
182
|
|
|
values={{ |
183
|
|
|
educationType, |
184
|
|
|
areaOfStudy, |
185
|
|
|
institution, |
186
|
|
|
b: (value) => <span data-c-font-weight="bold">{value}</span>, |
187
|
|
|
}} |
188
|
|
|
/> |
189
|
|
|
</p> |
190
|
|
|
{titleBarDateRange(startDate, endDate, isActive, locale)} |
191
|
|
|
</> |
192
|
|
|
); |
193
|
|
|
return ( |
194
|
|
|
<BaseExperienceAccordion |
195
|
|
|
title={accordionTitle} |
196
|
|
|
iconClass="fa-book" |
197
|
|
|
relevantSkills={relevantSkills} |
198
|
|
|
irrelevantSkillCount={irrelevantSkillCount} |
199
|
|
|
isEducationJustification={isEducationJustification} |
200
|
|
|
details={experienceEducationDetails({ |
201
|
|
|
locale, |
202
|
|
|
intl, |
203
|
|
|
educationType, |
204
|
|
|
areaOfStudy, |
205
|
|
|
institution, |
206
|
|
|
status, |
207
|
|
|
startDate, |
208
|
|
|
endDate, |
209
|
|
|
isActive, |
210
|
|
|
thesisTitle, |
211
|
|
|
})} |
212
|
|
|
showSkillDetails={showSkillDetails} |
213
|
|
|
showButtons={showButtons} |
214
|
|
|
handleDelete={handleDelete} |
215
|
|
|
handleEdit={handleEdit} |
216
|
|
|
/> |
217
|
|
|
); |
218
|
|
|
}; |
219
|
|
|
|
220
|
|
|
export default ExperienceEducationAccordion; |
221
|
|
|
|