Running custom code inside code editor

I have an custom code component, and side nav bar, which has onMenuSelect will expose some properties like this in my studio host.

In registerComponent -

onMenuSelect: {
  type: "eventHandler",
  argTypes: [
    { name: "label", type: "string" },
    { name: "menuType", type: "string" },
    { name: "closed", type: "boolean" },
  ],
},

In the custom component ,

  <SideNav
    {...props}
    width={props.width || "250px"}
    menus={props.menus}
    activeMenuType={menu.menuType}
    open={menu.open}
    activeMenu={menu.label}
    onMenuSelect={(label: string, menuType: any, closed: any) => {
      setMenu({ label, menuType, open: closed });
      props.onMenuSelect?.(label, menuType, closed);
    }}
  />

My issue : I want to run custom code, saying if the selected menu is dashboard then navigate to dashboard . etc.

I see that in the edit code popup there are options like $ctx , $globalActions , $queries , state , refs ect . But how do i tell plasmic to navigate to a new page ?

I have tried couple of things - $globalActions.navigate , window.location.href (obviously wrong) What is the right way to navigate using run custom code ?

You can generally use window.location.href = "new url here" or window.open("new url here",'_blank') to open a new tab. Are these not working?

In plasmic studio its not working , as my url will be something like -

localhost:3003/projects/f6hcaqoWYg6KKZeonD3PrU/-/Custom-arena-1?arena_type=custom&arena=Custom%20arena%201

So if i do window.location.href , i get. a page not found kinda error on my studio workspace/i-frame