Passed
Push — feature/azure-webapp-pipeline-... ( 1d4635...313c7b )
by Grant
15:30
created

resources/assets/js/components/Application/Review/ApplicationPreview.tsx   A

Complexity

Total Complexity 20
Complexity/F 0

Size

Lines of Code 760
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 20
eloc 618
c 0
b 0
f 0
dl 0
loc 760
rs 9.982
mnd 20
bc 20
fnc 0
bpm 0
cpm 0
noi 0
1
import React, { useState } from "react";
2
import { useIntl, FormattedMessage, defineMessages } from "react-intl";
3
import {
4
  User,
5
  Job,
6
  Criteria,
7
  Experience,
8
  Skill,
9
  ExperienceSkill,
10
  JobPosterQuestion,
11
  JobApplicationAnswer,
12
  ApplicationNormalized,
13
} from "../../../models/types";
14
import { languageRequirementDescription } from "../../../models/localizedConstants";
15
import { LanguageRequirementId } from "../../../models/lookupConstants";
16
import {
17
  basicInfoMessages,
18
  experienceMessages,
19
  fitMessages,
20
} from "../applicationMessages";
21
import defaultBasicMessages, {
22
  citizenshipDeclaration,
23
  languageRequirementLabel,
24
  veteranStatus,
25
} from "../BasicInfo/basicInfoMessages";
26
import ExperienceAwardAccordion from "../ExperienceAccordions/ExperienceAwardAccordion";
27
import ExperienceCommunityAccordion from "../ExperienceAccordions/ExperienceCommunityAccordion";
28
import ExperienceEducationAccordion from "../ExperienceAccordions/ExperienceEducationAccordion";
29
import ExperiencePersonalAccordion from "../ExperienceAccordions/ExperiencePersonalAccordion";
30
import ExperienceWorkAccordion from "../ExperienceAccordions/ExperienceWorkAccordion";
31
import SkillAccordion from "./SkillAccordion";
32
import { getLocale, localizeField } from "../../../helpers/localize";
33
import { getSkillOfCriteria, getIrrelevantSkillCount } from "../helpers";
34
import { getSkillLevelName } from "../../../models/jobUtil";
35
import { Link } from "../../../helpers/router";
36
import {
37
  accountSettings,
38
  applicationBasic,
39
  applicationExperience,
40
  applicationFit,
41
} from "../../../helpers/routes";
42
43
const messages = defineMessages({
44
  edit: {
45
    id: "application.review.edit",
46
    defaultMessage: "Edit",
47
    description: "Link text for editing a section.",
48
  },
49
  editTitle: {
50
    id: "application.review.editTitle",
51
    defaultMessage: "Edit this section.",
52
    description: "Link title for editing a section.",
53
  },
54
  valueNotSet: {
55
    id: "application.review.valueNotSet",
56
    defaultMessage: "Not set",
57
    description: "Message displayed if a user has not yet set a given value.",
58
  },
59
  communicationEn: {
60
    id: "application.review.communication.english",
61
    defaultMessage: "I prefer to communicate in English.",
62
    description:
63
      "Text displayed when a user selects 'en' in their profile for communication preference.",
64
  },
65
  communicationFr: {
66
    id: "application.review.communication.french",
67
    defaultMessage: "I prefer to communicate in French.",
68
    description:
69
      "Text displayed when a user selects 'fr' in their profile for communication preference.",
70
  },
71
  communicationNotSet: {
72
    id: "application.review.communication.notSet",
73
    defaultMessage:
74
      "You haven't set a communication language preference in your profile yet.",
75
    description:
76
      "Text displayed if a user has not yet selected a communication preference in their profile.",
77
  },
78
});
79
80
const submittedApplicationHeaders = defineMessages({
81
  basicInfo: {
82
    id: "application.review.manager.basicInfoHeading",
83
    defaultMessage: "Basic Information",
84
    description:
85
      "Manager's heading for the Basic Info section of the Application.",
86
  },
87
  experience: {
88
    id: "application.review.manager.experienceHeading",
89
    defaultMessage: "Experience",
90
    description:
91
      "Manager's heading for the Experience section of the Application.",
92
  },
93
  fit: {
94
    id: "application.review.manager.fitHeading",
95
    defaultMessage: "Fit",
96
    description: "Manager's heading for the Fit section of the Application.",
97
  },
98
  accountSettings: {
99
    id: "application.review.manager.accountSettingsHeading",
100
    defaultMessage: "Account Settings",
101
    description:
102
      "Manager's heading for the Account Settings section of the Application.",
103
  },
104
});
105
106
interface ExperienceAccordionProps {
107
  experience: Experience;
108
  experienceSkills: ExperienceSkill[];
109
  irrelevantSkillCount: number;
110
  skills: Skill[];
111
}
112
113
const ExperienceAccordion: React.FC<ExperienceAccordionProps> = ({
114
  experience,
115
  experienceSkills,
116
  irrelevantSkillCount,
117
  skills,
118
}) => {
119
  switch (experience.type) {
120
    case "experience_award":
121
      return (
122
        <ExperienceAwardAccordion
123
          experience={experience}
124
          relevantSkills={experienceSkills}
125
          skills={skills}
126
          irrelevantSkillCount={irrelevantSkillCount}
127
          showSkillDetails
128
          showButtons={false}
129
          handleEdit={(): void => {}}
130
          handleDelete={async (): Promise<void> => {}}
131
        />
132
      );
133
    case "experience_community":
134
      return (
135
        <ExperienceCommunityAccordion
136
          experience={experience}
137
          relevantSkills={experienceSkills}
138
          skills={skills}
139
          irrelevantSkillCount={irrelevantSkillCount}
140
          showSkillDetails
141
          showButtons={false}
142
          handleEdit={(): void => {}}
143
          handleDelete={async (): Promise<void> => {}}
144
        />
145
      );
146
    case "experience_education":
147
      return (
148
        <ExperienceEducationAccordion
149
          experience={experience}
150
          relevantSkills={experienceSkills}
151
          skills={skills}
152
          irrelevantSkillCount={irrelevantSkillCount}
153
          showSkillDetails
154
          showButtons={false}
155
          handleDelete={async (): Promise<void> => {}}
156
          handleEdit={(): void => {}}
157
        />
158
      );
159
    case "experience_personal":
160
      return (
161
        <ExperiencePersonalAccordion
162
          experience={experience}
163
          relevantSkills={experienceSkills}
164
          skills={skills}
165
          irrelevantSkillCount={irrelevantSkillCount}
166
          showSkillDetails
167
          showButtons={false}
168
          handleEdit={(): void => {}}
169
          handleDelete={async (): Promise<void> => {}}
170
        />
171
      );
172
    case "experience_work":
173
      return (
174
        <ExperienceWorkAccordion
175
          experience={experience}
176
          relevantSkills={experienceSkills}
177
          skills={skills}
178
          irrelevantSkillCount={irrelevantSkillCount}
179
          showSkillDetails
180
          showButtons={false}
181
          handleEdit={(): void => {}}
182
          handleDelete={async (): Promise<void> => {}}
183
        />
184
      );
185
    default:
186
      return null;
187
  }
188
};
189
190
export type ExperienceView = "experience" | "skills" | "education";
191
192
interface ApplicationPreviewProps {
193
  application: ApplicationNormalized;
194
  criteria: Criteria[];
195
  experiences: Experience[];
196
  experienceSkills: ExperienceSkill[];
197
  experienceViewState?: ExperienceView;
198
  experienceViewButtonOrder?: [ExperienceView, ExperienceView, ExperienceView];
199
  job: Job;
200
  jobQuestions: JobPosterQuestion[];
201
  jobApplicationAnswers: JobApplicationAnswer[];
202
  skills: Skill[];
203
  user: User;
204
  isSubmitted?: boolean;
205
}
206
207
const ApplicationPreview: React.FunctionComponent<ApplicationPreviewProps> = ({
208
  application,
209
  criteria,
210
  experiences,
211
  experienceSkills,
212
  experienceViewState,
213
  experienceViewButtonOrder,
214
  job,
215
  jobQuestions,
216
  jobApplicationAnswers,
217
  isSubmitted,
218
  skills,
219
  user,
220
  children,
221
}) => {
222
  const intl = useIntl();
223
  const locale = getLocale(intl.locale);
224
  const [experienceView, setExperienceView] = useState<ExperienceView>(
225
    experienceViewState || "experience",
226
  );
227
228
  const handleViewClick = (e: React.MouseEvent<HTMLButtonElement>): void => {
229
    const viewType: ExperienceView = e.currentTarget.getAttribute(
230
      "data-experience-view",
231
    ) as ExperienceView;
232
    if (viewType !== null) {
233
      setExperienceView(viewType);
234
    }
235
  };
236
237
  const experienceViewButtons = (
238
    buttonOrder = ["experience", "skills", "education"],
239
  ): JSX.Element => {
240
    const experienceButton = (
241
      <button
242
        data-c-button={`${
243
          experienceView === "experience" ? "solid" : "outline"
244
        }(c1)`}
245
        type="button"
246
        data-c-radius="rounded"
247
        data-c-margin="right(.5)"
248
        className="gtag-application-review-all-experience"
249
        data-experience-view="experience"
250
        onClick={handleViewClick}
251
        key="experienceButton"
252
      >
253
        <FormattedMessage
254
          id="application.review.experienceViewButton"
255
          defaultMessage="All Experience"
256
          description="Button text for the experience view of the Review page."
257
        />
258
      </button>
259
    );
260
    const skillsButton = (
261
      <button
262
        data-c-button={`${
263
          experienceView === "skills" ? "solid" : "outline"
264
        }(c1)`}
265
        type="button"
266
        data-c-radius="rounded"
267
        data-c-margin="right(.5)"
268
        className="gtag-application-review-skill-experience"
269
        data-experience-view="skills"
270
        onClick={handleViewClick}
271
        key="skillsButton"
272
      >
273
        <FormattedMessage
274
          id="application.review.skillsViewButton"
275
          defaultMessage="Skills for This Job"
276
          description="Button text for the skills view of the Review page."
277
        />
278
      </button>
279
    );
280
    const educationButton = (
281
      <button
282
        data-c-button={`${
283
          experienceView === "education" ? "solid" : "outline"
284
        }(c1)`}
285
        type="button"
286
        data-c-radius="rounded"
287
        data-c-margin="right(.5)"
288
        className="gtag-application-review-education-experience"
289
        data-experience-view="education"
290
        onClick={handleViewClick}
291
        key="educationButton"
292
      >
293
        <FormattedMessage
294
          id="application.review.educationViewButton"
295
          defaultMessage="Education Requirements for This Job"
296
          description="Button text for the education view of the Review page."
297
        />
298
      </button>
299
    );
300
301
    const buttonView = buttonOrder.map((button) => {
302
      switch (button) {
303
        case "experience":
304
          return experienceButton;
305
        case "skills":
306
          return skillsButton;
307
        case "education":
308
          return educationButton;
309
        default:
310
          return null;
311
      }
312
    });
313
314
    return <>{buttonView}</>;
315
  };
316
317
  return (
318
    <div data-c-container="medium">
319
      {!isSubmitted && (
320
        <>
321
          <h2
322
            data-c-heading="h2"
323
            data-c-margin={!isSubmitted ? "top(3) bottom(1)" : "bottom(1)"}
324
          >
325
            <FormattedMessage
326
              id="application.review.heading"
327
              defaultMessage="Review Your Application"
328
              description="Main page heading for the Review page."
329
            />
330
          </h2>
331
          <p data-c-margin="bottom(1)">
332
            <FormattedMessage
333
              id="application.review.subheadingOne"
334
              defaultMessage="Take one last look at your information before you submit it."
335
              description="First line of the subheading for the Review page."
336
            />
337
          </p>
338
          <p data-c-margin="bottom(1)">
339
            <FormattedMessage
340
              id="application.review.subheadingTwo"
341
              defaultMessage="Make sure everything you've said is as honest and accurate as possible."
342
              description="Second line of the subheading for the Review page."
343
            />
344
          </p>
345
          <p data-c-margin="bottom(2)">
346
            <FormattedMessage
347
              id="application.review.subheadingThree"
348
              defaultMessage={`Ask yourself, "If I was a manager, and I knew nothing about the applicant other than this application, would I think they could do a good job?"`}
349
              description="Third line of the subheading for the Review page."
350
            />
351
          </p>
352
        </>
353
      )}
354
      <div data-c-grid="gutter(all, 1) middle">
355
        <div data-c-grid-item="tp(2of3) tl(4of5)" data-c-margin="top(2)">
356
          <h3 data-c-font-size="h3">
357
            {!isSubmitted
358
              ? intl.formatMessage(basicInfoMessages.heading)
359
              : intl.formatMessage(submittedApplicationHeaders.basicInfo)}
360
          </h3>
361
        </div>
362
        {!isSubmitted && (
363
          <div
364
            data-c-grid-item="tp(1of3) tl(1of5)"
365
            data-c-align="base(center) tp(right)"
366
          >
367
            <Link
368
              href={applicationBasic(locale, application.id)}
369
              title={intl.formatMessage(messages.editTitle)}
370
              data-c-color="c2"
371
              data-c-font-weight="bold"
372
            >
373
              {intl.formatMessage(messages.edit)}
374
            </Link>
375
          </div>
376
        )}
377
      </div>
378
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
379
      <p
380
        data-c-font-weight="bold"
381
        data-c-color="c2"
382
        data-c-margin="top(1) bottom(.5)"
383
      >
384
        {intl.formatMessage(basicInfoMessages.citizenshipLabel)}
385
      </p>
386
      <p>
387
        {application.citizenship_declaration_id
388
          ? intl.formatMessage(
389
              citizenshipDeclaration(application.citizenship_declaration_id),
390
            )
391
          : intl.formatMessage(messages.valueNotSet)}
392
      </p>
393
      <p
394
        data-c-font-weight="bold"
395
        data-c-color="c2"
396
        data-c-margin="top(1) bottom(.5)"
397
      >
398
        {intl.formatMessage(basicInfoMessages.veteranStatusLabel)}
399
      </p>
400
      <p>
401
        {application.veteran_status_id
402
          ? intl.formatMessage(veteranStatus(application.veteran_status_id))
403
          : intl.formatMessage(messages.valueNotSet)}
404
      </p>
405
      <p
406
        data-c-font-weight="bold"
407
        data-c-color="c2"
408
        data-c-margin="top(1) bottom(.5)"
409
      >
410
        {intl.formatMessage(basicInfoMessages.languageRequirementsHeading)}
411
      </p>
412
      <p data-c-margin="bottom(.5)">
413
        {job.language_requirement_id &&
414
          intl.formatMessage(
415
            languageRequirementDescription(job.language_requirement_id),
416
          )}
417
      </p>
418
      {job.language_requirement_id &&
419
        application.language_requirement_confirmed && (
420
          <p data-c-margin="bottom(.5)">
421
            <i
422
              className="fas fa-check"
423
              data-c-color="go"
424
              data-c-margin="right(.25)"
425
            />
426
            {intl.formatMessage(
427
              languageRequirementLabel(job.language_requirement_id),
428
            )}
429
          </p>
430
        )}
431
      {(job.language_requirement_id ===
432
        LanguageRequirementId.bilingualIntermediate ||
433
        job.language_requirement_id ===
434
          LanguageRequirementId.bilingualAdvanced) &&
435
        application.language_test_confirmed && (
436
          <p>
437
            <i
438
              className="fas fa-check"
439
              data-c-color="go"
440
              data-c-margin="right(.25)"
441
            />
442
            {intl.formatMessage(defaultBasicMessages.languageTestLabel)}
443
          </p>
444
        )}
445
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
446
        <div data-c-grid-item="tp(2of3) tl(4of5)">
447
          <h3 data-c-font-size="h3">
448
            {!isSubmitted
449
              ? intl.formatMessage(experienceMessages.heading)
450
              : intl.formatMessage(submittedApplicationHeaders.experience)}
451
          </h3>
452
        </div>
453
        {!isSubmitted && (
454
          <div
455
            data-c-grid-item="tp(1of3) tl(1of5)"
456
            data-c-align="base(center) tp(right)"
457
          >
458
            <Link
459
              href={applicationExperience(locale, application.id)}
460
              title={intl.formatMessage(messages.editTitle)}
461
              data-c-color="c2"
462
              data-c-font-weight="bold"
463
            >
464
              {intl.formatMessage(messages.edit)}
465
            </Link>
466
          </div>
467
        )}
468
      </div>
469
      <hr data-c-hr="thin(gray)" data-c-margin="tb(1)" />
470
      <p data-c-padding="bottom(.5)" data-c-font-weight="bold">
471
        <FormattedMessage
472
          id="application.review.changeViewHeading"
473
          defaultMessage="Change Your View:"
474
          description="Heading for the Review section with the buttons to change the layout."
475
        />
476
      </p>
477
      <div data-c-padding="bottom(1)">
478
        {experienceViewButtons(experienceViewButtonOrder)}
479
      </div>
480
      {experienceView === "experience" && (
481
        <div className="experience-list">
482
          <p data-c-margin="bottom(1)">
483
            <FormattedMessage
484
              id="application.review.experienceViewHeading"
485
              defaultMessage="This view is a summary of all the experiences you will be sending as a part of your application."
486
              description="Heading for the experience view section of the Review page."
487
            />
488
          </p>
489
          <div data-c-accordion-group="">
490
            {experiences.map((experience) => {
491
              const irrelevantSkillCount = getIrrelevantSkillCount(
492
                criteria,
493
                experience,
494
                experienceSkills,
495
              );
496
              const relevantSkills = experienceSkills.filter(
497
                (experienceSkill) =>
498
                  experienceSkill.experience_type === experience.type &&
499
                  experienceSkill.experience_id === experience.id,
500
              );
501
              return (
502
                <ExperienceAccordion
503
                  key={`${experience.type}-${experience.id}`}
504
                  experience={experience}
505
                  experienceSkills={relevantSkills}
506
                  skills={skills}
507
                  irrelevantSkillCount={irrelevantSkillCount}
508
                />
509
              );
510
            })}
511
          </div>
512
        </div>
513
      )}
514
      {experienceView === "skills" && (
515
        <div className="experience-list">
516
          <p data-c-margin="bottom(1)">
517
            <FormattedMessage
518
              id="application.review.skillsViewHeading"
519
              defaultMessage="This view organizes your experiences by the skills required for this job."
520
              description="Heading for the skills view section of the Review page."
521
            />
522
          </p>
523
          <div data-c-accordion-group="">
524
            {criteria.map((criterion) => {
525
              const skillOfCriterion = getSkillOfCriteria(criterion, skills);
526
527
              if (skillOfCriterion !== null) {
528
                const skillLevel = intl.formatMessage(
529
                  getSkillLevelName(criterion, skillOfCriterion),
530
                );
531
532
                const experiencesOfCriterion = experienceSkills.filter(
533
                  (experienceSkill) =>
534
                    experienceSkill.skill_id === criterion.skill_id,
535
                );
536
537
                const relevantExperiences = experiences.filter((experience) =>
538
                  experiencesOfCriterion.some(
539
                    (experienceSkill) =>
540
                      experienceSkill.experience_id === experience.id &&
541
                      experienceSkill.experience_type === experience.type,
542
                  ),
543
                );
544
545
                return (
546
                  <SkillAccordion
547
                    key={criterion.id}
548
                    skill={skillOfCriterion}
549
                    skillLevel={skillLevel}
550
                    experiences={relevantExperiences}
551
                    experienceSkills={experiencesOfCriterion}
552
                  />
553
                );
554
              }
555
              return null;
556
            })}
557
          </div>
558
        </div>
559
      )}
560
      {experienceView === "education" && (
561
        <div className="experience-list">
562
          <p data-c-margin="bottom(1)">
563
            <FormattedMessage
564
              id="application.review.educationViewHeading"
565
              defaultMessage="This view is a summary of all the experiences you have selected that help you meet the education requirements outlined below."
566
              description="Heading for the education view section of the Review page."
567
            />
568
          </p>
569
          <div
570
            data-c-background="gray(20)"
571
            data-c-radius="rounded"
572
            data-c-padding="all(1)"
573
            data-c-margin="bottom(1)"
574
          >
575
            <p>{localizeField(locale, job, "education")}</p>
576
          </div>
577
          <div data-c-accordion-group="">
578
            {experiences
579
              .filter((experience) => experience.is_education_requirement)
580
              .map((educationExperience) => {
581
                const irrelevantSkillCount = getIrrelevantSkillCount(
582
                  criteria,
583
                  educationExperience,
584
                  experienceSkills,
585
                );
586
                const relevantSkills = experienceSkills.filter(
587
                  (experienceSkill) =>
588
                    experienceSkill.experience_type ===
589
                      educationExperience.type &&
590
                    experienceSkill.experience_id === educationExperience.id,
591
                );
592
                return (
593
                  <ExperienceAccordion
594
                    key={`${educationExperience.type}-${educationExperience.id}-edu`}
595
                    experience={educationExperience}
596
                    experienceSkills={relevantSkills}
597
                    skills={skills}
598
                    irrelevantSkillCount={irrelevantSkillCount}
599
                  />
600
                );
601
              })}
602
          </div>
603
        </div>
604
      )}
605
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
606
        <div data-c-grid-item="tp(2of3) tl(4of5)">
607
          <h3 data-c-font-size="h3">
608
            {!isSubmitted
609
              ? intl.formatMessage(fitMessages.heading)
610
              : intl.formatMessage(submittedApplicationHeaders.fit)}
611
          </h3>
612
        </div>
613
        {!isSubmitted && (
614
          <div
615
            data-c-grid-item="tp(1of3) tl(1of5)"
616
            data-c-align="base(center) tp(right)"
617
          >
618
            <Link
619
              href={applicationFit(locale, application.id)}
620
              title={intl.formatMessage(messages.editTitle)}
621
              data-c-color="c2"
622
              data-c-font-weight="bold"
623
            >
624
              {intl.formatMessage(messages.edit)}
625
            </Link>
626
          </div>
627
        )}
628
      </div>
629
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
630
      {jobQuestions.map((jobQuestion, index) => {
631
        const answer = jobApplicationAnswers.find(
632
          (appAnswer) => appAnswer.job_poster_question_id === jobQuestion.id,
633
        );
634
        return (
635
          <>
636
            <p
637
              data-c-font-weight="bold"
638
              data-c-color="c2"
639
              data-c-margin="top(1) bottom(.5)"
640
            >
641
              {intl.formatMessage(fitMessages.questionLabel, {
642
                index: index + 1,
643
              })}{" "}
644
              {localizeField(locale, jobQuestion, "question")}
645
            </p>
646
            <p>
647
              {answer ? (
648
                answer.answer
649
              ) : (
650
                <FormattedMessage
651
                  id="application.review.missingAnswer"
652
                  defaultMessage="Not yet answered."
653
                  description="Message displayed if the applicant did not yet answer one of the Fit questions."
654
                />
655
              )}
656
            </p>
657
          </>
658
        );
659
      })}
660
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
661
        <div data-c-grid-item="tp(2of3) tl(4of5)">
662
          <h3 data-c-font-size="h3">
663
            {!isSubmitted ? (
664
              <FormattedMessage
665
                id="application.review.accountSettingsHeading"
666
                defaultMessage="My Account Settings"
667
              />
668
            ) : (
669
              intl.formatMessage(submittedApplicationHeaders.accountSettings)
670
            )}
671
          </h3>
672
        </div>
673
        {!isSubmitted && (
674
          <div
675
            data-c-grid-item="tp(1of3) tl(1of5)"
676
            data-c-align="base(center) tp(right)"
677
          >
678
            <a
679
              href={accountSettings(locale)}
680
              title={intl.formatMessage(messages.editTitle)}
681
              data-c-color="c2"
682
              data-c-font-weight="bold"
683
            >
684
              {intl.formatMessage(messages.edit)}
685
            </a>
686
          </div>
687
        )}
688
      </div>
689
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
690
      <p
691
        data-c-font-weight="bold"
692
        data-c-color="c2"
693
        data-c-margin="top(1) bottom(.5)"
694
      >
695
        <FormattedMessage
696
          id="application.review.contactLabel"
697
          defaultMessage="Contact & Communication"
698
        />
699
      </p>
700
      {user.contact_language === "en" && (
701
        <p data-c-margin="bottom(.5)">
702
          <i
703
            className="fas fa-check"
704
            data-c-color="go"
705
            data-c-margin="right(.25)"
706
          />
707
          {intl.formatMessage(messages.communicationEn)}
708
        </p>
709
      )}
710
      {user.contact_language === "fr" && (
711
        <p data-c-margin="bottom(.5)">
712
          <i
713
            className="fas fa-check"
714
            data-c-color="go"
715
            data-c-margin="right(.25)"
716
          />
717
          {intl.formatMessage(messages.communicationFr)}
718
        </p>
719
      )}
720
      {user.contact_language !== "en" && user.contact_language !== "fr" && (
721
        <p data-c-margin="bottom(.5)">
722
          <i
723
            className="fas fa-times"
724
            data-c-color="stop"
725
            data-c-margin="right(.25)"
726
          />
727
          {intl.formatMessage(messages.communicationNotSet)}
728
        </p>
729
      )}
730
      <p data-c-margin={!isSubmitted ? "bottom(.5)" : "bottom(2)"}>
731
        <i
732
          className={`fas fa-${user.job_alerts ? "check" : "times"}`}
733
          data-c-color={user.job_alerts ? "go" : "stop"}
734
          data-c-margin={`right(.${user.job_alerts ? "25" : "5"})`}
735
        />
736
        {user.job_alerts ? (
737
          <FormattedMessage
738
            id="application.review.userContact"
739
            defaultMessage="I would like Talent Cloud to contact me at {email} about related jobs."
740
            values={{
741
              email: user.email,
742
            }}
743
          />
744
        ) : (
745
          <FormattedMessage
746
            id="application.review.userNoContact"
747
            defaultMessage="I do not want Talent Cloud to contact me at {email} about related jobs."
748
            values={{
749
              email: user.email,
750
            }}
751
          />
752
        )}
753
      </p>
754
      {children}
755
    </div>
756
  );
757
};
758
759
export default ApplicationPreview;
760