Skip to content

Commit d3cd33a

Browse files
committed
Fix for showing “My Profile” or “Profiles”
1 parent 64b88d3 commit d3cd33a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/shared/containers/TopcoderHeader/index.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ const TopcoderHeader = ({ auth }) => {
6868

6969
tcUniNav('init', headerElId.current, {
7070
type: navType,
71-
toolName: getSubPageConfiguration().toolName,
72-
toolRoot: getSubPageConfiguration().toolRoot,
71+
toolName: getSubPageConfiguration(user.handle).toolName,
72+
toolRoot: getSubPageConfiguration(user.handle).toolRoot,
7373
signOut: () => {
7474
window.location = `${config.URL.BASE}/logout?ref=nav`;
7575
},
@@ -84,6 +84,7 @@ const TopcoderHeader = ({ auth }) => {
8484

8585
useEffect(() => {
8686
tcUniNav('update', headerElId.current, {
87+
toolName: getSubPageConfiguration(user.handle).toolName,
8788
user: isAuthenticated ? navigationUserInfo : null,
8889
});
8990
}, [isAuthenticated, navigationUserInfo]);

src/shared/utils/url.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export function getInitials(firstName = '', lastName = '') {
164164

165165
export const DEFAULT_AVATAR_URL = 'https://images.ctfassets.net/b5f1djy59z3a/4PTwZVSf3W7qgs9WssqbVa/4c51312671a4b9acbdfd7f5e22320b62/default_avatar.svg';
166166

167-
export const getSubPageConfiguration = () => {
167+
export const getSubPageConfiguration = (loginUserHandle) => {
168168
let toolName = 'Community';
169169
let toolRoot = '/';
170170
let loginRedirect = '/';
@@ -206,7 +206,8 @@ export const getSubPageConfiguration = () => {
206206
}
207207

208208
if (url.includes('/members')) {
209-
toolName = 'My Profile';
209+
const handle = url.substring(url.lastIndexOf('/') + 1);
210+
toolName = loginUserHandle && handle && loginUserHandle.toLowerCase() === handle.toLocaleLowerCase() ? 'My Profile' : 'Profiles';
210211
toolRoot = url;
211212
loginRedirect = url;
212213
type = 'tool';

0 commit comments

Comments
 (0)