Skip to content

Commit 68eed92

Browse files
Merge pull request #5516 from topcoder-platform/gig-ab-v2
Gig ab v2
2 parents 2abb10c + 1322bc1 commit 68eed92

File tree

6 files changed

+630
-90
lines changed

6 files changed

+630
-90
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ workflows:
290290
filters:
291291
branches:
292292
only:
293-
- free
293+
- gig-ab-v2
294294
# This is beta env for production soft releases
295295
- "build-prod-beta":
296296
context : org-global

src/shared/containers/Gigs/RecruitCRMJobApply.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { withOptimizely } from '@optimizely/react-sdk';
1414
import techSkills from './techSkills';
1515

1616

17+
const cookies = require('browser-cookies');
1718
const countries = require('i18n-iso-countries');
1819
countries.registerLocale(require('i18n-iso-countries/langs/en.json'));
1920

@@ -129,6 +130,22 @@ class RecruitCRMJobApplyContainer extends React.Component {
129130
if (_.isEmpty(state.formErrors)) {
130131
applyForJob(job, formData);
131132
optimizely.track('Submit Application Form');
133+
const isFeatured = _.find(job.custom_fields, ['field_name', 'Featured']);
134+
const jobTags = _.find(job.custom_fields, ['field_name', 'Job Tag']);
135+
let hotListCookie = cookies.get('_tc.hcl');
136+
if (isFeatured && isFeatured.value) {
137+
optimizely.track('Submit to Featured Gigs');
138+
}
139+
if (jobTags && jobTags.value) {
140+
optimizely.track('Submit to Tagged Gigs');
141+
}
142+
if (hotListCookie) {
143+
hotListCookie = JSON.parse(hotListCookie);
144+
if (hotListCookie.slug === job.slug) {
145+
optimizely.track('Submit to Hotlist Gigs');
146+
cookies.erase('_tc.hcl');
147+
}
148+
}
132149
}
133150
});
134151
}

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import { getQuery, updateQuery } from 'utils/url';
1919
import { withOptimizely } from '@optimizely/react-sdk';
2020
import './jobLisingStyles.scss';
2121

22-
const CONTENT_PREVIEW_LENGTH = 175;
22+
const cookies = require('browser-cookies');
23+
2324
const GIGS_PER_PAGE = 10;
2425
// Sort by dropdown
2526
const sortByOptions = [
@@ -47,7 +48,7 @@ class RecruitCRMJobsContainer extends React.Component {
4748
this.onFilter = this.onFilter.bind(this);
4849
this.onLocation = this.onLocation.bind(this);
4950
this.onSort = this.onSort.bind(this);
50-
this.onHotlistApply = this.onHotlistApply.bind(this);
51+
this.onHotlistClick = this.onHotlistClick.bind(this);
5152
}
5253

5354
componentDidMount() {
@@ -121,9 +122,14 @@ class RecruitCRMJobsContainer extends React.Component {
121122
});
122123
}
123124

124-
onHotlistApply() {
125+
onHotlistClick(job) {
125126
const { optimizely } = this.props;
126127
optimizely.track('Hotlist ads click');
128+
cookies.set('_tc.hcl', JSON.stringify({
129+
slug: job.slug,
130+
}), {
131+
expires: 0,
132+
});
127133
}
128134

129135
render() {
@@ -151,7 +157,8 @@ class RecruitCRMJobsContainer extends React.Component {
151157
// optimizely decide
152158
let decision = { enabled: true };
153159
if (isomorphy.isClientSide()) {
154-
decision = optimizely.decide('gig_listing_hotlist');
160+
// decision = optimizely.decide('gig_listing_hotlist');
161+
decision = optimizely.decide('gig_listing_hotlist_center');
155162
}
156163
let jobsToDisplay = jobs;
157164
// build hotlist of jobs if present
@@ -216,6 +223,23 @@ class RecruitCRMJobsContainer extends React.Component {
216223
jobsToDisplay,
217224
page * GIGS_PER_PAGE, (page * GIGS_PER_PAGE) + GIGS_PER_PAGE,
218225
);
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+
);
219243

220244
return (
221245
<div styleName={hotlistJobs.length && decision.enabled ? 'container-with-hotlist' : 'container'}>
@@ -228,58 +252,34 @@ class RecruitCRMJobsContainer extends React.Component {
228252
<div styleName="jobs-list-container">
229253
{
230254
jobsToDisplay.length
231-
? jobsToDisplay.map(job => <JobListCard job={job} key={job.slug} />)
232-
: <span styleName="no-results">No Results</span>
255+
? jobsToDisplay.map((job, indx) => {
256+
const featured = getCustomField(job.custom_fields, 'Featured');
257+
if ((featured === 'n/a' || indx === 2) && !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+
)
233276
}
234277
</div>
235278
{
236279
jobsToDisplay.length
237280
? <Paginate onChange={this.onPaginate} pages={pages} page={page} /> : null
238281
}
239282
</div>
240-
{
241-
hotlistJobs.length && decision.enabled && (
242-
<div styleName="hotlist">
243-
<h5>HOT THIS WEEK</h5>
244-
<div styleName="hotlist-items">
245-
{
246-
hotlistJobs.map((hjob, indx) => (indx <= 1 ? (
247-
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`} onClick={this.onHotlistApply}>
248-
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
249-
<h5 styleName="job-title">{hjob.name}</h5>
250-
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
251-
{
252-
getCustomField(hjob.custom_fields, 'Hotlist excerpt') !== 'n/a' ? (
253-
<div styleName="job-desc">
254-
{
255-
`${getCustomField(hjob.custom_fields, 'Hotlist excerpt').substring(0, CONTENT_PREVIEW_LENGTH)}${getCustomField(hjob.custom_fields, 'Hotlist excerpt').length > CONTENT_PREVIEW_LENGTH ? '...' : ''}`
256-
}
257-
</div>
258-
) : null
259-
}
260-
</Link>
261-
) : (
262-
<div styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`}>
263-
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
264-
<h5 styleName="job-title">{hjob.name}</h5>
265-
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
266-
{
267-
getCustomField(hjob.custom_fields, 'Hotlist excerpt') !== 'n/a' ? (
268-
<div styleName="job-desc">
269-
{
270-
`${getCustomField(hjob.custom_fields, 'Hotlist excerpt').substring(0, CONTENT_PREVIEW_LENGTH)}${getCustomField(hjob.custom_fields, 'Hotlist excerpt').length > CONTENT_PREVIEW_LENGTH ? '...' : ''}`
271-
}
272-
</div>
273-
) : null
274-
}
275-
<Link styleName={`hotlist-item-button-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} onClick={this.onHotlistApply}>Apply Now</Link>
276-
</div>
277-
)))
278-
}
279-
</div>
280-
</div>
281-
)
282-
}
283283
</div>
284284
);
285285
}

0 commit comments

Comments
 (0)