Skip to content

Commit cb4021e

Browse files
authored
Merge pull request #6998 from topcoder-platform/develop
TOP-2194 Shutdown and remove gig referral UIs
2 parents 172dfe9 + 6302f22 commit cb4021e

File tree

11 files changed

+2
-946
lines changed

11 files changed

+2
-946
lines changed

src/shared/actions/growSurf.js

-62
This file was deleted.

src/shared/components/Gigs/GigDetails/index.jsx

+2-125
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@ import { isEmpty } from 'lodash';
88
import React, { useState } from 'react';
99
import PT from 'prop-types';
1010
import { connect } from 'react-redux';
11-
import { isomorphy, Link, config } from 'topcoder-react-utils';
12-
import { PrimaryButton } from 'topcoder-react-ui-kit';
11+
import { Link, config } from 'topcoder-react-utils';
1312
import ReactHtmlParser from 'react-html-parser';
1413
import { getSalaryType, getCustomField } from 'utils/gigs';
1514
import SubscribeMailChimpTag from 'containers/SubscribeMailChimpTag';
16-
import { isValidEmail } from 'utils/tc';
1715
import './style.scss';
18-
import IconFacebook from 'assets/images/icon-facebook.svg';
19-
import IconTwitter from 'assets/images/icon-twitter.svg';
20-
import IconLinkedIn from 'assets/images/icon-linkedIn.svg';
2116
import IconLocation from 'assets/images/icon-location.svg';
2217
import IconMoney from 'assets/images/icon-payment.svg';
2318
import IconDuration from 'assets/images/icon-calendar-gig.svg';
@@ -28,7 +23,6 @@ import iconLabel1 from 'assets/images/l1.png';
2823
import iconLabel2 from 'assets/images/l2.png';
2924
import iconLabel3 from 'assets/images/l3.png';
3025
import SadFace from 'assets/images/sad-face-icon.svg';
31-
import ReferralModal from '../ReferralModal';
3226
import LoginModal from '../LoginModal';
3327

