Skip to content

Commit 0922cad

Browse files
committed
Implement v1 #5479
1 parent 33936b3 commit 0922cad

File tree

11 files changed

+304
-30
lines changed

11 files changed

+304
-30
lines changed

config/default.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,7 @@ module.exports = {
426426
DEBOUNCE_ON_CHANGE_TIME: 150,
427427
},
428428
ENABLE_RECOMMENDER: true,
429+
OPTIMIZELY: {
430+
SDK_KEY: '7V4CJhurXT3Y3bnzv1hv1',
431+
},
429432
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@hapi/joi": "^16.1.4",
40+
"@optimizely/react-sdk": "^2.5.0",
4041
"@topcoder-platform/tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.4",
4142
"aos": "^2.3.4",
4243
"atob": "^2.1.1",
1.95 KB
Loading
1.52 KB
Loading
1.88 KB
Loading

src/shared/components/GUIKit/JobListCard/index.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ import IconBlackDuration from 'assets/images/icon-black-duration.svg';
1111
import IconBlackLocation from 'assets/images/icon-black-location.svg';
1212
import IconBlackPayment from 'assets/images/icon-black-payment.svg';
1313
import iconBlackSkills from 'assets/images/icon-skills.png';
14+
import newTag from 'assets/images/gig-work/tag-new.png';
15+
import hotTag from 'assets/images/gig-work/tag-hot.png';
16+
import dolarsTag from 'assets/images/gig-work/tag-dolars.png';
1417

