feat(web): 按原型调整响应式研究工作台
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { createRootRoute, createRoute, Outlet } from "@tanstack/react-router"
|
||||
|
||||
import { AppLayout } from "@/app/layout/app-layout"
|
||||
import { HomePage } from "@/features/home/pages/home-page"
|
||||
import { SelectionResultsPage } from "@/features/selection/pages/selection-results-page"
|
||||
|
||||
@@ -7,16 +8,32 @@ const rootRoute = createRootRoute({
|
||||
component: () => <Outlet />,
|
||||
})
|
||||
|
||||
const indexRoute = createRoute({
|
||||
const workspaceRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
id: "_workspace",
|
||||
component: AppLayout,
|
||||
})
|
||||
|
||||
const indexRoute = createRoute({
|
||||
getParentRoute: () => workspaceRoute,
|
||||
path: "/",
|
||||
component: HomePage,
|
||||
})
|
||||
|
||||
const selectionRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
getParentRoute: () => workspaceRoute,
|
||||
path: "/selection",
|
||||
validateSearch: (search: Record<string, unknown>) => {
|
||||
const rawPage = Number(search.page)
|
||||
const rawPageSize = Number(search.pageSize)
|
||||
const page =
|
||||
Number.isFinite(rawPage) && rawPage >= 1 ? Math.floor(rawPage) : 1
|
||||
const pageSize = [5, 10, 20].includes(rawPageSize) ? rawPageSize : 10
|
||||
return { page, pageSize }
|
||||
},
|
||||
component: SelectionResultsPage,
|
||||
})
|
||||
|
||||
export const routeTree = rootRoute.addChildren([indexRoute, selectionRoute])
|
||||
export const routeTree = rootRoute.addChildren([
|
||||
workspaceRoute.addChildren([indexRoute, selectionRoute]),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user