Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0ed544a

Browse files
authoredJan 19, 2022
Merge pull request #68 from topcoder-platform/remove-selfService-navbar
remove selfService navbar
2 parents 58282b5 + cc68329 commit 0ed544a

File tree

9 files changed

+17
-471
lines changed

9 files changed

+17
-471
lines changed
 

‎src/App.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import React, { useState, useCallback, useMemo, useEffect } from "react";
55
import _ from "lodash";
66
import MainMenu from "./components/MainMenu";
77
import NavBar from "./components/NavBar";
8-
import SelfServiceNavbar from "./components/SelfService/NavBar";
98
import { navigate, Router, useLocation } from "@reach/router";
109
import { useSelector } from "react-redux";
1110
import useMatchSomeRoute from "./hooks/useMatchSomeRoute";
@@ -56,10 +55,10 @@ const App = () => {
5655
return (
5756
<>
5857
<Router>
59-
<SelfServiceNavbar path="/self-service/*" />
6058
<NavBar
6159
default
6260
noThrow
61+
profileUrl={location.pathname.includes('/self-service') ? '/self-service/profile/' : `/profile/${auth.profile.handle}`}
6362
hideSwitchTools={isNavigationDisabled}
6463
path="/*"
6564
/>

‎src/components/NavBar/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import "./styles.css";
2222
import { useMediaQuery } from "react-responsive";
2323
import NotificationsMenu from "../NotificationsMenu";
2424

25-
const NavBar = ({ hideSwitchTools }) => {
25+
const NavBar = ({ hideSwitchTools, profileUrl }) => {
2626
// all menu options
2727
const menu = useSelector((state) => state.menu.categories);
2828
// flat list of all apps
@@ -96,6 +96,7 @@ const NavBar = ({ hideSwitchTools }) => {
9696
<Fragment>
9797
<NotificationsMenu />
9898
<UserMenu
99+
profileUrl={profileUrl}
99100
profile={auth.profile}
100101
hideSwitchTools={hideSwitchTools}
101102
/>
@@ -121,6 +122,7 @@ const NavBar = ({ hideSwitchTools }) => {
121122
<Fragment>
122123
<NotificationsMenu />
123124
<UserMenu
125+
profileUrl={profileUrl}
124126
profile={auth.profile}
125127
hideSwitchTools={hideSwitchTools}
126128
/>
@@ -140,9 +142,11 @@ const NavBar = ({ hideSwitchTools }) => {
140142

141143
NavBar.defaultProps = {
142144
hideSwitchTools: false,
145+
profileUrl: '/profile/',
143146
};
144147

145148
NavBar.propTypes = {
149+
profileUrl: PropTypes.string,
146150
hideSwitchTools: PropTypes.boolean,
147151
};
148152

‎src/components/SelfService/NavBar/index.jsx

Lines changed: 0 additions & 112 deletions
This file was deleted.

‎src/components/SelfService/NavBar/styles.css

Lines changed: 0 additions & 92 deletions
This file was deleted.

‎src/components/SelfService/NotificationsMenu/index.jsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎src/components/SelfService/NotificationsMenu/styles.module.scss

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎src/components/SelfService/UserMenu/index.jsx

Lines changed: 0 additions & 84 deletions
This file was deleted.

‎src/components/SelfService/UserMenu/styles.module.scss

Lines changed: 0 additions & 108 deletions
This file was deleted.

‎src/components/UserMenu/index.jsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { logout, getLogoutUrl } from "../../utils";
1313
import "./styles.css";
1414
import { useMediaQuery } from "react-responsive";
1515

16-
const UserMenu = ({ profile, hideSwitchTools }) => {
16+
const UserMenu = ({ profile, profileUrl }) => {
1717
const [isOpenMenu, setIsOpenMenu] = useState(false);
1818

1919
const closeMenu = useCallback(() => {
@@ -64,16 +64,14 @@ const UserMenu = ({ profile, hideSwitchTools }) => {
6464
<div className="user-menu-popover-arrow" />
6565
<div className="user-menu-popover-content">
6666
<ul className="user-menu-list">
67-
{hideSwitchTools ? null : (
68-
<li>
69-
<Link
70-
to={`/profile/${profile.handle}`}
71-
onClick={closeMenu}
72-
>
73-
Profile
74-
</Link>
75-
</li>
76-
)}
67+
<li>
68+
<Link
69+
to={`${profileUrl}`}
70+
onClick={closeMenu}
71+
>
72+
Profile
73+
</Link>
74+
</li>
7775
<li>
7876
<a href={getLogoutUrl()} onClick={onLogoutClick}>
7977
Log Out
@@ -90,11 +88,11 @@ const UserMenu = ({ profile, hideSwitchTools }) => {
9088
};
9189

9290
UserMenu.defaultProps = {
93-
hideSwitchTools: false,
91+
profileUrl: '/profile',
9492
};
9593

9694
UserMenu.propTypes = {
97-
hideSwitchTools: PropTypes.boolean,
95+
profileUrl: PropTypes.string,
9896
};
9997

10098
export default UserMenu;

0 commit comments

Comments
 (0)
This repository has been archived.