@@ -17,12 +17,19 @@ import AllAppsMenu from "../AllAppsMenu";
17
17
import { useSelector } from "react-redux" ;
18
18
import { Link , useLocation } from "@reach/router" ;
19
19
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/" ;
21
26
import "./styles.css" ;
22
27
import { useMediaQuery } from "react-responsive" ;
23
28
import NotificationsMenu from "../NotificationsMenu" ;
29
+ import Button from "../Button" ;
24
30
25
31
const NavBar = ( { hideSwitchTools, profileUrl } ) => {
32
+ const [ isSelfService , setIsSelfService ] = useState ( false ) ;
26
33
// all menu options
27
34
const menu = useSelector ( ( state ) => state . menu . categories ) ;
28
35
// flat list of all apps
@@ -36,14 +43,17 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
36
43
37
44
const routerLocation = useLocation ( ) ;
38
45
39
- const loginUrl = getLoginUrl ( ) ;
46
+ const loginUrl = isSelfService ? getSelfServiceLoginUrl ( ) : getLoginUrl ( ) ;
47
+ const signupUrl = isSelfService ? getSelfServiceSignupUrl ( ) : "" ;
40
48
41
49
// Check app title with route activated
42
50
useEffect ( ( ) => {
43
51
const activeApp = apps . find (
44
52
( f ) => routerLocation . pathname . indexOf ( f . path ) !== - 1
45
53
) ;
46
54
setActiveApp ( activeApp ) ;
55
+
56
+ setIsSelfService ( routerLocation . pathname . indexOf ( "/self-service" ) !== - 1 ) ;
47
57
} , [ routerLocation , apps ] ) ;
48
58
49
59
// Change micro-app callback
@@ -54,13 +64,14 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
54
64
[ setActiveApp ]
55
65
) ;
56
66
57
- const renderTopcoderLogo = hideSwitchTools ? (
58
- < img src = { TCLogo } alt = "Topcoder Logo" />
59
- ) : (
60
- < Link to = "/" >
67
+ const renderTopcoderLogo =
68
+ hideSwitchTools && ! isSelfService ? (
61
69
< 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
+ ) ;
64
75
65
76
return (
66
77
< div className = "navbar" >
@@ -120,7 +131,7 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
120
131
( auth . tokenV3 ? (
121
132
auth . profile && (
122
133
< Fragment >
123
- < NotificationsMenu />
134
+ { ! isSelfService && < NotificationsMenu /> }
124
135
< UserMenu
125
136
profileUrl = { profileUrl }
126
137
profile = { auth . profile }
@@ -129,9 +140,20 @@ const NavBar = ({ hideSwitchTools, profileUrl }) => {
129
140
</ Fragment >
130
141
)
131
142
) : (
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 >
135
157
) ) }
136
158
</ Fragment >
137
159
) }
0 commit comments