3428
// Cleanup HTML from style tags
@@ -44,28 +38,16 @@ const ReactHtmlParserOptions = {
4438

4539
function GigDetails(props) {
4640
const {
47-
job, application, profile, onSendClick, isReferrSucess, isReferrError, onReferralDone, growSurf,
41+
job, application, profile,
4842
} = props;
49-
let shareUrl;
5043
let retUrl;
51-
if (isomorphy.isClientSide()) {
52-
shareUrl = encodeURIComponent(window.location.href);
53-
if (growSurf && growSurf.data) {
54-
shareUrl = `${window.location.origin}${window.location.pathname}?referralId=${growSurf.data.id}`;
55-
}
56-
retUrl = `${window.location.origin}${window.location.pathname}/apply${window.location.search}`;
57-
}
5844
let skills = getCustomField(job.custom_fields, 'Technologies Required');
5945
if (skills !== 'n/a') skills = skills.split(',').join(', ');
6046
const hPerW = getCustomField(job.custom_fields, 'Hours per week');
6147
const compens = job.min_annual_salary === job.max_annual_salary ? job.max_annual_salary : `${job.min_annual_salary} - ${job.max_annual_salary} (USD)`;
6248

63-
const [isModalOpen, setModalOpen] = useState(false);
6449
const [isLoginModalOpen, setLoginModalOpen] = useState(false);
65-
const [copyBtnText, setCopyBtnText] = useState('COPY');
66-
const [referrEmail, setreferrEmail] = useState();
6750
const duration = getCustomField(job.custom_fields, 'Duration');
68-
let refEmailInput;
6951

7052
return (
7153
<div styleName="container">
@@ -157,83 +139,6 @@ function GigDetails(props) {
157139
</div>
158140
</div>
159141
<div styleName="right">
160-
<div styleName="referr-area">
161-
<h6>REFER THIS GIG</h6>
162-
{
163-
growSurf && growSurf.data ? (
164-
<React.Fragment>
165-
<span styleName="referralLinkTitile">Share your Referral Link:</span>
166-
<input type="text" styleName="referralLink" readOnly value={`https://topcoder.com/gigs/${job.slug}?referralId=${growSurf.data.id}`} />
167-
<div styleName="copyAndShare">
168-
<PrimaryButton
169-
onClick={() => {
170-
const copyhelper = document.createElement('input');
171-
copyhelper.className = 'copyhelper';
172-
document.body.appendChild(copyhelper);
173-
copyhelper.value = `https://www.topcoder.com/gigs/${job.slug}?referralId=${growSurf.data.id}`;
174-
copyhelper.select();
175-
document.execCommand('copy');
176-
document.body.removeChild(copyhelper);
177-
setCopyBtnText('COPIED');
178-
setTimeout(() => {
179-
setCopyBtnText('COPY');
180-
}, 3000);
181-
}}
182-
>
183-
{copyBtnText}
184-
</PrimaryButton>
185-
<div styleName="shareButtons">
186-
Share on:&nbsp;&nbsp;
187-
<a href={`https://www.linkedin.com/sharing/share-offsite/?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
188-
<IconLinkedIn />
189-
</a>
190-
<a href={`https://www.facebook.com/sharer/sharer.php?u=${shareUrl}&src=share_button`} target="_blank" rel="noopener noreferrer">
191-
<IconFacebook />
192-
</a>
193-
<a href={`https://twitter.com/intent/tweet?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
194-
<IconTwitter />
195-
</a>
196-
</div>
197-
</div>
198-
</React.Fragment>
199-
) : (
200-
<div styleName="shareButtons">
201-
Share this job on:&nbsp;&nbsp;
202-
<a href={`https://www.linkedin.com/sharing/share-offsite/?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
203-
<IconLinkedIn />
204-
</a>
205-
<a href={`https://www.facebook.com/sharer/sharer.php?u=${shareUrl}&src=share_button`} target="_blank" rel="noopener noreferrer">
206-
<IconFacebook />
207-
</a>
208-
<a href={`https://twitter.com/intent/tweet?url=${shareUrl}`} target="_blank" rel="noopener noreferrer">
209-
<IconTwitter />
210-
</a>
211-
</div>
212-
)
213-
}
214-
<div styleName="sepWrap">
215-
<div styleName="sepLine" />
216-
<span>or</span>
217-
<div styleName="sepLine" />
218-
</div>
219-
<p>Refer someone to this gig and earn $500. Just add their email below. See <Link to="/community/gig-referral" styleName="how-it-works" openNewTab>how it works.</Link></p>
220-
<div styleName="referr-form">
221-
<input type="email" placeholder="Email" onChange={e => setreferrEmail(e.target.value)} ref={ref => refEmailInput = ref} />
222-
<button
223-
type="button"
224-
onClick={() => {
225-
if (!isEmpty(profile) && growSurf.data) {
226-
onSendClick(referrEmail);
227-
setreferrEmail();
228-
refEmailInput.value = '';
229-
}
230-
setModalOpen(true);
231-
}}
232-
disabled={!referrEmail || !isValidEmail(referrEmail)}
233-
>SEND
234-
</button>
235-
</div>
236-
</div>
237142
<div styleName="subscribe-area">
238143
<h6>SUBSCRIBE TO WEEKLY GIG UPDATES</h6>
239144
<SubscribeMailChimpTag listId="28bfd3c062" groups={{ d0c48e9da3: true }} />
@@ -256,27 +161,6 @@ function GigDetails(props) {
256161
</ul>
257162
</div>
258163
<div styleName="support">If you have any questions or doubts, don’t hesitate to email <a href="mailto:[email protected]">[email protected]</a>.</div>
259-
<div styleName="referral">
260-
{
261-
isModalOpen
262-
&& (
263-
<ReferralModal
264-
profile={profile}
265-
onCloseButton={() => {
266-
onReferralDone();
267-
setModalOpen(false);
268-
}}
269-
isReferrSucess={isReferrSucess}
270-
isReferrError={isReferrError}
271-
referralId={growSurf && growSurf.data ? growSurf.data.id : null}
272-
onReferralDone={() => {
273-
onReferralDone(true);
274-
setModalOpen(false);
275-
}}
276-
/>
277-
)
278-
}
279-
</div>
280164
{
281165
isLoginModalOpen && <LoginModal retUrl={retUrl} onCancel={() => setLoginModalOpen(false)} />
282166
}
@@ -292,19 +176,12 @@ function GigDetails(props) {
292176
GigDetails.defaultProps = {
293177
application: null,
294178
profile: {},
295-
growSurf: {},
296-
isReferrError: null,
297179
};
298180

299181
GigDetails.propTypes = {
300182
job: PT.shape().isRequired,
301183
application: PT.shape(),
302184
profile: PT.shape(),
303-
onSendClick: PT.func.isRequired,
304-
isReferrSucess: PT.bool.isRequired,
305-
isReferrError: PT.shape(),
306-
onReferralDone: PT.func.isRequired,
307-
growSurf: PT.shape(),
308185
};
309186

310187
function mapStateToProps(state) {

src/shared/components/Gigs/GigDetails/style.scss

-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
@include primaryBtn;
3232
}
3333

34-
.referral {
35-
display: flex;
36-
}
37-
3834
.container {
3935
max-width: $screen-lg;
4036
min-height: 50vh;

src/shared/components/Gigs/ReferralCode/index.jsx

-120
This file was deleted.

0 commit comments

Comments
 (0)