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