Skip to content

react-helmet fix and SEO update to Profiles Pages #5151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ workflows:
filters:
branches:
only:
- apollo-site
- develop
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`renders a full Profile correctly 1`] = `
>
<Sticky
activeClass="active"
bottomBoundary={-250}
bottomBoundary={0}
enableTransforms={true}
enabled={true}
onStateChange={null}
Expand Down Expand Up @@ -630,7 +630,7 @@ exports[`renders an empty Profile correctly 1`] = `
>
<Sticky
activeClass="active"
bottomBoundary={-250}
bottomBoundary={0}
enableTransforms={true}
enabled={true}
onStateChange={null}
Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/ProfilePage/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class ProfileHeader extends React.Component {
const {
info,
} = this.props;
const { photoURL } = info;
let photoURL = '';
if (isomorphy.isClientSide()) {
({ photoURL } = info);
}
this.state = {
imageUrl: photoURL,
};
Expand Down
11 changes: 8 additions & 3 deletions src/shared/components/ProfilePage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import PT from 'prop-types';
import { PrimaryButton } from 'topcoder-react-ui-kit';
import Sticky from 'react-stickynode';
import { isomorphy } from 'topcoder-react-utils';

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

Expand Down Expand Up @@ -55,11 +56,15 @@ class ProfilePage extends React.Component {

componentDidMount() {
this.handleResize();
window.addEventListener('resize', this.handleResize);
if (isomorphy.isClientSide()) {
window.addEventListener('resize', this.handleResize);
}
}

componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
if (isomorphy.isClientSide()) {
window.removeEventListener('resize', this.handleResize);
}
}

getActiveTracks() {
Expand Down Expand Up @@ -181,7 +186,7 @@ class ProfilePage extends React.Component {
<div styleName="about-container">
<div styleName="profile-header-container">
<Sticky
bottomBoundary={document.body.scrollHeight - 250}
bottomBoundary={isomorphy.isClientSide() ? document.body.scrollHeight - 250 : 0}
enabled={!isMobile}
top={10}
>
Expand Down
23 changes: 18 additions & 5 deletions src/shared/containers/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PT from 'prop-types';
import { connect } from 'react-redux';

import { actions } from 'topcoder-react-lib';
import { MetaTags } from 'topcoder-react-utils';
import Error404 from 'components/Error404';
import LoadingIndicator from 'components/LoadingIndicator';
import ProfilePage from 'components/ProfilePage';
Expand Down Expand Up @@ -39,6 +40,7 @@ class ProfileContainer extends React.Component {
const {
info,
loadingError,
handleParam,
} = this.props;

if (loadingError) {
Expand All @@ -58,13 +60,24 @@ class ProfileContainer extends React.Component {
return track2Ranking - track1Ranking;
});
}
const title = `${handleParam} | Community Profile | Topcoder`;
const description = `Meet Topcoder member ${handleParam} and view their skills and development and design activity. You can also see wins and tenure with Topcoder.`;

return info
? (
<ProfilePage
{...this.props}
return (
<React.Fragment>
<MetaTags
description={description}
title={title}
/>
) : <LoadingIndicator />;
{
info ? (
<ProfilePage
{...this.props}
/>
) : <LoadingIndicator />
}
</React.Fragment>
);
}
}

Expand Down
33 changes: 23 additions & 10 deletions src/shared/containers/ProfileStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Error404 from 'components/Error404';
import LoadingIndicator from 'components/LoadingIndicator';
import ProfileStatsPage from 'components/ProfilePage/Stats';
import { shouldShowGraph, isValidTrack } from 'utils/memberStats';
import { MetaTags } from 'topcoder-react-utils';
import _ from 'lodash';
import qs from 'qs';

Expand Down Expand Up @@ -78,23 +79,35 @@ class ProfileStatsContainer extends React.Component {
loadingError,
location,
isLoading,
handleParam,
} = this.props;

const { track, subTrack, tab } = getQueryParamsQuery(location);
if (loadingError || !isValidTrack(track, subTrack)) {
return <Error404 />;
}

return isLoading
? <LoadingIndicator />
: (
<ProfileStatsPage
{...this.props}
track={track}
subTrack={subTrack}
tab={tab}
const title = `${handleParam} | Community Profile | Topcoder`;
const description = `Meet Topcoder member ${handleParam} and view their skills and development and design activity. You can also see wins and tenure with Topcoder.`;

return (
<React.Fragment>
<MetaTags
description={description}
title={title}
/>
);
{
isLoading ? <LoadingIndicator />
: (
<ProfileStatsPage
{...this.props}
track={track}
subTrack={subTrack}
tab={tab}
/>
)
}
</React.Fragment>
);
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/shared/routes/ChallengeDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

import _ from 'lodash';
import LoadingPagePlaceholder from 'components/LoadingPagePlaceholder';
import path from 'path';
import React from 'react';
import qs from 'qs';
import { AppChunk } from 'topcoder-react-utils';
import { AppChunk, webpack } from 'topcoder-react-utils';

export default function ChallengeDetailsRoute(props) {
return (
Expand All @@ -30,6 +31,11 @@ export default function ChallengeDetailsRoute(props) {
})
}
renderPlaceholder={() => <LoadingPagePlaceholder />}
renderServer={() => {
const p = webpack.resolveWeak('containers/challenge-detail');
const ChallengeDetails = webpack.requireWeak(path.resolve(__dirname, p));
return <ChallengeDetails {...props} />;
}}
/>
);
}
8 changes: 7 additions & 1 deletion src/shared/routes/ProfileStats.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/**
* The loader of Profile webpack chunks.
*/
import path from 'path';
import React from 'react';

import LoadingPagePlaceholder from 'components/LoadingPagePlaceholder';
import { AppChunk } from 'topcoder-react-utils';
import { AppChunk, webpack } from 'topcoder-react-utils';

export default function ProfileStatsRoute(props) {
return (
Expand All @@ -16,6 +17,11 @@ export default function ProfileStatsRoute(props) {
))
}
renderPlaceholder={() => <LoadingPagePlaceholder />}
renderServer={() => {
const p = webpack.resolveWeak('containers/ProfileStats');
const ProfileStatsContainer = webpack.requireWeak(path.resolve(__dirname, p));
return <ProfileStatsContainer {...props} />;
}}
/>
);
}