feat(app): simplify navigation routes
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m37s
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m37s
This commit is contained in:
parent
048855049d
commit
18cbf5c0a3
@ -16,17 +16,12 @@ import { Route as rootRoute } from './routes/__root'
|
|||||||
|
|
||||||
// Create Virtual Routes
|
// Create Virtual Routes
|
||||||
|
|
||||||
const AboutLazyImport = createFileRoute('/about')()
|
|
||||||
const IndexLazyImport = createFileRoute('/')()
|
const IndexLazyImport = createFileRoute('/')()
|
||||||
const UserIndexLazyImport = createFileRoute('/user/')()
|
const UserIndexLazyImport = createFileRoute('/user/')()
|
||||||
|
const ChangelogIndexLazyImport = createFileRoute('/changelog/')()
|
||||||
|
|
||||||
// Create/Update Routes
|
// Create/Update Routes
|
||||||
|
|
||||||
const AboutLazyRoute = AboutLazyImport.update({
|
|
||||||
path: '/about',
|
|
||||||
getParentRoute: () => rootRoute,
|
|
||||||
} as any).lazy(() => import('./routes/about.lazy').then((d) => d.Route))
|
|
||||||
|
|
||||||
const IndexLazyRoute = IndexLazyImport.update({
|
const IndexLazyRoute = IndexLazyImport.update({
|
||||||
path: '/',
|
path: '/',
|
||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
@ -37,6 +32,13 @@ const UserIndexLazyRoute = UserIndexLazyImport.update({
|
|||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any).lazy(() => import('./routes/user/index.lazy').then((d) => d.Route))
|
} as any).lazy(() => import('./routes/user/index.lazy').then((d) => d.Route))
|
||||||
|
|
||||||
|
const ChangelogIndexLazyRoute = ChangelogIndexLazyImport.update({
|
||||||
|
path: '/changelog/',
|
||||||
|
getParentRoute: () => rootRoute,
|
||||||
|
} as any).lazy(() =>
|
||||||
|
import('./routes/changelog/index.lazy').then((d) => d.Route),
|
||||||
|
)
|
||||||
|
|
||||||
// Populate the FileRoutesByPath interface
|
// Populate the FileRoutesByPath interface
|
||||||
|
|
||||||
declare module '@tanstack/react-router' {
|
declare module '@tanstack/react-router' {
|
||||||
@ -48,11 +50,11 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof IndexLazyImport
|
preLoaderRoute: typeof IndexLazyImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
'/about': {
|
'/changelog/': {
|
||||||
id: '/about'
|
id: '/changelog/'
|
||||||
path: '/about'
|
path: '/changelog'
|
||||||
fullPath: '/about'
|
fullPath: '/changelog'
|
||||||
preLoaderRoute: typeof AboutLazyImport
|
preLoaderRoute: typeof ChangelogIndexLazyImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
'/user/': {
|
'/user/': {
|
||||||
@ -69,41 +71,41 @@ declare module '@tanstack/react-router' {
|
|||||||
|
|
||||||
export interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexLazyRoute
|
'/': typeof IndexLazyRoute
|
||||||
'/about': typeof AboutLazyRoute
|
'/changelog': typeof ChangelogIndexLazyRoute
|
||||||
'/user': typeof UserIndexLazyRoute
|
'/user': typeof UserIndexLazyRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexLazyRoute
|
'/': typeof IndexLazyRoute
|
||||||
'/about': typeof AboutLazyRoute
|
'/changelog': typeof ChangelogIndexLazyRoute
|
||||||
'/user': typeof UserIndexLazyRoute
|
'/user': typeof UserIndexLazyRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRoutesById {
|
export interface FileRoutesById {
|
||||||
__root__: typeof rootRoute
|
__root__: typeof rootRoute
|
||||||
'/': typeof IndexLazyRoute
|
'/': typeof IndexLazyRoute
|
||||||
'/about': typeof AboutLazyRoute
|
'/changelog/': typeof ChangelogIndexLazyRoute
|
||||||
'/user/': typeof UserIndexLazyRoute
|
'/user/': typeof UserIndexLazyRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths: '/' | '/about' | '/user'
|
fullPaths: '/' | '/changelog' | '/user'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to: '/' | '/about' | '/user'
|
to: '/' | '/changelog' | '/user'
|
||||||
id: '__root__' | '/' | '/about' | '/user/'
|
id: '__root__' | '/' | '/changelog/' | '/user/'
|
||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexLazyRoute: typeof IndexLazyRoute
|
IndexLazyRoute: typeof IndexLazyRoute
|
||||||
AboutLazyRoute: typeof AboutLazyRoute
|
ChangelogIndexLazyRoute: typeof ChangelogIndexLazyRoute
|
||||||
UserIndexLazyRoute: typeof UserIndexLazyRoute
|
UserIndexLazyRoute: typeof UserIndexLazyRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootRouteChildren: RootRouteChildren = {
|
const rootRouteChildren: RootRouteChildren = {
|
||||||
IndexLazyRoute: IndexLazyRoute,
|
IndexLazyRoute: IndexLazyRoute,
|
||||||
AboutLazyRoute: AboutLazyRoute,
|
ChangelogIndexLazyRoute: ChangelogIndexLazyRoute,
|
||||||
UserIndexLazyRoute: UserIndexLazyRoute,
|
UserIndexLazyRoute: UserIndexLazyRoute,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,15 +122,15 @@ export const routeTree = rootRoute
|
|||||||
"filePath": "__root.tsx",
|
"filePath": "__root.tsx",
|
||||||
"children": [
|
"children": [
|
||||||
"/",
|
"/",
|
||||||
"/about",
|
"/changelog/",
|
||||||
"/user/"
|
"/user/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/": {
|
"/": {
|
||||||
"filePath": "index.lazy.tsx"
|
"filePath": "index.lazy.tsx"
|
||||||
},
|
},
|
||||||
"/about": {
|
"/changelog/": {
|
||||||
"filePath": "about.lazy.tsx"
|
"filePath": "changelog/index.lazy.tsx"
|
||||||
},
|
},
|
||||||
"/user/": {
|
"/user/": {
|
||||||
"filePath": "user/index.lazy.tsx"
|
"filePath": "user/index.lazy.tsx"
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import { createLazyFileRoute } from '@tanstack/react-router'
|
|
||||||
|
|
||||||
export const Route = createLazyFileRoute('/about')({
|
|
||||||
component: About,
|
|
||||||
})
|
|
||||||
|
|
||||||
function About() {
|
|
||||||
return <div className="p-2">Hello from About!</div>
|
|
||||||
}
|
|
5
apps/app/src/routes/changelog/index.lazy.tsx
Normal file
5
apps/app/src/routes/changelog/index.lazy.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { createLazyFileRoute } from '@tanstack/react-router'
|
||||||
|
|
||||||
|
export const Route = createLazyFileRoute('/changelog/')({
|
||||||
|
component: () => <div>Hello /changelog/!</div>,
|
||||||
|
})
|
@ -1,5 +1,5 @@
|
|||||||
import type { ReactNode } from '@tanstack/react-router'
|
import type { ReactNode } from '@tanstack/react-router'
|
||||||
import { FileStackIcon, HouseIcon, LayoutDashboardIcon } from 'lucide-react'
|
import { FileStackIcon, LayoutDashboardIcon } from 'lucide-react'
|
||||||
|
|
||||||
type Route = {
|
type Route = {
|
||||||
name: string
|
name: string
|
||||||
@ -16,17 +16,7 @@ export const NavigationRoutes: Route[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Changelog',
|
name: 'Changelog',
|
||||||
childrens: [
|
to: '/changelog',
|
||||||
{
|
icon: FileStackIcon,
|
||||||
name: 'Overview',
|
|
||||||
to: '/changelog',
|
|
||||||
icon: HouseIcon,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Versions',
|
|
||||||
to: '/changelog/version',
|
|
||||||
icon: FileStackIcon,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user