Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 39b5869

Browse files
make logo clickable and use custom urls for login/signup on self service app
1 parent 248fecf commit 39b5869

File tree

3 files changed

+44
-14
lines changed

3 files changed

+44
-14
lines changed

src/components/NavBar/index.jsx

+34-12
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ import AllAppsMenu from "../AllAppsMenu";
1717
import { useSelector } from "react-redux";
1818
import { Link, useLocation } from "@reach/router";
1919
import TCLogo from "../../assets/images/tc-logo.svg";
20-
import { getLoginUrl } from "../../utils";
20+
import {
21+
getLoginUrl,
22+
getSelfServiceLoginUrl,
23+
getSelfServiceSignupUrl,
24+
} from "../../utils";
25+
import { BUTTON_TYPE } from "constants/";
2126
import "./styles.css";
2227
import { useMediaQuery } from "react-responsive";
2328
import NotificationsMenu from "../NotificationsMenu";
29+
import Button from "../Button";
2430

2531
const NavBar = ({ hideSwitchTools, profileUrl }) => {
32+
const [isSelfService, setIsSelfService] = useState(false);
2633
// all menu options
2734
const menu = useSelector((state) => state.menu.categories);
2835
// flat list of all apps
@@ -36,14 +43,17 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
3643

3744
const routerLocation = useLocation();
3845

39-
const loginUrl = getLoginUrl();
46+
const loginUrl = isSelfService ? getSelfServiceLoginUrl() : getLoginUrl();
47+
const signupUrl = isSelfService ? getSelfServiceSignupUrl() : "";
4048

4149
// Check app title with route activated
4250
useEffect(() => {
4351
const activeApp = apps.find(
4452
(f) => routerLocation.pathname.indexOf(f.path) !== -1
4553
);
4654
setActiveApp(activeApp);
55+
56+
setIsSelfService(routerLocation.pathname.indexOf("/self-service") !== -1);
4757
}, [routerLocation, apps]);
4858

4959
// Change micro-app callback
@@ -54,13 +64,14 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
5464
[setActiveApp]
5565
);
5666

57-
const renderTopcoderLogo = hideSwitchTools ? (
58-
<img src={TCLogo} alt="Topcoder Logo" />
59-
) : (
60-
<Link to="/">
67+
const renderTopcoderLogo =
68+
hideSwitchTools && !isSelfService ? (
6169
<img src={TCLogo} alt="Topcoder Logo" />
62-
</Link>
63-
);
70+
) : (
71+
<Link to={isSelfService ? "/self-service" : "/"}>
72+
<img src={TCLogo} alt="Topcoder Logo" />
73+
</Link>
74+
);
6475

6576
return (
6677
<div className="navbar">
@@ -120,7 +131,7 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
120131
(auth.tokenV3 ? (
121132
auth.profile && (
122133
<Fragment>
123-
<NotificationsMenu />
134+
{!isSelfService && <NotificationsMenu />}
124135
<UserMenu
125136
profileUrl={profileUrl}
126137
profile={auth.profile}
@@ -129,9 +140,20 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
129140
</Fragment>
130141
)
131142
) : (
132-
<a href={loginUrl} className="navbar-login">
133-
Login
134-
</a>
143+
<Fragment>
144+
<a href={loginUrl} className="navbar-login">
145+
Login
146+
</a>
147+
{isSelfService && (
148+
<Button
149+
href={signupUrl}
150+
className="navbar-signup"
151+
type={BUTTON_TYPE.SECONDARY}
152+
>
153+
SIGN UP
154+
</Button>
155+
)}
156+
</Fragment>
135157
))}
136158
</Fragment>
137159
)}

src/components/NavBar/styles.css

+8
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@
5858
text-decoration: none;
5959
text-transform: uppercase;
6060
}
61+
62+
.navbar-right .navbar-signup {
63+
font-size: 14px;
64+
font-weight: bold;
65+
text-decoration: none;
66+
text-transform: uppercase;
67+
margin-left: 16px;
68+
}

src/utils/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const getBusinessLoginUrl = () =>
3535
export const getSelfServiceLoginUrl = () =>
3636
`${config.URL.AUTH}?retUrl=${encodeURIComponent(
3737
`${window.location.origin}/self-service`
38-
)}&regSource=tcBusiness&mode=login`;
38+
)}&regSource=selfService&mode=login`;
3939

4040
/**
4141
* Returns Sign up URL for self service app.
@@ -45,7 +45,7 @@ export const getSelfServiceLoginUrl = () =>
4545
export const getSelfServiceSignupUrl = () =>
4646
`${config.URL.AUTH}?retUrl=${encodeURIComponent(
4747
`${window.location.origin}/self-service`
48-
)}&regSource=tcBusiness&mode=signUp`;
48+
)}&regSource=selfService&mode=signUp`;
4949

5050
/**
5151
* Logout user from Topcoder

0 commit comments

Comments
 (0)