-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(topbar): update router config * chore(topbar): fix deprecated icons
- Loading branch information
1 parent
d8fba18
commit 2405f1c
Showing
3 changed files
with
21 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 15 additions & 11 deletions
26
extensions/widgets/top-bar/src/components/widget-routes/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import React from 'react'; | ||
import { rootRouteWithContext, Router } from '@tanstack/react-router'; | ||
import { createRootRoute, createRoute, createRouter, Outlet } from '@tanstack/react-router'; | ||
import RootComponent from './root-component'; | ||
import ErrorComponent from './error-component'; | ||
|
||
const rootRoute = rootRouteWithContext()({ | ||
const rootRoute = createRootRoute({ | ||
component: Outlet, | ||
}); | ||
|
||
const defaultRoute = createRoute({ | ||
getParentRoute: () => rootRoute, | ||
path: '/$', | ||
component: RootComponent, | ||
}); | ||
|
||
const routeTree = rootRoute; | ||
const routeTree = rootRoute.addChildren([defaultRoute]); | ||
|
||
export const createRouter = () => | ||
new Router({ | ||
routeTree, | ||
basepath: '', | ||
defaultErrorComponent: ({ error }) => ( | ||
<ErrorComponent error={(error as unknown as Error).message} /> | ||
), | ||
}); | ||
export const router = createRouter({ | ||
routeTree, | ||
defaultErrorComponent: ({ error }) => ( | ||
<ErrorComponent error={(error as unknown as Error).message} /> | ||
), | ||
}); |