@@ -30,6 +30,11 @@ import UniNavSnippet from './universal-nav-snippet'
3030declare let tcUniNav : any
3131UniNavSnippet ( EnvironmentConfig . UNIVERSAL_NAV . URL )
3232
33+ interface NavigationRequest {
34+ label : string
35+ path : string
36+ }
37+
3338const Header : FC = ( ) => {
3439
3540 const { activeToolName, activeToolRoute } : RouteContextData = useContext ( routeContext )
@@ -39,16 +44,12 @@ const Header: FC = () => {
3944 const navElementId : string = 'main-nav-el'
4045 const navigate : NavigateFunction = useNavigate ( )
4146
42- console . debug ( 'active route' , activeToolRoute )
43-
44- const navigationHandler : ( label : string , path : string ) => void
45- = useCallback ( ( label : string , path : string ) => {
46-
47- console . debug ( path )
47+ const navigationHandler : ( request : NavigationRequest ) => void
48+ = useCallback ( ( request : NavigationRequest ) => {
4849
4950 try {
5051 // strip the domain and navigate to the path
51- navigate ( new URL ( path ) . pathname )
52+ navigate ( new URL ( request . path ) . pathname )
5253 } catch ( error ) {
5354 // if we couldn't navigate to the path, just go to the route of the currently active tool
5455 navigate ( new URL ( activeToolRoute || '/' ) . pathname )
@@ -71,7 +72,7 @@ const Header: FC = () => {
7172 'init' ,
7273 navElementId ,
7374 {
74- navigationHandler,
75+ handleNavigation : navigationHandler ,
7576 onReady ( ) {
7677 setReady ( true )
7778 document . getElementById ( 'root' ) ?. classList . add ( 'app-ready' )
@@ -80,7 +81,7 @@ const Header: FC = () => {
8081 signOut ( ) { window . location . href = authUrlLogout } ,
8182 signUp ( ) { window . location . href = authUrlSignup ( ) } ,
8283 toolName : activeToolName ,
83- toolRoute : activeToolRoute ,
84+ toolRoot : activeToolRoute ,
8485 type : 'tool' ,
8586 user : profile ? {
8687 handle : profile . handle ,
0 commit comments