Skip to content

Commit fb6f70f

Browse files
Merge pull request #5141 from topcoder-platform/f2f-30146374
f2f-30146374
2 parents b9e2811 + 1a93030 commit fb6f70f

File tree

6 files changed

+62
-22
lines changed

6 files changed

+62
-22
lines changed

__tests__/shared/components/ProfilePage/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`renders a full Profile correctly 1`] = `
1616
>
1717
<Sticky
1818
activeClass="active"
19-
bottomBoundary={-250}
19+
bottomBoundary={0}
2020
enableTransforms={true}
2121
enabled={true}
2222
onStateChange={null}
@@ -630,7 +630,7 @@ exports[`renders an empty Profile correctly 1`] = `
630630
>
631631
<Sticky
632632
activeClass="active"
633-
bottomBoundary={-250}
633+
bottomBoundary={0}
634634
enableTransforms={true}
635635
enabled={true}
636636
onStateChange={null}

src/shared/components/ProfilePage/Header/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class ProfileHeader extends React.Component {
3535
const {
3636
info,
3737
} = this.props;
38-
const { photoURL } = info;
38+
let photoURL = '';
39+
if (isomorphy.isClientSide()) {
40+
({ photoURL } = info);
41+
}
3942
this.state = {
4043
imageUrl: photoURL,
4144
};

src/shared/components/ProfilePage/index.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import React from 'react';
88
import PT from 'prop-types';
99
import { PrimaryButton } from 'topcoder-react-ui-kit';
1010
import Sticky from 'react-stickynode';
11+
import { isomorphy } from 'topcoder-react-utils';
1112

1213
import Robot from 'assets/images/robot-happy.svg';
1314

@@ -55,11 +56,15 @@ class ProfilePage extends React.Component {
5556

5657
componentDidMount() {
5758
this.handleResize();
58-
window.addEventListener('resize', this.handleResize);
59+
if (isomorphy.isClientSide()) {
60+
window.addEventListener('resize', this.handleResize);
61+
}
5962
}
6063

6164
componentWillUnmount() {
62-
window.removeEventListener('resize', this.handleResize);
65+
if (isomorphy.isClientSide()) {
66+
window.removeEventListener('resize', this.handleResize);
67+
}
6368
}
6469

6570
getActiveTracks() {
@@ -181,7 +186,7 @@ class ProfilePage extends React.Component {
181186
<div styleName="about-container">
182187
<div styleName="profile-header-container">
183188
<Sticky
184-
bottomBoundary={document.body.scrollHeight - 250}
189+
bottomBoundary={isomorphy.isClientSide() ? document.body.scrollHeight - 250 : 0}
185190
enabled={!isMobile}
186191
top={10}
187192
>

src/shared/containers/Profile.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import PT from 'prop-types';
77
import { connect } from 'react-redux';
88

99
import { actions } from 'topcoder-react-lib';
10+
import { MetaTags } from 'topcoder-react-utils';
1011
import Error404 from 'components/Error404';
1112
import LoadingIndicator from 'components/LoadingIndicator';
1213
import ProfilePage from 'components/ProfilePage';
@@ -39,6 +40,7 @@ class ProfileContainer extends React.Component {
3940
const {
4041
info,
4142
loadingError,
43+
handleParam,
4244
} = this.props;
4345

4446
if (loadingError) {
@@ -58,13 +60,24 @@ class ProfileContainer extends React.Component {
5860
return track2Ranking - track1Ranking;
5961
});
6062
}
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.`;
6165

62-
return info
63-
? (
64-
<ProfilePage
65-
{...this.props}
66+
return (
67+
<React.Fragment>
68+
<MetaTags
69+
description={description}
70+
title={title}
6671
/>
67-
) : <LoadingIndicator />;
72+
{
73+
info ? (
74+
<ProfilePage
75+
{...this.props}
76+
/>
77+
) : <LoadingIndicator />
78+
}
79+
</React.Fragment>
80+
);
6881
}
6982
}
7083

src/shared/containers/ProfileStats.jsx

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Error404 from 'components/Error404';
99
import LoadingIndicator from 'components/LoadingIndicator';
1010
import ProfileStatsPage from 'components/ProfilePage/Stats';
1111
import { shouldShowGraph, isValidTrack } from 'utils/memberStats';
12+
import { MetaTags } from 'topcoder-react-utils';
1213
import _ from 'lodash';
1314
import qs from 'qs';
1415

@@ -78,23 +79,35 @@ class ProfileStatsContainer extends React.Component {
7879
loadingError,
7980
location,
8081
isLoading,
82+
handleParam,
8183
} = this.props;
8284

8385
const { track, subTrack, tab } = getQueryParamsQuery(location);
8486
if (loadingError || !isValidTrack(track, subTrack)) {
8587
return <Error404 />;
8688
}
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}
9697
/>
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+
);
98111
}
99112
}
100113

src/shared/routes/ProfileStats.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/**
22
* The loader of Profile webpack chunks.
33
*/
4+
import path from 'path';
45
import React from 'react';
56

67
import LoadingPagePlaceholder from 'components/LoadingPagePlaceholder';
7-
import { AppChunk } from 'topcoder-react-utils';
8+
import { AppChunk, webpack } from 'topcoder-react-utils';
89

910
export default function ProfileStatsRoute(props) {
1011
return (
@@ -16,6 +17,11 @@ export default function ProfileStatsRoute(props) {
1617
))
1718
}
1819
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+
}}
1925
/>
2026
);
2127
}

0 commit comments

Comments
 (0)