Skip to content

Commit d2b6149

Browse files
committed
Merge branch 'universal_nav' into marathon_match_submission_download
# Conflicts: # src/shared/containers/TopcoderHeader/index.jsx
2 parents 001704a + d3cd33a commit d2b6149

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/shared/containers/TopcoderHeader/index.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ const TopcoderHeader = () => {
5858

5959
tcUniNav('init', headerElId.current, {
6060
type: navType,
61-
toolName: getSubPageConfiguration().toolName,
62-
toolRoot: getSubPageConfiguration().toolRoot,
61+
toolName: getSubPageConfiguration(user.handle).toolName,
62+
toolRoot: getSubPageConfiguration(user.handle).toolRoot,
6363
user: 'auto',
6464
signOut: () => {
6565
window.location = `${config.URL.BASE}/logout?ref=nav`;
@@ -73,6 +73,13 @@ const TopcoderHeader = () => {
7373
});
7474
}, [navType]);
7575

76+
useEffect(() => {
77+
tcUniNav('update', headerElId.current, {
78+
toolName: getSubPageConfiguration(user.handle).toolName,
79+
user: isAuthenticated ? navigationUserInfo : null,
80+
});
81+
}, [isAuthenticated, navigationUserInfo]);
82+
7683
return (
7784
<div styleName="header-container" id={headerElId.current} ref={headerRef} />
7885
);

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)