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 ExperienceCommunityAccordionProps { |
13
|
|
|
title: string; |
14
|
|
|
group: string; |
15
|
|
|
project: string; |
16
|
|
|
startDate: Date; |
17
|
|
|
endDate: Date | null; |
18
|
|
|
isActive: boolean; |
19
|
|
|
relevantSkills: ExperienceSkill[]; |
20
|
|
|
irrelevantSkillCount: number; |
21
|
|
|
isEducationJustification: boolean; |
22
|
|
|
showSkillDetails: boolean; |
23
|
|
|
showButtons: boolean; |
24
|
|
|
handleDelete: () => void; |
25
|
|
|
handleEdit: () => void; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
const experienceCommunityDetails = ({ |
29
|
|
|
locale, |
30
|
|
|
intl, |
31
|
|
|
title, |
32
|
|
|
group, |
33
|
|
|
project, |
34
|
|
|
startDate, |
35
|
|
|
endDate, |
36
|
|
|
isActive, |
37
|
|
|
}: { |
38
|
|
|
locale: Locales; |
39
|
|
|
intl: IntlShape; |
40
|
|
|
title: string; |
41
|
|
|
group: string; |
42
|
|
|
project: string; |
43
|
|
|
startDate: Date; |
44
|
|
|
endDate: Date | null; |
45
|
|
|
isActive: boolean; |
46
|
|
|
}): React.ReactElement => { |
47
|
|
|
const notApplicable = ( |
48
|
|
|
<p data-c-color="gray"> |
49
|
|
|
{intl.formatMessage(baseExperienceMessages.notApplicable)} |
50
|
|
|
</p> |
51
|
|
|
); |
52
|
|
|
const endDateOrNa = endDate ? ( |
53
|
|
|
<p>{readableDate(locale, endDate)}</p> |
54
|
|
|
) : ( |
55
|
|
|
notApplicable |
56
|
|
|
); |
57
|
|
|
return ( |
58
|
|
|
<> |
59
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
60
|
|
|
<p data-c-font-weight="bold"> |
61
|
|
|
{intl.formatMessage(baseExperienceMessages.experienceTypeLabel)} |
62
|
|
|
</p> |
63
|
|
|
<p> |
64
|
|
|
<i |
65
|
|
|
className="fas fa-people-carry" |
66
|
|
|
data-c-color="c1" |
67
|
|
|
data-c-margin="right(.25)" |
68
|
|
|
/> |
69
|
|
|
<FormattedMessage |
70
|
|
|
id="experienceCommunityAccordion.experienceTypeTitle" |
71
|
|
|
defaultMessage="Community Experience" |
72
|
|
|
/> |
73
|
|
|
</p> |
74
|
|
|
</div> |
75
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
76
|
|
|
<p data-c-font-weight="bold"> |
77
|
|
|
<FormattedMessage |
78
|
|
|
id="experienceCommunityAccordion.roleLabel" |
79
|
|
|
defaultMessage="Role / Job Title:" |
80
|
|
|
/> |
81
|
|
|
{title ? <p>{title}</p> : notApplicable} |
82
|
|
|
</p> |
83
|
|
|
</div> |
84
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
85
|
|
|
<p data-c-font-weight="bold"> |
86
|
|
|
<FormattedMessage |
87
|
|
|
id="experienceCommunityAccordion.organizationLabel" |
88
|
|
|
defaultMessage="Group / Organization / Community:" |
89
|
|
|
/> |
90
|
|
|
</p> |
91
|
|
|
{group ? <p>{group}</p> : notApplicable} |
92
|
|
|
</div> |
93
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
94
|
|
|
<p data-c-font-weight="bold"> |
95
|
|
|
<FormattedMessage |
96
|
|
|
id="experienceCommunityAccordion.projectLabel" |
97
|
|
|
defaultMessage="Project / Product:" |
98
|
|
|
/> |
99
|
|
|
</p> |
100
|
|
|
{project ? <p>{project}</p> : notApplicable} |
101
|
|
|
</div> |
102
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
103
|
|
|
<p data-c-font-weight="bold"> |
104
|
|
|
{intl.formatMessage(baseExperienceMessages.startDateLabel)} |
105
|
|
|
</p> |
106
|
|
|
{startDate ? <p>{readableDate(locale, startDate)}</p> : notApplicable} |
107
|
|
|
</div> |
108
|
|
|
<div data-c-grid-item="base(1of2) tl(1of3)"> |
109
|
|
|
<p data-c-font-weight="bold"> |
110
|
|
|
{intl.formatMessage(baseExperienceMessages.endDateLabel)} |
111
|
|
|
</p> |
112
|
|
|
{isActive ? ( |
113
|
|
|
<p>{intl.formatMessage(baseExperienceMessages.ongoing)}</p> |
114
|
|
|
) : ( |
115
|
|
|
endDateOrNa |
116
|
|
|
)} |
117
|
|
|
</div> |
118
|
|
|
</> |
119
|
|
|
); |
120
|
|
|
}; |
121
|
|
|
|
122
|
|
|
export const ExperienceCommunityAccordion: React.FC<ExperienceCommunityAccordionProps> = ({ |
123
|
|
|
title, |
124
|
|
|
group, |
125
|
|
|
project, |
126
|
|
|
startDate, |
127
|
|
|
endDate, |
128
|
|
|
isActive, |
129
|
|
|
relevantSkills, |
130
|
|
|
irrelevantSkillCount, |
131
|
|
|
isEducationJustification, |
132
|
|
|
showSkillDetails, |
133
|
|
|
showButtons, |
134
|
|
|
handleDelete, |
135
|
|
|
handleEdit, |
136
|
|
|
}) => { |
137
|
|
|
const intl = useIntl(); |
138
|
|
|
const locale = getLocale(intl.locale); |
139
|
|
|
const accordionTitle = ( |
140
|
|
|
<> |
141
|
|
|
<p> |
142
|
|
|
<FormattedMessage |
143
|
|
|
id="experienceCommunityAccordion.title" |
144
|
|
|
defaultMessage="<b>{title}</b> - {group}" |
145
|
|
|
description="Title of Community Experience accordion (this is the visible text when accordion is closed)." |
146
|
|
|
values={{ |
147
|
|
|
title, |
148
|
|
|
group, |
149
|
|
|
b: (value) => <span data-c-font-weight="bold">{value}</span>, |
150
|
|
|
}} |
151
|
|
|
/> |
152
|
|
|
</p> |
153
|
|
|
{titleBarDateRange(startDate, endDate, isActive, locale)} |
154
|
|
|
</> |
155
|
|
|
); |
156
|
|
|
return ( |
157
|
|
|
<BaseExperienceAccordion |
158
|
|
|
title={accordionTitle} |
159
|
|
|
iconClass="fa-people-carry" |
160
|
|
|
relevantSkills={relevantSkills} |
161
|
|
|
irrelevantSkillCount={irrelevantSkillCount} |
162
|
|
|
isEducationJustification={isEducationJustification} |
163
|
|
|
details={experienceCommunityDetails({ |
164
|
|
|
locale, |
165
|
|
|
intl, |
166
|
|
|
title, |
167
|
|
|
group, |
168
|
|
|
project, |
169
|
|
|
startDate, |
170
|
|
|
endDate, |
171
|
|
|
isActive, |
172
|
|
|
})} |
173
|
|
|
showSkillDetails={showSkillDetails} |
174
|
|
|
showButtons={showButtons} |
175
|
|
|
handleDelete={handleDelete} |
176
|
|
|
handleEdit={handleEdit} |
177
|
|
|
/> |
178
|
|
|
); |
179
|
|
|
}; |
180
|
|
|
|
181
|
|
|
export default ExperienceCommunityAccordion; |
182
|
|
|
|