File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,10 @@ function App() {
41
41
</ ProfileContextProvider >
42
42
}
43
43
/>
44
- < Route path = "match " element = { < ProtectedRoutes /> } >
44
+ < Route path = "matching " element = { < ProtectedRoutes /> } >
45
45
< Route index element = { < Matching /> } />
46
+ < Route path = "matched" element = { < div > Matched</ div > } />
47
+ < Route path = "timeout" element = { < div > Timeout</ div > } />
46
48
</ Route >
47
49
< Route path = "*" element = { < PageNotFound /> } />
48
50
</ Route >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { useNavigate, useLocation } from "react-router-dom";
18
18
import { useAuth } from "../../contexts/AuthContext" ;
19
19
import { useState } from "react" ;
20
20
import { USE_AUTH_ERROR_MESSAGE } from "../../utils/constants" ;
21
+ import { isMatchingPage } from "../../utils/url" ;
21
22
22
23
type NavbarItem = { label : string ; link : string ; needsLogin : boolean } ;
23
24
@@ -35,8 +36,6 @@ const Navbar: React.FC<NavbarProps> = (props) => {
35
36
const location = useLocation ( ) ;
36
37
const path = location . pathname ;
37
38
38
- console . log ( path ) ;
39
-
40
39
const auth = useAuth ( ) ;
41
40
const [ anchorEl , setAnchorEl ] = useState < HTMLElement | null > ( null ) ;
42
41
@@ -73,7 +72,7 @@ const Navbar: React.FC<NavbarProps> = (props) => {
73
72
>
74
73
PeerPrep
75
74
</ Typography >
76
- { path !== "/match" ? (
75
+ { ! isMatchingPage ( path ) ? (
77
76
< Stack direction = { "row" } alignItems = { "center" } spacing = { 2 } >
78
77
{ navbarItems
79
78
. filter ( ( item ) => ! item . needsLogin || ( item . needsLogin && user ) )
Original file line number Diff line number Diff line change
1
+ export const isMatchingPage = ( path : string ) => {
2
+ const pattern = / ^ (?< prefix > \/ m a t c h i n g ) (?< ignore > \/ .* ) * $ / ;
3
+ return pattern . test ( path ) ;
4
+ } ;
You can’t perform that action at this time.
0 commit comments