1
|
|
|
import React from "react"; |
2
|
|
|
import { FormattedMessage, useIntl } from "react-intl"; |
3
|
|
|
import { JobStatus } from "../models/lookupConstants"; |
4
|
|
|
import { Link } from "../models/app"; |
5
|
|
|
import { jobStatus } from "../models/localizedConstants"; |
6
|
|
|
|
7
|
|
|
export interface UnclaimedJobCardProps { |
8
|
|
|
jobLink: Link; |
9
|
|
|
createdAt: string; |
10
|
|
|
status: JobStatus; |
11
|
|
|
hiringManagers: string[]; |
12
|
|
|
hrAdvisors: string[]; |
13
|
|
|
handleClaimJob: () => void; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
const UnclaimedJobCard: React.FunctionComponent<UnclaimedJobCardProps> = ({ |
17
|
|
|
jobLink, |
18
|
|
|
createdAt, |
19
|
|
|
status, |
20
|
|
|
hiringManagers, |
21
|
|
|
hrAdvisors, |
22
|
|
|
handleClaimJob, |
23
|
|
|
}) => { |
24
|
|
|
const intl = useIntl(); |
25
|
|
|
return ( |
26
|
|
|
<div |
27
|
|
|
data-c-grid-item="tp(1of2) tl(1of3) equal-col" |
28
|
|
|
className="tc-hr-job-card" |
29
|
|
|
> |
30
|
|
|
<div data-c-card data-c-radius="rounded" data-c-background="white(100)"> |
31
|
|
|
<a |
32
|
|
|
href={jobLink.url} |
33
|
|
|
title={jobLink.title} |
34
|
|
|
style={{ textDecoration: "none" }} |
35
|
|
|
> |
36
|
|
|
<div data-c-background="black(100)" data-c-padding="all(normal)"> |
37
|
|
|
<div data-c-grid="gutter middle"> |
38
|
|
|
<div data-c-grid-item="base(1of1)"> |
39
|
|
|
<p |
40
|
|
|
data-c-font-size="h4" |
41
|
|
|
data-c-colour="white" |
42
|
|
|
data-c-font-style="underline" |
43
|
|
|
> |
44
|
|
|
{jobLink.text} |
45
|
|
|
</p> |
46
|
|
|
</div> |
47
|
|
|
<div data-c-grid-item="base(1of2)"> |
48
|
|
|
<p data-c-colour="white" data-c-font-size="small"> |
49
|
|
|
<FormattedMessage |
50
|
|
|
id="openJobCard.createdAt" |
51
|
|
|
description="Header for when Job Poster was created." |
52
|
|
|
defaultMessage="Created: " |
53
|
|
|
/> |
54
|
|
|
{createdAt} |
55
|
|
|
</p> |
56
|
|
|
</div> |
57
|
|
|
<div data-c-grid-item="base(1of2)" data-c-align="base(right)"> |
58
|
|
|
<span |
59
|
|
|
data-c-color="white" |
60
|
|
|
data-c-border="all(thin, solid, white)" |
61
|
|
|
data-c-padding="tb(quarter) rl(half)" |
62
|
|
|
data-c-font-size="small" |
63
|
|
|
data-c-radius="pill" |
64
|
|
|
> |
65
|
|
|
{intl.formatMessage(jobStatus(status))} |
66
|
|
|
</span> |
67
|
|
|
</div> |
68
|
|
|
</div> |
69
|
|
|
</div> |
70
|
|
|
<div data-c-padding="all(normal)"> |
71
|
|
|
<p data-c-color="black" data-c-margin="bottom(normal)"> |
72
|
|
|
<FormattedMessage |
73
|
|
|
id="openJobCard.hiringManager" |
74
|
|
|
description="Header before list of hiring managers." |
75
|
|
|
defaultMessage="Hiring Managers: " |
76
|
|
|
/> |
77
|
|
|
|
78
|
|
|
{hiringManagers.map((manager, index): string => { |
79
|
|
|
const comma = |
80
|
|
|
hiringManagers.length !== 1 && |
81
|
|
|
index + 1 !== hiringManagers.length |
82
|
|
|
? "," |
83
|
|
|
: " "; |
84
|
|
|
return `${manager}${comma} `; |
85
|
|
|
})} |
86
|
|
|
</p> |
87
|
|
|
|
88
|
|
|
{hrAdvisors.length > 0 ? ( |
89
|
|
|
<p data-c-color="black" data-c-margin="bottom(normal)"> |
90
|
|
|
<FormattedMessage |
91
|
|
|
id="openJobCard.hrAdvisors" |
92
|
|
|
description="Header before list of HR advisors." |
93
|
|
|
defaultMessage="HR Advisors: " |
94
|
|
|
/> |
95
|
|
|
{hrAdvisors.map((advisor, index): string => { |
96
|
|
|
const comma = |
97
|
|
|
hrAdvisors.length !== 1 && index + 1 !== hrAdvisors.length |
98
|
|
|
? "," |
99
|
|
|
: " "; |
100
|
|
|
return `${advisor}${comma} `; |
101
|
|
|
})} |
102
|
|
|
</p> |
103
|
|
|
) : ( |
104
|
|
|
<p data-c-color="stop" data-c-margin="bottom(normal)"> |
105
|
|
|
<FormattedMessage |
106
|
|
|
id="openJobCard.unclaimed" |
107
|
|
|
description="Message displayed if not HR managers have claimed a job." |
108
|
|
|
defaultMessage="Unclaimed" |
109
|
|
|
/> |
110
|
|
|
</p> |
111
|
|
|
)} |
112
|
|
|
</div> |
113
|
|
|
</a> |
114
|
|
|
<div |
115
|
|
|
data-c-padding="all(normal)" |
116
|
|
|
data-c-border="top(thin, solid, black)" |
117
|
|
|
data-c-align="base(right)" |
118
|
|
|
> |
119
|
|
|
<button |
120
|
|
|
data-c-button="solid(c2)" |
121
|
|
|
data-c-radius="rounded" |
122
|
|
|
type="button" |
123
|
|
|
onClick={handleClaimJob} |
124
|
|
|
> |
125
|
|
|
<span data-c-color="black"> |
126
|
|
|
+{" "} |
127
|
|
|
<span data-c-font-style="underline"> |
128
|
|
|
<FormattedMessage |
129
|
|
|
id="openJobCard.claimJob" |
130
|
|
|
description="Message indicating the event of clicking on the job card." |
131
|
|
|
defaultMessage="Claim This Job" |
132
|
|
|
/> |
133
|
|
|
</span> |
134
|
|
|
</span> |
135
|
|
|
</button> |
136
|
|
|
</div> |
137
|
|
|
</div> |
138
|
|
|
</div> |
139
|
|
|
); |
140
|
|
|
}; |
141
|
|
|
|
142
|
|
|
export default UnclaimedJobCard; |
143
|
|
|
|