|
1
|
|
|
import { IntlShape } from "react-intl"; |
|
2
|
|
|
import { Application } from "../../../models/types"; |
|
3
|
|
|
import { |
|
4
|
|
|
ProgressBarProps, |
|
5
|
|
|
stepNames, |
|
6
|
|
|
ProgressBarStepStatus, |
|
7
|
|
|
} from "./ProgressBar"; |
|
8
|
|
|
import { |
|
9
|
|
|
applicationBasic, |
|
10
|
|
|
applicationExperienceIntro, |
|
11
|
|
|
applicationSkills, |
|
12
|
|
|
applicationFit, |
|
13
|
|
|
applicationReview, |
|
14
|
|
|
applicationSubmission, |
|
15
|
|
|
} from "../../../helpers/routes"; |
|
16
|
|
|
import { getLocale } from "../../../helpers/localize"; |
|
17
|
|
|
|
|
18
|
|
|
function basicInfoStatus( |
|
19
|
|
|
application: Application | null, |
|
20
|
|
|
): ProgressBarStepStatus { |
|
21
|
|
|
if (application === null) { |
|
22
|
|
|
return "default"; |
|
23
|
|
|
} |
|
24
|
|
|
// TODO: implement. |
|
25
|
|
|
return "complete"; |
|
26
|
|
|
} |
|
27
|
|
|
function experienceStatus( |
|
28
|
|
|
application: Application | null, |
|
29
|
|
|
): ProgressBarStepStatus { |
|
30
|
|
|
if (application === null) { |
|
31
|
|
|
return "default"; |
|
32
|
|
|
} |
|
33
|
|
|
// TODO: implement. |
|
34
|
|
|
return "complete"; |
|
35
|
|
|
} |
|
36
|
|
|
function skillsStatus(application: Application | null): ProgressBarStepStatus { |
|
37
|
|
|
if (application === null) { |
|
38
|
|
|
return "default"; |
|
39
|
|
|
} |
|
40
|
|
|
// TODO: implement. |
|
41
|
|
|
return "complete"; |
|
42
|
|
|
} |
|
43
|
|
|
function myFitStatus(application: Application | null): ProgressBarStepStatus { |
|
44
|
|
|
if (application === null) { |
|
45
|
|
|
return "default"; |
|
46
|
|
|
} |
|
47
|
|
|
// TODO: implement. |
|
48
|
|
|
return "complete"; |
|
49
|
|
|
} |
|
50
|
|
|
function reviewStatus(application: Application | null): ProgressBarStepStatus { |
|
51
|
|
|
if (application === null) { |
|
52
|
|
|
return "default"; |
|
53
|
|
|
} |
|
54
|
|
|
// TODO: implement. |
|
55
|
|
|
return "complete"; |
|
56
|
|
|
} |
|
57
|
|
|
function submissionStatus( |
|
58
|
|
|
application: Application | null, |
|
59
|
|
|
): ProgressBarStepStatus { |
|
60
|
|
|
if (application === null) { |
|
61
|
|
|
return "default"; |
|
62
|
|
|
} |
|
63
|
|
|
// TODO: implement. |
|
64
|
|
|
return "complete"; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
export function makeProgressBarSteps( |
|
68
|
|
|
applicationId: number, |
|
69
|
|
|
application: Application | null, |
|
70
|
|
|
intl: IntlShape, |
|
71
|
|
|
currentStep: |
|
72
|
|
|
| "welcome" |
|
73
|
|
|
| "basic" |
|
74
|
|
|
| "experience" |
|
75
|
|
|
| "skills" |
|
76
|
|
|
| "fit" |
|
77
|
|
|
| "review" |
|
78
|
|
|
| "submission" |
|
79
|
|
|
| "other", |
|
80
|
|
|
): ProgressBarProps["steps"] { |
|
81
|
|
|
const locale = getLocale(intl.locale); |
|
82
|
|
|
return [ |
|
83
|
|
|
{ |
|
84
|
|
|
link: { |
|
85
|
|
|
url: applicationBasic(locale, applicationId), |
|
86
|
|
|
text: intl.formatMessage(stepNames.step01), |
|
87
|
|
|
title: intl.formatMessage(stepNames.step01), |
|
88
|
|
|
}, |
|
89
|
|
|
status: |
|
90
|
|
|
currentStep === "basic" ? "current" : basicInfoStatus(application), |
|
91
|
|
|
}, |
|
92
|
|
|
{ |
|
93
|
|
|
link: { |
|
94
|
|
|
url: applicationExperienceIntro(locale, applicationId), |
|
95
|
|
|
text: intl.formatMessage(stepNames.step02), |
|
96
|
|
|
title: intl.formatMessage(stepNames.step02), |
|
97
|
|
|
}, |
|
98
|
|
|
status: |
|
99
|
|
|
currentStep === "experience" |
|
100
|
|
|
? "current" |
|
101
|
|
|
: experienceStatus(application), |
|
102
|
|
|
}, |
|
103
|
|
|
{ |
|
104
|
|
|
link: { |
|
105
|
|
|
url: applicationSkills(locale, applicationId), |
|
106
|
|
|
text: intl.formatMessage(stepNames.step03), |
|
107
|
|
|
title: intl.formatMessage(stepNames.step03), |
|
108
|
|
|
}, |
|
109
|
|
|
status: currentStep === "skills" ? "current" : skillsStatus(application), |
|
110
|
|
|
}, |
|
111
|
|
|
{ |
|
112
|
|
|
link: { |
|
113
|
|
|
url: applicationFit(locale, applicationId), |
|
114
|
|
|
text: intl.formatMessage(stepNames.step04), |
|
115
|
|
|
title: intl.formatMessage(stepNames.step04), |
|
116
|
|
|
}, |
|
117
|
|
|
status: currentStep === "fit" ? "current" : myFitStatus(application), |
|
118
|
|
|
}, |
|
119
|
|
|
{ |
|
120
|
|
|
link: { |
|
121
|
|
|
url: applicationReview(locale, applicationId), |
|
122
|
|
|
text: intl.formatMessage(stepNames.step05), |
|
123
|
|
|
title: intl.formatMessage(stepNames.step05), |
|
124
|
|
|
}, |
|
125
|
|
|
status: currentStep === "review" ? "current" : reviewStatus(application), |
|
126
|
|
|
}, |
|
127
|
|
|
{ |
|
128
|
|
|
link: { |
|
129
|
|
|
url: applicationSubmission(locale, applicationId), |
|
130
|
|
|
text: intl.formatMessage(stepNames.step06), |
|
131
|
|
|
title: intl.formatMessage(stepNames.step06), |
|
132
|
|
|
}, |
|
133
|
|
|
status: |
|
134
|
|
|
currentStep === "submission" |
|
135
|
|
|
? "current" |
|
136
|
|
|
: submissionStatus(application), |
|
137
|
|
|
}, |
|
138
|
|
|
]; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
export default makeProgressBarSteps; |
|
142
|
|
|
|