File tree 1 file changed +8
-3
lines changed
src/shared/components/challenge-detail/Winners/Winner
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { Avatar } from 'topcoder-react-ui-kit' ;
2
2
import PT from 'prop-types' ;
3
- import React from 'react' ;
3
+ import React , { useEffect , useState } from 'react' ;
4
4
import _ from 'lodash' ;
5
5
import { config } from 'topcoder-react-utils' ;
6
6
@@ -20,6 +20,11 @@ export default function Winner({
20
20
viewable,
21
21
winner,
22
22
} ) {
23
+ const [ windowOrigin , setWindowOrigin ] = useState ( ) ;
24
+ useEffect ( ( ) => {
25
+ setWindowOrigin ( window . origin ) ;
26
+ } , [ ] ) ;
27
+
23
28
const submissionId = viewable && getId ( submissions , winner . placement ) ;
24
29
25
30
let placeStyle = winner . placement < 4 ? `place-${ winner . placement } ` : '' ;
@@ -69,9 +74,9 @@ export default function Winner({
69
74
/>
70
75
< div >
71
76
< a
72
- href = { `${ window . origin } /members/${ winner . handle } ` }
77
+ href = { `${ windowOrigin } /members/${ winner . handle } ` }
73
78
styleName = "handle"
74
- target = { `${ _ . includes ( window . origin , 'www' ) ? '_self' : '_blank' } ` }
79
+ target = { `${ _ . includes ( windowOrigin , 'www' ) ? '_self' : '_blank' } ` }
75
80
>
76
81
{ winner . handle }
77
82
</ a >
You can’t perform that action at this time.
0 commit comments