File tree 6 files changed +62
-22
lines changed
__tests__/shared/components/ProfilePage/__snapshots__
6 files changed +62
-22
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ exports[`renders a full Profile correctly 1`] = `
16
16
>
17
17
<Sticky
18
18
activeClass = " active"
19
- bottomBoundary = { - 250 }
19
+ bottomBoundary = { 0 }
20
20
enableTransforms = { true }
21
21
enabled = { true }
22
22
onStateChange = { null }
@@ -630,7 +630,7 @@ exports[`renders an empty Profile correctly 1`] = `
630
630
>
631
631
<Sticky
632
632
activeClass = " active"
633
- bottomBoundary = { - 250 }
633
+ bottomBoundary = { 0 }
634
634
enableTransforms = { true }
635
635
enabled = { true }
636
636
onStateChange = { null }
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ class ProfileHeader extends React.Component {
35
35
const {
36
36
info,
37
37
} = this . props ;
38
- const { photoURL } = info ;
38
+ let photoURL = '' ;
39
+ if ( isomorphy . isClientSide ( ) ) {
40
+ ( { photoURL } = info ) ;
41
+ }
39
42
this . state = {
40
43
imageUrl : photoURL ,
41
44
} ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import React from 'react';
8
8
import PT from 'prop-types' ;
9
9
import { PrimaryButton } from 'topcoder-react-ui-kit' ;
10
10
import Sticky from 'react-stickynode' ;
11
+ import { isomorphy } from 'topcoder-react-utils' ;
11
12
12
13
import Robot from 'assets/images/robot-happy.svg' ;
13
14
@@ -55,11 +56,15 @@ class ProfilePage extends React.Component {
55
56
56
57
componentDidMount ( ) {
57
58
this . handleResize ( ) ;
58
- window . addEventListener ( 'resize' , this . handleResize ) ;
59
+ if ( isomorphy . isClientSide ( ) ) {
60
+ window . addEventListener ( 'resize' , this . handleResize ) ;
61
+ }
59
62
}
60
63
61
64
componentWillUnmount ( ) {
62
- window . removeEventListener ( 'resize' , this . handleResize ) ;
65
+ if ( isomorphy . isClientSide ( ) ) {
66
+ window . removeEventListener ( 'resize' , this . handleResize ) ;
67
+ }
63
68
}
64
69
65
70
getActiveTracks ( ) {
@@ -181,7 +186,7 @@ class ProfilePage extends React.Component {
181
186
< div styleName = "about-container" >
182
187
< div styleName = "profile-header-container" >
183
188
< Sticky
184
- bottomBoundary = { document . body . scrollHeight - 250 }
189
+ bottomBoundary = { isomorphy . isClientSide ( ) ? document . body . scrollHeight - 250 : 0 }
185
190
enabled = { ! isMobile }
186
191
top = { 10 }
187
192
>
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import PT from 'prop-types';
7
7
import { connect } from 'react-redux' ;
8
8
9
9
import { actions } from 'topcoder-react-lib' ;
10
+ import { MetaTags } from 'topcoder-react-utils' ;
10
11
import Error404 from 'components/Error404' ;
11
12
import LoadingIndicator from 'components/LoadingIndicator' ;
12
13
import ProfilePage from 'components/ProfilePage' ;
@@ -39,6 +40,7 @@ class ProfileContainer extends React.Component {
39
40
const {
40
41
info,
41
42
loadingError,
43
+ handleParam,
42
44
} = this . props ;
43
45
44
46
if ( loadingError ) {
@@ -58,13 +60,24 @@ class ProfileContainer extends React.Component {
58
60
return track2Ranking - track1Ranking ;
59
61
} ) ;
60
62
}
63
+ const title = `${ handleParam } | Community Profile | Topcoder` ;
64
+ const description = `Meet Topcoder member ${ handleParam } and view their skills and development and design activity. You can also see wins and tenure with Topcoder.` ;
61
65
62
- return info
63
- ? (
64
- < ProfilePage
65
- { ...this . props }
66
+ return (
67
+ < React . Fragment >
68
+ < MetaTags
69
+ description = { description }
70
+ title = { title }
66
71
/>
67
- ) : < LoadingIndicator /> ;
72
+ {
73
+ info ? (
74
+ < ProfilePage
75
+ { ...this . props }
76
+ />
77
+ ) : < LoadingIndicator />
78
+ }
79
+ </ React . Fragment >
80
+ ) ;
68
81
}
69
82
}
70
83
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Error404 from 'components/Error404';
9
9
import LoadingIndicator from 'components/LoadingIndicator' ;
10
10
import ProfileStatsPage from 'components/ProfilePage/Stats' ;
11
11
import { shouldShowGraph , isValidTrack } from 'utils/memberStats' ;
12
+ import { MetaTags } from 'topcoder-react-utils' ;
12
13
import _ from 'lodash' ;
13
14
import qs from 'qs' ;
14
15
@@ -78,23 +79,35 @@ class ProfileStatsContainer extends React.Component {
78
79
loadingError,
79
80
location,
80
81
isLoading,
82
+ handleParam,
81
83
} = this . props ;
82
84
83
85
const { track, subTrack, tab } = getQueryParamsQuery ( location ) ;
84
86
if ( loadingError || ! isValidTrack ( track , subTrack ) ) {
85
87
return < Error404 /> ;
86
88
}
87
-
88
- return isLoading
89
- ? < LoadingIndicator />
90
- : (
91
- < ProfileStatsPage
92
- { ...this . props }
93
- track = { track }
94
- subTrack = { subTrack }
95
- tab = { tab }
89
+ const title = `${ handleParam } | Community Profile | Topcoder` ;
90
+ const description = `Meet Topcoder member ${ handleParam } and view their skills and development and design activity. You can also see wins and tenure with Topcoder.` ;
91
+
92
+ return (
93
+ < React . Fragment >
94
+ < MetaTags
95
+ description = { description }
96
+ title = { title }
96
97
/>
97
- ) ;
98
+ {
99
+ isLoading ? < LoadingIndicator />
100
+ : (
101
+ < ProfileStatsPage
102
+ { ...this . props }
103
+ track = { track }
104
+ subTrack = { subTrack }
105
+ tab = { tab }
106
+ />
107
+ )
108
+ }
109
+ </ React . Fragment >
110
+ ) ;
98
111
}
99
112
}
100
113
Original file line number Diff line number Diff line change 1
1
/**
2
2
* The loader of Profile webpack chunks.
3
3
*/
4
+ import path from 'path' ;
4
5
import React from 'react' ;
5
6
6
7
import LoadingPagePlaceholder from 'components/LoadingPagePlaceholder' ;
7
- import { AppChunk } from 'topcoder-react-utils' ;
8
+ import { AppChunk , webpack } from 'topcoder-react-utils' ;
8
9
9
10
export default function ProfileStatsRoute ( props ) {
10
11
return (
@@ -16,6 +17,11 @@ export default function ProfileStatsRoute(props) {
16
17
) )
17
18
}
18
19
renderPlaceholder = { ( ) => < LoadingPagePlaceholder /> }
20
+ renderServer = { ( ) => {
21
+ const p = webpack . resolveWeak ( 'containers/ProfileStats' ) ;
22
+ const ProfileStatsContainer = webpack . requireWeak ( path . resolve ( __dirname , p ) ) ;
23
+ return < ProfileStatsContainer { ...props } /> ;
24
+ } }
19
25
/>
20
26
) ;
21
27
}
You can’t perform that action at this time.
0 commit comments