Skip to content

Commit 98272f4

Browse files
committed
hotlist centered
1 parent 0c1b3c1 commit 98272f4

File tree

4 files changed

+599
-84
lines changed

4 files changed

+599
-84
lines changed

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import './jobLisingStyles.scss';
2121

2222
const cookies = require('browser-cookies');
2323

24-
const CONTENT_PREVIEW_LENGTH = 175;
2524
const GIGS_PER_PAGE = 10;
2625
// Sort by dropdown
2726
const sortByOptions = [
@@ -224,6 +223,23 @@ class RecruitCRMJobsContainer extends React.Component {
224223
jobsToDisplay,
225224
page * GIGS_PER_PAGE, (page * GIGS_PER_PAGE) + GIGS_PER_PAGE,
226225
);
226+
// hot list of gigs
227+
let isHotlistRendered = false;
228+
const hotlist = () => (
229+
<div styleName="hotlist">
230+
<div styleName="hotlist-items">
231+
{
232+
hotlistJobs.map((hjob, indx) => (
233+
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`} onClick={() => this.onHotlistClick(hjob)}>
234+
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
235+
<h5 styleName="job-title">{hjob.name}</h5>
236+
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
237+
</Link>
238+
))
239+
}
240+
</div>
241+
</div>
242+
);
227243

228244
return (
229245
<div styleName={hotlistJobs.length && decision.enabled ? 'container-with-hotlist' : 'container'}>
@@ -236,58 +252,34 @@ class RecruitCRMJobsContainer extends React.Component {
236252
<div styleName="jobs-list-container">
237253
{
238254
jobsToDisplay.length
239-
? jobsToDisplay.map(job => <JobListCard job={job} key={job.slug} />)
240-
: <span styleName="no-results">No Results</span>
255+
? jobsToDisplay.map((job) => {
256+
const featured = getCustomField(job.custom_fields, 'Featured');
257+
if (featured === 'n/a' && !isHotlistRendered && hotlistJobs.length && decision.enabled) {
258+
isHotlistRendered = true;
259+
return (
260+
<React.Fragment>
261+
{hotlist()}
262+
<JobListCard job={job} key={job.slug} />
263+
</React.Fragment>
264+
);
265+
}
266+
return <JobListCard job={job} key={job.slug} />;
267+
})
268+
: (
269+
<React.Fragment>
270+
{
271+
hotlistJobs.length && decision.enabled && hotlist()
272+
}
273+
<span styleName="no-results">No Results</span>
274+
</React.Fragment>
275+
)
241276
}
242277
</div>
243278
{
244279
jobsToDisplay.length
245280
? <Paginate onChange={this.onPaginate} pages={pages} page={page} /> : null
246281
}
247282
</div>
248-
{
249-
hotlistJobs.length && decision.enabled && (
250-
<div styleName="hotlist">
251-
<h5>HOT THIS WEEK</h5>
252-
<div styleName="hotlist-items">
253-
{
254-
hotlistJobs.map((hjob, indx) => (indx <= 1 ? (
255-
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`} onClick={() => this.onHotlistClick(hjob)}>
256-
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
257-
<h5 styleName="job-title">{hjob.name}</h5>
258-
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
259-
{
260-
getCustomField(hjob.custom_fields, 'Hotlist excerpt') !== 'n/a' ? (
261-
<div styleName="job-desc">
262-
{
263-
`${getCustomField(hjob.custom_fields, 'Hotlist excerpt').substring(0, CONTENT_PREVIEW_LENGTH)}${getCustomField(hjob.custom_fields, 'Hotlist excerpt').length > CONTENT_PREVIEW_LENGTH ? '...' : ''}`
264-
}
265-
</div>
266-
) : null
267-
}
268-
</Link>
269-
) : (
270-
<div styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`}>
271-
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
272-
<h5 styleName="job-title">{hjob.name}</h5>
273-
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
274-
{
275-
getCustomField(hjob.custom_fields, 'Hotlist excerpt') !== 'n/a' ? (
276-
<div styleName="job-desc">
277-
{
278-
`${getCustomField(hjob.custom_fields, 'Hotlist excerpt').substring(0, CONTENT_PREVIEW_LENGTH)}${getCustomField(hjob.custom_fields, 'Hotlist excerpt').length > CONTENT_PREVIEW_LENGTH ? '...' : ''}`
279-
}
280-
</div>
281-
) : null
282-
}
283-
<Link styleName={`hotlist-item-button-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} onClick={() => this.onHotlistClick(hjob)}>Apply Now</Link>
284-
</div>
285-
)))
286-
}
287-
</div>
288-
</div>
289-
)
290-
}
291283
</div>
292284
);
293285
}

0 commit comments

Comments
 (0)