@@ -8,16 +8,11 @@ import { isEmpty } from 'lodash';
8
8
import React , { useState } from 'react' ;
9
9
import PT from 'prop-types' ;
10
10
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' ;
13
12
import ReactHtmlParser from 'react-html-parser' ;
14
13
import { getSalaryType , getCustomField } from 'utils/gigs' ;
15
14
import SubscribeMailChimpTag from 'containers/SubscribeMailChimpTag' ;
16
- import { isValidEmail } from 'utils/tc' ;
17
15
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' ;
21
16
import IconLocation from 'assets/images/icon-location.svg' ;
22
17
import IconMoney from 'assets/images/icon-payment.svg' ;
23
18
import IconDuration from 'assets/images/icon-calendar-gig.svg' ;
@@ -28,7 +23,6 @@ import iconLabel1 from 'assets/images/l1.png';
28
23
import iconLabel2 from 'assets/images/l2.png' ;
29
24
import iconLabel3 from 'assets/images/l3.png' ;
30
25
import SadFace from 'assets/images/sad-face-icon.svg' ;
31
- import ReferralModal from '../ReferralModal' ;
32
26
import LoginModal from '../LoginModal' ;
33
27
34
28
// Cleanup HTML from style tags
@@ -44,28 +38,16 @@ const ReactHtmlParserOptions = {
44
38
45
39
function GigDetails ( props ) {
46
40
const {
47
- job, application, profile, onSendClick , isReferrSucess , isReferrError , onReferralDone , growSurf ,
41
+ job, application, profile,
48
42
} = props ;
49
- let shareUrl ;
50
43
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
- }
58
44
let skills = getCustomField ( job . custom_fields , 'Technologies Required' ) ;
59
45
if ( skills !== 'n/a' ) skills = skills . split ( ',' ) . join ( ', ' ) ;
60
46
const hPerW = getCustomField ( job . custom_fields , 'Hours per week' ) ;
61
47
const compens = job . min_annual_salary === job . max_annual_salary ? job . max_annual_salary : `${ job . min_annual_salary } - ${ job . max_annual_salary } (USD)` ;
62
48
63
- const [ isModalOpen , setModalOpen ] = useState ( false ) ;
64
49
const [ isLoginModalOpen , setLoginModalOpen ] = useState ( false ) ;
65
- const [ copyBtnText , setCopyBtnText ] = useState ( 'COPY' ) ;
66
- const [ referrEmail , setreferrEmail ] = useState ( ) ;
67
50
const duration = getCustomField ( job . custom_fields , 'Duration' ) ;
68
- let refEmailInput ;
69
51
70
52
return (
71
53
< div styleName = "container" >
@@ -157,83 +139,6 @@ function GigDetails(props) {
157
139
</ div >
158
140
</ div >
159
141
< 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:
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:
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 >
237
142
< div styleName = "subscribe-area" >
238
143
< h6 > SUBSCRIBE TO WEEKLY GIG UPDATES</ h6 >
239
144
< SubscribeMailChimpTag listId = "28bfd3c062" groups = { { d0c48e9da3 : true } } />
@@ -256,27 +161,6 @@ function GigDetails(props) {
256
161
</ ul >
257
162
</ div >
258
163
< 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 >
280
164
{
281
165
isLoginModalOpen && < LoginModal retUrl = { retUrl } onCancel = { ( ) => setLoginModalOpen ( false ) } />
282
166
}
@@ -292,19 +176,12 @@ function GigDetails(props) {
292
176
GigDetails . defaultProps = {
293
177
application : null ,
294
178
profile : { } ,
295
- growSurf : { } ,
296
- isReferrError : null ,
297
179
} ;
298
180
299
181
GigDetails . propTypes = {
300
182
job : PT . shape ( ) . isRequired ,
301
183
application : PT . shape ( ) ,
302
184
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 ( ) ,
308
185
} ;
309
186
310
187
function mapStateToProps ( state ) {
0 commit comments