-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start using Tanstack Router for future pages (Games & AI)
- Loading branch information
1 parent
86f3c45
commit 914f095
Showing
8 changed files
with
805 additions
and
166 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,10 +1,27 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App.tsx' | ||
import { RouterProvider, createRouter } from '@tanstack/react-router' | ||
import './index.css' | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) | ||
// Import the generated route tree | ||
import { routeTree } from './routeTree.gen' | ||
|
||
// Create a new router instance | ||
const router = createRouter({ routeTree }) | ||
|
||
// Register the router instance for type safety | ||
declare module '@tanstack/react-router' { | ||
interface Register { | ||
router: typeof router | ||
} | ||
} | ||
|
||
const rootElement = document.getElementById('root')! | ||
if (!rootElement.innerHTML) { | ||
const root = createRoot(rootElement) | ||
root.render( | ||
<StrictMode> | ||
<RouterProvider router={router} /> | ||
</StrictMode>, | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* eslint-disable */ | ||
|
||
// @ts-nocheck | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
|
||
// This file was automatically generated by TanStack Router. | ||
// You should NOT make any changes in this file as it will be overwritten. | ||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. | ||
|
||
import { createFileRoute } from '@tanstack/react-router' | ||
|
||
// Import Routes | ||
|
||
import { Route as rootRoute } from './routes/__root' | ||
|
||
// Create Virtual Routes | ||
|
||
const IndexLazyImport = createFileRoute('/')() | ||
|
||
// Create/Update Routes | ||
|
||
const IndexLazyRoute = IndexLazyImport.update({ | ||
id: '/', | ||
path: '/', | ||
getParentRoute: () => rootRoute, | ||
} as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route)) | ||
|
||
// Populate the FileRoutesByPath interface | ||
|
||
declare module '@tanstack/react-router' { | ||
interface FileRoutesByPath { | ||
'/': { | ||
id: '/' | ||
path: '/' | ||
fullPath: '/' | ||
preLoaderRoute: typeof IndexLazyImport | ||
parentRoute: typeof rootRoute | ||
} | ||
} | ||
} | ||
|
||
// Create and export the route tree | ||
|
||
export interface FileRoutesByFullPath { | ||
'/': typeof IndexLazyRoute | ||
} | ||
|
||
export interface FileRoutesByTo { | ||
'/': typeof IndexLazyRoute | ||
} | ||
|
||
export interface FileRoutesById { | ||
__root__: typeof rootRoute | ||
'/': typeof IndexLazyRoute | ||
} | ||
|
||
export interface FileRouteTypes { | ||
fileRoutesByFullPath: FileRoutesByFullPath | ||
fullPaths: '/' | ||
fileRoutesByTo: FileRoutesByTo | ||
to: '/' | ||
id: '__root__' | '/' | ||
fileRoutesById: FileRoutesById | ||
} | ||
|
||
export interface RootRouteChildren { | ||
IndexLazyRoute: typeof IndexLazyRoute | ||
} | ||
|
||
const rootRouteChildren: RootRouteChildren = { | ||
IndexLazyRoute: IndexLazyRoute, | ||
} | ||
|
||
export const routeTree = rootRoute | ||
._addFileChildren(rootRouteChildren) | ||
._addFileTypes<FileRouteTypes>() | ||
|
||
/* ROUTE_MANIFEST_START | ||
{ | ||
"routes": { | ||
"__root__": { | ||
"filePath": "__root.tsx", | ||
"children": [ | ||
"/" | ||
] | ||
}, | ||
"/": { | ||
"filePath": "index.lazy.tsx" | ||
} | ||
} | ||
} | ||
ROUTE_MANIFEST_END */ |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createRootRoute, Outlet } from '@tanstack/react-router' | ||
import { TanStackRouterDevtools } from '@tanstack/router-devtools' | ||
|
||
export const Route = createRootRoute({ | ||
component: () => ( | ||
<> | ||
{/* <div className="p-2 flex gap-2"> | ||
<Link to="/" className="[&.active]:font-bold"> | ||
Home | ||
</Link>{' '} | ||
<Link to="/about" className="[&.active]:font-bold"> | ||
About | ||
</Link> | ||
</div> | ||
<hr /> */} | ||
<Outlet /> | ||
<TanStackRouterDevtools /> | ||
</> | ||
), | ||
}) |
Oops, something went wrong.