18+
const TAGS = {
19+
New: newTag,
20+
Hot: hotTag,
21+
$$$: dolarsTag,
22+
};
1523
export default function JobListCard({
1624
job,
1725
}) {
@@ -25,9 +33,13 @@ export default function JobListCard({
2533
skills = skills.join(', ');
2634
}
2735
}
36+
const tag = getCustomField(job.custom_fields, 'Job Tag');
2837

2938
return (
3039
<div styleName="container">
40+
{
41+
tag !== 'n/a' && <img src={TAGS[tag]} alt="gig-job-tag" styleName="gig-tag" />
42+
}
3143
<Link to={`${config.GIGS_PAGES_PATH}/${job.slug}`} styleName="gig-name">{job.name}</Link>
3244
<div styleName="job-infos">
3345
<div styleName="icon-val">

src/shared/components/GUIKit/JobListCard/style.scss

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,23 @@
77
display: flex;
88
flex-direction: column;
99
color: #2a2a2a;
10-
padding: 25px 35px;
10+
padding: 25px 35px 25px 44px;
1111
margin-bottom: 15px;
12+
position: relative;
1213

1314
@include gui-kit-headers;
1415
@include gui-kit-content;
1516
@include roboto-regular;
1617

18+
.gig-tag {
19+
position: absolute;
20+
top: 0;
21+
left: 10px;
22+
width: 24px;
23+
height: 56px;
24+
border-radius: 0;
25+
}
26+
1727
.gig-name,
1828
.gig-name:visited,
1929
.gig-name:active,
@@ -50,18 +60,38 @@
5060

5161
&:first-child {
5262
width: 250px;
63+
64+
@media (max-width: 1280px) {
65+
width: auto;
66+
margin-right: 20px;
67+
}
5368
}
5469

5570
&:nth-child(2) {
5671
width: 204px;
72+
73+
@media (max-width: 1280px) {
74+
width: auto;
75+
margin-right: 20px;
76+
}
5777
}
5878

5979
&:nth-child(3) {
6080
width: 263px;
81+
82+
@media (max-width: 1280px) {
83+
width: auto;
84+
margin-right: 20px;
85+
}
6186
}
6287

6388
&:nth-child(4) {
6489
width: 255px;
90+
91+
@media (max-width: 1280px) {
92+
width: auto;
93+
margin-right: 20px;
94+
}
6595
}
6696

6797
&:last-child {

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ import Dropdown from 'components/GUIKit/Dropdown';
1212
import PT from 'prop-types';
1313
import React from 'react';
1414
import { connect } from 'react-redux';
15+
import { getSalaryType, getCustomField } from 'utils/gigs';
16+
import IconBlackLocation from 'assets/images/icon-black-location.svg';
17+
import { config, Link } from 'topcoder-react-utils';
1518
import './jobLisingStyles.scss';
1619

20+
const CONTENT_PREVIEW_LENGTH = 175;
1721
const GIGS_PER_PAGE = 10;
1822
// Sort by dropdown
1923
const sortByOptions = [
@@ -120,6 +124,13 @@ class RecruitCRMJobsContainer extends React.Component {
120124
}
121125

122126
let jobsToDisplay = jobs;
127+
// build hotlist of jobs if present
128+
let hotlistJobs = _.filter(jobs, (job) => {
129+
const showInHotlist = _.find(job.custom_fields, ['field_name', 'Show in Hotlist']);
130+
return showInHotlist && showInHotlist.value;
131+
});
132+
hotlistJobs = hotlistJobs.sort((a, b) => new Date(b.updated_on) - new Date(a.updated_on));
133+
hotlistJobs = _.slice(hotlistJobs, 0, 4);
123134
// build current locations dropdown based on all data
124135
// and filter by selected location
125136
jobsToDisplay = _.filter(jobs, (job) => {
@@ -160,7 +171,14 @@ class RecruitCRMJobsContainer extends React.Component {
160171
});
161172
}
162173
// Sort controlled by sortBy state
163-
jobsToDisplay = jobsToDisplay.sort((a, b) => new Date(b[sortBy]) - new Date(a[sortBy]));
174+
jobsToDisplay = jobsToDisplay.sort((a, b) => {
175+
// sort tags first no matter the sortBy
176+
const tagA = getCustomField(a.custom_fields, 'Job Tag');
177+
const tagB = getCustomField(b.custom_fields, 'Job Tag');
178+
if (tagB !== 'n/a' && tagA === 'n/a') return Number.MAX_VALUE;
179+
if (tagB === 'n/a' && tagA !== 'n/a') return -Number.MIN_VALUE;
180+
return new Date(b[sortBy]) - new Date(a[sortBy]);
181+
});
164182
// Calc pages
165183
const pages = Math.ceil(jobsToDisplay.length / GIGS_PER_PAGE);
166184
// Paginate the results
@@ -170,22 +188,54 @@ class RecruitCRMJobsContainer extends React.Component {
170188
);
171189

172190
return (
173-
<div styleName="container">
174-
<div styleName="filters">
175-
<SearchCombo placeholder="Search Gig Listings by Name, Skills, or Location" onSearch={this.onSearch} term={term} />
176-
<Dropdown label="Location" onChange={this.onLocation} options={locations} size="xs" />
177-
<Dropdown label="Sort by" onChange={this.onSort} options={sortByOptions} size="xs" />
178-
</div>
179-
<div styleName="jobs-list-container">
191+
<div styleName={hotlistJobs.length ? 'container-with-hotlist' : 'container'}>
192+
<div styleName="gigs">
193+
<div styleName="filters">
194+
<SearchCombo placeholder="Search Gig Listings by Name or Skills" onSearch={this.onSearch} term={term} />
195+
<Dropdown label="Location" onChange={this.onLocation} options={locations} size="xs" />
196+
<Dropdown label="Sort by" onChange={this.onSort} options={sortByOptions} size="xs" />
197+
</div>
198+
<div styleName="jobs-list-container">
199+
{
200+
jobsToDisplay.length
201+
? jobsToDisplay.map(job => <JobListCard job={job} key={job.slug} />)
202+
: <span styleName="no-results">No Results</span>
203+
}
204+
</div>
180205
{
181206
jobsToDisplay.length
182-
? jobsToDisplay.map(job => <JobListCard job={job} key={job.slug} />)
183-
: <span styleName="no-results">No Results</span>
207+
? <Paginate onChange={this.onPaginate} pages={pages} page={page} /> : null
184208
}
185209
</div>
186210
{
187-
jobsToDisplay.length
188-
? <Paginate onChange={this.onPaginate} pages={pages} page={page} /> : null
211+
hotlistJobs.length && (
212+
<div styleName="hotlist">
213+
<h5>HOT THIS WEEK</h5>
214+
<div styleName="hotlist-items">
215+
{
216+
hotlistJobs.map((hjob, indx) => (indx <= 1 ? (
217+
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`}>
218+
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
219+
<h5 styleName="job-title">{hjob.name}</h5>
220+
<div styleName="job-money">${hjob.min_annual_salary} - ${hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
221+
</Link>
222+
) : (
223+
<div styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`}>
224+
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
225+
<h5 styleName="job-title">{hjob.name}</h5>
226+
<div styleName="job-money">${hjob.min_annual_salary} - ${hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
227+
<div styleName="job-desc">
228+
{
229+
`${getCustomField(hjob.custom_fields, 'Hotlist excerpt') === 'n/a' ? '' : `${getCustomField(hjob.custom_fields, 'Hotlist excerpt').substring(0, CONTENT_PREVIEW_LENGTH)}...`}`
230+
}
231+
</div>
232+
<Link styleName={`hotlist-item-button-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`}>Apply Now</Link>
233+
</div>
234+
)))
235+
}
236+
</div>
237+
</div>
238+
)
189239
}
190240
</div>
191241
);

0 commit comments

Comments
 (0)