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