|
1
|
|
|
import { IntlShape } from "react-intl"; |
|
2
|
|
|
import { ApplicationNormalized } from "../../../models/types"; |
|
3
|
|
|
import { ProgressBarProps, stepNames } from "./ProgressBar"; |
|
4
|
|
|
import { |
|
5
|
|
|
applicationBasic, |
|
6
|
|
|
applicationExperienceIntro, |
|
7
|
|
|
applicationSkills, |
|
8
|
|
|
applicationFit, |
|
9
|
|
|
applicationReview, |
|
10
|
|
|
applicationSubmission, |
|
11
|
|
|
} from "../../../helpers/routes"; |
|
12
|
|
|
import { getLocale } from "../../../helpers/localize"; |
|
13
|
|
|
import { ProgressBarStatus } from "../../../models/lookupConstants"; |
|
14
|
|
|
|
|
15
|
|
|
export function makeProgressBarSteps( |
|
16
|
|
|
applicationId: number, |
|
17
|
|
|
steps: { [key in string]: ProgressBarStatus }, |
|
18
|
|
|
intl: IntlShape, |
|
19
|
|
|
currentStep: |
|
20
|
|
|
| "welcome" |
|
21
|
|
|
| "basic" |
|
22
|
|
|
| "experience" |
|
23
|
|
|
| "skills" |
|
24
|
|
|
| "fit" |
|
25
|
|
|
| "review" |
|
26
|
|
|
| "submission" |
|
27
|
|
|
| "other", |
|
28
|
|
|
): ProgressBarProps["steps"] { |
|
29
|
|
|
const locale = getLocale(intl.locale); |
|
30
|
|
|
return [ |
|
31
|
|
|
{ |
|
32
|
|
|
link: { |
|
33
|
|
|
url: applicationBasic(locale, applicationId), |
|
34
|
|
|
text: intl.formatMessage(stepNames.step01), |
|
35
|
|
|
title: intl.formatMessage(stepNames.step01), |
|
36
|
|
|
}, |
|
37
|
|
|
status: currentStep === "basic" ? "current" : steps.basic, |
|
38
|
|
|
}, |
|
39
|
|
|
{ |
|
40
|
|
|
link: { |
|
41
|
|
|
url: applicationExperienceIntro(locale, applicationId), |
|
42
|
|
|
text: intl.formatMessage(stepNames.step02), |
|
43
|
|
|
title: intl.formatMessage(stepNames.step02), |
|
44
|
|
|
}, |
|
45
|
|
|
status: currentStep === "experience" ? "current" : steps.experience, |
|
46
|
|
|
}, |
|
47
|
|
|
{ |
|
48
|
|
|
link: { |
|
49
|
|
|
url: applicationSkills(locale, applicationId), |
|
50
|
|
|
text: intl.formatMessage(stepNames.step03), |
|
51
|
|
|
title: intl.formatMessage(stepNames.step03), |
|
52
|
|
|
}, |
|
53
|
|
|
status: currentStep === "skills" ? "current" : steps.skills, |
|
54
|
|
|
}, |
|
55
|
|
|
{ |
|
56
|
|
|
link: { |
|
57
|
|
|
url: applicationFit(locale, applicationId), |
|
58
|
|
|
text: intl.formatMessage(stepNames.step04), |
|
59
|
|
|
title: intl.formatMessage(stepNames.step04), |
|
60
|
|
|
}, |
|
61
|
|
|
status: currentStep === "fit" ? "current" : steps.fit, |
|
62
|
|
|
}, |
|
63
|
|
|
{ |
|
64
|
|
|
link: { |
|
65
|
|
|
url: applicationReview(locale, applicationId), |
|
66
|
|
|
text: intl.formatMessage(stepNames.step05), |
|
67
|
|
|
title: intl.formatMessage(stepNames.step05), |
|
68
|
|
|
}, |
|
69
|
|
|
status: currentStep === "review" ? "current" : steps.review, |
|
70
|
|
|
}, |
|
71
|
|
|
{ |
|
72
|
|
|
link: { |
|
73
|
|
|
url: applicationSubmission(locale, applicationId), |
|
74
|
|
|
text: intl.formatMessage(stepNames.step06), |
|
75
|
|
|
title: intl.formatMessage(stepNames.step06), |
|
76
|
|
|
}, |
|
77
|
|
|
status: currentStep === "submission" ? "current" : steps.submission, |
|
78
|
|
|
}, |
|
79
|
|
|
]; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
export default makeProgressBarSteps; |
|
83
|
|
|
|