From 175d691c49b3a7f61595c65064f7530cc5d42658 Mon Sep 17 00:00:00 2001 From: dat Date: Wed, 12 Jul 2023 01:00:47 +0700 Subject: [PATCH] feat: redirect current profiles path to new profiles url --- config/default.js | 1 + config/production.js | 1 + src/shared/routes/Profile.jsx | 40 +++++++++++++-------------- src/shared/routes/Topcoder/Routes.jsx | 6 ---- src/shared/routes/index.jsx | 6 ++++ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/default.js b/config/default.js index fa819effc..9d2d93dfa 100644 --- a/config/default.js +++ b/config/default.js @@ -476,5 +476,6 @@ module.exports = { }, /* development id - makes surveys have warning about environment */ UNIVERSAL_NAV_URL: '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js', + MEMBER_PROFILE_REDIRECT_URL: 'https://profiles.topcoder-dev.com', SPRIG_ENVIRONMENT_ID: 'bUcousVQ0-yF', }; diff --git a/config/production.js b/config/production.js index 05ec83aee..cb5cd3cbb 100644 --- a/config/production.js +++ b/config/production.js @@ -236,6 +236,7 @@ module.exports = { DICE_VERIFY_URL: 'https://accounts-auth0.topcoder.com', /* development id - makes surveys have warning about environment */ UNIVERSAL_NAV_URL: '//uni-nav.topcoder.com/v1/tc-universal-nav.js', + MEMBER_PROFILE_REDIRECT_URL: 'https://profiles.topcoder.com', SPRIG_ENVIRONMENT_ID: 'a-IZBZ6-r7bU', // Specifically for the terms ID that matches the NDA requirement. diff --git a/src/shared/routes/Profile.jsx b/src/shared/routes/Profile.jsx index ee7de0f15..27394c87a 100644 --- a/src/shared/routes/Profile.jsx +++ b/src/shared/routes/Profile.jsx @@ -1,27 +1,25 @@ /** * The loader of Profile webpack chunks. */ -import path from 'path'; -import React from 'react'; - -import LoadingPagePlaceholder from 'components/LoadingPagePlaceholder'; -import { AppChunk, webpack } from 'topcoder-react-utils'; +import PT from 'prop-types'; +import { config } from 'topcoder-react-utils'; export default function ProfileLoader(props) { - return ( - import(/* webpackChunkName: "profile/chunk" */ 'containers/Profile') - .then(({ default: ProfileContainer }) => ( - - )) - } - renderPlaceholder={() => } - renderServer={() => { - const p = webpack.resolveWeak('containers/Profile'); - const ProfileContainer = webpack.requireWeak(path.resolve(__dirname, p)); - return ; - }} - /> - ); + if (typeof window !== 'undefined') { + const { + match: { + params: { handle }, + }, + } = props; + window.location.replace(`${config.MEMBER_PROFILE_REDIRECT_URL}/${handle}`); // totest + } + return null; } + +ProfileLoader.propTypes = { + match: PT.shape({ + params: PT.shape({ + handle: PT.string, + }), + }).isRequired, +}; diff --git a/src/shared/routes/Topcoder/Routes.jsx b/src/shared/routes/Topcoder/Routes.jsx index 769904af8..707ca1d1d 100644 --- a/src/shared/routes/Topcoder/Routes.jsx +++ b/src/shared/routes/Topcoder/Routes.jsx @@ -30,7 +30,6 @@ import Dashboard from './Dashboard'; import Notifications from './Notifications'; import Settings from '../Settings'; import HallOfFame from '../HallOfFame'; -import Profile from '../Profile'; import ProfileBadges from '../ProfileBadges'; import Scoreboard from '../tco/scoreboard'; import MemberSearch from '../../containers/MemberSearch'; @@ -85,11 +84,6 @@ export default function Topcoder() { exact path="/challenges/:challengeId([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}|\d{5,8})/submit" /> - { config.GAMIFICATION.ENABLE_BADGE_UI && ( + -- 2.39.2 (Apple Git-143)