1
|
|
|
import React from "react"; |
2
|
|
|
import { |
3
|
|
|
defineMessages, |
4
|
|
|
FormattedMessage, |
5
|
|
|
IntlShape, |
6
|
|
|
MessageDescriptor, |
7
|
|
|
useIntl, |
8
|
|
|
} from "react-intl"; |
9
|
|
|
import { formMessages } from "./JobWorkEnvMessages"; |
10
|
|
|
|
11
|
|
|
export const physEnvMessages = defineMessages({ |
12
|
|
|
openConcept: { |
13
|
|
|
id: "jobBuilder.workEnv.physEnv.openConcept", |
14
|
|
|
defaultMessage: "Open Concept", |
15
|
|
|
description: "Physical Environment checkbox group 'open concept' option.", |
16
|
|
|
}, |
17
|
|
|
private: { |
18
|
|
|
id: "jobBuilder.workEnv.physEnv.private", |
19
|
|
|
defaultMessage: "Private", |
20
|
|
|
description: "Physical Environment checkbox group 'private' option.", |
21
|
|
|
}, |
22
|
|
|
assignedSeating: { |
23
|
|
|
id: "jobBuilder.workEnv.physEnv.assignedSeating", |
24
|
|
|
defaultMessage: "Assigned Seating", |
25
|
|
|
description: |
26
|
|
|
"Physical Environment checkbox group 'assigned seating' option.", |
27
|
|
|
}, |
28
|
|
|
windows: { |
29
|
|
|
id: "jobBuilder.workEnv.physEnv.windows", |
30
|
|
|
defaultMessage: "Lots of Windows", |
31
|
|
|
description: "Physical Environment checkbox group 'windows' option.", |
32
|
|
|
}, |
33
|
|
|
naturalLight: { |
34
|
|
|
id: "jobBuilder.workEnv.physEnv.naturalLight", |
35
|
|
|
defaultMessage: "Natural Light", |
36
|
|
|
description: "Physical Environment checkbox group 'natural light' option.", |
37
|
|
|
}, |
38
|
|
|
smudging: { |
39
|
|
|
id: "jobBuilder.workEnv.physEnv.smudging", |
40
|
|
|
defaultMessage: "Suitable for Smudging", |
41
|
|
|
description: |
42
|
|
|
"Physical Environment checkbox group 'suitable for smudging' option.", |
43
|
|
|
}, |
44
|
|
|
}); |
45
|
|
|
|
46
|
|
|
export const physEnvOptions: string[] = [ |
47
|
|
|
"openConcept", |
48
|
|
|
"private", |
49
|
|
|
"assignedSeating", |
50
|
|
|
"windows", |
51
|
|
|
"naturalLight", |
52
|
|
|
"smudging", |
53
|
|
|
]; |
54
|
|
|
|
55
|
|
|
export const techMessages = defineMessages({ |
56
|
|
|
videoConferencing: { |
57
|
|
|
id: "jobBuilder.workEnv.technology.videoConferencing", |
58
|
|
|
defaultMessage: "Video Conferencing (e.g. Skype, Zoom)", |
59
|
|
|
description: "Technology checkbox group 'video conferencing' option.", |
60
|
|
|
}, |
61
|
|
|
collaboration: { |
62
|
|
|
id: "jobBuilder.workEnv.technology.collaboration", |
63
|
|
|
defaultMessage: "Collaboration (e.g. Slack, Hangouts)", |
64
|
|
|
description: "Technology checkbox group 'collaboration' option.", |
65
|
|
|
}, |
66
|
|
|
fileSharing: { |
67
|
|
|
id: "jobBuilder.workEnv.technology.fileSharing", |
68
|
|
|
defaultMessage: "File Sharing (e.g. Google Drive, Dropbox)", |
69
|
|
|
description: "Technology checkbox group 'file sharing' option.", |
70
|
|
|
}, |
71
|
|
|
taskManagement: { |
72
|
|
|
id: "jobBuilder.workEnv.technology.taskManagement", |
73
|
|
|
defaultMessage: "Task Management (e.g. Trello, Asana)", |
74
|
|
|
description: "Technology checkbox group 'task management' option.", |
75
|
|
|
}, |
76
|
|
|
versionControl: { |
77
|
|
|
id: "jobBuilder.workEnv.technology.versionControl", |
78
|
|
|
defaultMessage: "Version Control (e.g. Github, Gitlab)", |
79
|
|
|
description: "Technology checkbox group 'version control' option.", |
80
|
|
|
}, |
81
|
|
|
accessToExternal: { |
82
|
|
|
id: "jobBuilder.workEnv.technology.accessToExternal", |
83
|
|
|
defaultMessage: "Access to external, unfiltered Wi-Fi.", |
84
|
|
|
description: "Technology checkbox group 'access to external' option.", |
85
|
|
|
}, |
86
|
|
|
}); |
87
|
|
|
|
88
|
|
|
export const techOptions: string[] = [ |
89
|
|
|
"videoConferencing", |
90
|
|
|
"collaboration", |
91
|
|
|
"fileSharing", |
92
|
|
|
"taskManagement", |
93
|
|
|
"versionControl", |
94
|
|
|
"accessToExternal", |
95
|
|
|
]; |
96
|
|
|
|
97
|
|
|
export const amenitiesMessages = defineMessages({ |
98
|
|
|
cafeteria: { |
99
|
|
|
id: "jobBuilder.workEnv.amenities.cafeteria", |
100
|
|
|
defaultMessage: "Cafeteria On-site", |
101
|
|
|
description: "Amenities checkbox group 'cafeteria' option.", |
102
|
|
|
}, |
103
|
|
|
closeToTransit: { |
104
|
|
|
id: "jobBuilder.workEnv.amenities.closeToTransit", |
105
|
|
|
defaultMessage: "Close to Transit", |
106
|
|
|
description: "Amenities checkbox group 'close to transit' option.", |
107
|
|
|
}, |
108
|
|
|
restaurants: { |
109
|
|
|
id: "jobBuilder.workEnv.amenities.restaurants", |
110
|
|
|
defaultMessage: "Walking Distance to Restaurants/Malls", |
111
|
|
|
description: "Amenities checkbox group 'restaurants' option.", |
112
|
|
|
}, |
113
|
|
|
downtown: { |
114
|
|
|
id: "jobBuilder.workEnv.amenities.downtown", |
115
|
|
|
defaultMessage: "Downtown", |
116
|
|
|
description: "Amenities checkbox group 'downtown' option.", |
117
|
|
|
}, |
118
|
|
|
fitnessCenter: { |
119
|
|
|
id: "jobBuilder.workEnv.amenities.fitnessCenter", |
120
|
|
|
defaultMessage: "Nearby Fitness Centre", |
121
|
|
|
description: "Amenities checkbox group 'nearby fitness centre' option.", |
122
|
|
|
}, |
123
|
|
|
parking: { |
124
|
|
|
id: "jobBuilder.workEnv.amenities.parking", |
125
|
|
|
defaultMessage: "Easy Access to Parking", |
126
|
|
|
description: "Amenities checkbox group 'parking' option.", |
127
|
|
|
}, |
128
|
|
|
}); |
129
|
|
|
|
130
|
|
|
export const amenitiesOptions: string[] = [ |
131
|
|
|
"cafeteria", |
132
|
|
|
"closeToTransit", |
133
|
|
|
"restaurants", |
134
|
|
|
"downtown", |
135
|
|
|
"fitnessCenter", |
136
|
|
|
"parking", |
137
|
|
|
]; |
138
|
|
|
|
139
|
|
|
// This function takes the possible values and the localized messages objects and returns an array. |
140
|
|
|
// The array contains the name and localized label. |
141
|
|
|
const createOptions = ( |
142
|
|
|
options: string[], |
143
|
|
|
messages: Record<string, MessageDescriptor>, |
144
|
|
|
intl: IntlShape, |
145
|
|
|
): { value: string; label: string }[] => { |
146
|
|
|
return options.map((value: string): { value: string; label: string } => ({ |
147
|
|
|
value, |
148
|
|
|
label: intl.formatMessage(messages[value]), |
149
|
|
|
})); |
150
|
|
|
}; |
151
|
|
|
|
152
|
|
|
export const phyEnvDescriptions = ( |
153
|
|
|
intl: IntlShape, |
154
|
|
|
): { value: string; label: string }[] => |
155
|
|
|
createOptions(physEnvOptions, physEnvMessages, intl); |
156
|
|
|
export const techDescriptions = ( |
157
|
|
|
intl: IntlShape, |
158
|
|
|
): { value: string; label: string }[] => |
159
|
|
|
createOptions(techOptions, techMessages, intl); |
160
|
|
|
export const amenitiesDescriptions = ( |
161
|
|
|
intl: IntlShape, |
162
|
|
|
): { value: string; label: string }[] => |
163
|
|
|
createOptions(amenitiesOptions, amenitiesMessages, intl); |
164
|
|
|
|
165
|
|
|
interface WorkEnvSection { |
166
|
|
|
teamSize: number; |
167
|
|
|
selectedEnvOptions: string[]; |
168
|
|
|
envDescription: string; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
const WorkEnvSection: React.FunctionComponent<WorkEnvSection> = ({ |
172
|
|
|
teamSize, |
173
|
|
|
selectedEnvOptions, |
174
|
|
|
envDescription, |
175
|
|
|
}): React.ReactElement => { |
176
|
|
|
const intl = useIntl(); |
177
|
|
|
const phyEnvData: { value: string; label: string }[] = phyEnvDescriptions( |
178
|
|
|
intl, |
179
|
|
|
); |
180
|
|
|
const techData: { value: string; label: string }[] = techDescriptions(intl); |
181
|
|
|
const amenitiesData: { |
182
|
|
|
value: string; |
183
|
|
|
label: string; |
184
|
|
|
}[] = amenitiesDescriptions(intl); |
185
|
|
|
|
186
|
|
|
return ( |
187
|
|
|
<div data-c-grid="gutter"> |
188
|
|
|
<div data-c-grid-item="base(1of1)"> |
189
|
|
|
<span |
190
|
|
|
data-c-colour="c1" |
191
|
|
|
data-c-margin="top(half) bottom(half)" |
192
|
|
|
data-c-font-weight="bold" |
193
|
|
|
> |
194
|
|
|
<FormattedMessage {...formMessages.teamSizeLabel} /> |
195
|
|
|
</span> |
196
|
|
|
<span data-c-margin="left(normal)">{teamSize}</span> |
197
|
|
|
</div> |
198
|
|
|
<div data-c-grid-item="base(1of1)"> |
199
|
|
|
<p |
200
|
|
|
data-c-colour="c1" |
201
|
|
|
data-c-margin="top(half) bottom(half)" |
202
|
|
|
data-c-font-weight="bold" |
203
|
|
|
> |
204
|
|
|
<FormattedMessage {...formMessages.physicalEnvLabel} /> |
205
|
|
|
</p> |
206
|
|
|
<div data-c-margin="left(quarter)"> |
207
|
|
|
<div data-c-grid="gutter"> |
208
|
|
|
{phyEnvData.map( |
209
|
|
|
({ label, value }): React.ReactElement => { |
210
|
|
|
const checked: boolean = selectedEnvOptions.includes(value); |
211
|
|
|
return ( |
212
|
|
|
<div data-c-grid-item="tp(1of2)" key={value}> |
213
|
|
|
<div |
214
|
|
|
className={`job-builder-check ${ |
215
|
|
|
checked ? "checked" : "" |
216
|
|
|
}`} |
217
|
|
|
> |
218
|
|
|
<i className="fa fa-check" /> |
219
|
|
|
</div> |
220
|
|
|
<span>{label}</span> |
221
|
|
|
</div> |
222
|
|
|
); |
223
|
|
|
}, |
224
|
|
|
)} |
225
|
|
|
</div> |
226
|
|
|
</div> |
227
|
|
|
</div> |
228
|
|
|
<div data-c-grid-item="base(1of1)"> |
229
|
|
|
<p |
230
|
|
|
data-c-colour="c1" |
231
|
|
|
data-c-padding="top(half) bottom(half)" |
232
|
|
|
data-c-font-weight="bold" |
233
|
|
|
> |
234
|
|
|
<FormattedMessage {...formMessages.technologyLabel} /> |
235
|
|
|
</p> |
236
|
|
|
<div data-c-margin="left(quarter)"> |
237
|
|
|
<div data-c-grid="gutter"> |
238
|
|
|
{techData.map( |
239
|
|
|
({ label, value }): React.ReactElement => { |
240
|
|
|
const checked: boolean = selectedEnvOptions.includes(value); |
241
|
|
|
return ( |
242
|
|
|
<div data-c-grid-item="tp(1of2)" key={value}> |
243
|
|
|
<div |
244
|
|
|
className={`job-builder-check ${ |
245
|
|
|
checked ? "checked" : "" |
246
|
|
|
}`} |
247
|
|
|
> |
248
|
|
|
<i className="fa fa-check" /> |
249
|
|
|
</div> |
250
|
|
|
<span>{label}</span> |
251
|
|
|
</div> |
252
|
|
|
); |
253
|
|
|
}, |
254
|
|
|
)} |
255
|
|
|
</div> |
256
|
|
|
</div> |
257
|
|
|
</div> |
258
|
|
|
<div data-c-grid-item="base(1of1)"> |
259
|
|
|
<p |
260
|
|
|
data-c-colour="c1" |
261
|
|
|
data-c-margin="top(half) bottom(half)" |
262
|
|
|
data-c-font-weight="bold" |
263
|
|
|
> |
264
|
|
|
<FormattedMessage {...formMessages.amenitiesLabel} /> |
265
|
|
|
</p> |
266
|
|
|
<div data-c-margin="left(quarter)"> |
267
|
|
|
<div data-c-grid="gutter"> |
268
|
|
|
{amenitiesData.map( |
269
|
|
|
({ label, value }): React.ReactElement => { |
270
|
|
|
const checked: boolean = selectedEnvOptions.includes(value); |
271
|
|
|
return ( |
272
|
|
|
<div data-c-grid-item="tp(1of2)" key={value}> |
273
|
|
|
<div |
274
|
|
|
className={`job-builder-check ${ |
275
|
|
|
checked ? "checked" : "" |
276
|
|
|
}`} |
277
|
|
|
> |
278
|
|
|
<i className="fa fa-check" /> |
279
|
|
|
</div> |
280
|
|
|
<span>{label}</span> |
281
|
|
|
</div> |
282
|
|
|
); |
283
|
|
|
}, |
284
|
|
|
)} |
285
|
|
|
</div> |
286
|
|
|
</div> |
287
|
|
|
</div> |
288
|
|
|
<div data-c-grid-item="base(1of1)"> |
289
|
|
|
<p |
290
|
|
|
data-c-margin="bottom(normal) top(half)" |
291
|
|
|
data-c-colour="c1" |
292
|
|
|
data-c-font-weight="bold" |
293
|
|
|
> |
294
|
|
|
<FormattedMessage {...formMessages.moreOnWorkEnv} /> |
295
|
|
|
</p> |
296
|
|
|
<p>{envDescription}</p> |
297
|
|
|
</div> |
298
|
|
|
</div> |
299
|
|
|
); |
300
|
|
|
}; |
301
|
|
|
|
302
|
|
|
export default WorkEnvSection; |
303
|
|
|
|