Update routing for admin channels and shows: add index routes for channels and shows, refactor components to use Outlet for nested routing, and enhance type definitions for new routes in the routing structure.

This commit is contained in:
Leonid Pershin
2026-07-24 19:08:17 +03:00
parent b7cdc4ad96
commit 8281832e1d
5 changed files with 56 additions and 10 deletions
+42 -4
View File
@@ -21,7 +21,9 @@ import { Route as AdminMediaRouteImport } from './routes/admin/media'
import { Route as AdminRolesRouteImport } from './routes/admin/roles'
import { Route as AdminShowsRouteImport } from './routes/admin/shows'
import { Route as AdminUsersRouteImport } from './routes/admin/users'
import { Route as AdminChannelsIndexRouteImport } from './routes/admin/channels.index'
import { Route as AdminChannelsChannelIdRouteImport } from './routes/admin/channels.$channelId'
import { Route as AdminShowsIndexRouteImport } from './routes/admin/shows.index'
import { Route as AdminShowsShowIdRouteImport } from './routes/admin/shows.$showId'
const IndexRoute = IndexRouteImport.update({
@@ -84,11 +86,21 @@ const AdminUsersRoute = AdminUsersRouteImport.update({
path: '/users',
getParentRoute: () => AdminRoute,
} as any)
const AdminChannelsIndexRoute = AdminChannelsIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => AdminChannelsRoute,
} as any)
const AdminChannelsChannelIdRoute = AdminChannelsChannelIdRouteImport.update({
id: '/$channelId',
path: '/$channelId',
getParentRoute: () => AdminChannelsRoute,
} as any)
const AdminShowsIndexRoute = AdminShowsIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => AdminShowsRoute,
} as any)
const AdminShowsShowIdRoute = AdminShowsShowIdRouteImport.update({
id: '/$showId',
path: '/$showId',
@@ -110,6 +122,8 @@ export interface FileRoutesByFullPath {
'/admin/': typeof AdminIndexRoute
'/admin/channels/$channelId': typeof AdminChannelsChannelIdRoute
'/admin/shows/$showId': typeof AdminShowsShowIdRoute
'/admin/channels/': typeof AdminChannelsIndexRoute
'/admin/shows/': typeof AdminShowsIndexRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
@@ -117,14 +131,14 @@ export interface FileRoutesByTo {
'/login': typeof LoginRoute
'/register': typeof RegisterRoute
'/settings': typeof SettingsRoute
'/admin/channels': typeof AdminChannelsRouteWithChildren
'/admin/media': typeof AdminMediaRoute
'/admin/roles': typeof AdminRolesRoute
'/admin/shows': typeof AdminShowsRouteWithChildren
'/admin/users': typeof AdminUsersRoute
'/admin': typeof AdminIndexRoute
'/admin/channels/$channelId': typeof AdminChannelsChannelIdRoute
'/admin/shows/$showId': typeof AdminShowsShowIdRoute
'/admin/channels': typeof AdminChannelsIndexRoute
'/admin/shows': typeof AdminShowsIndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
@@ -142,6 +156,8 @@ export interface FileRoutesById {
'/admin/': typeof AdminIndexRoute
'/admin/channels/$channelId': typeof AdminChannelsChannelIdRoute
'/admin/shows/$showId': typeof AdminShowsShowIdRoute
'/admin/channels/': typeof AdminChannelsIndexRoute
'/admin/shows/': typeof AdminShowsIndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
@@ -160,6 +176,8 @@ export interface FileRouteTypes {
| '/admin/'
| '/admin/channels/$channelId'
| '/admin/shows/$showId'
| '/admin/channels/'
| '/admin/shows/'
fileRoutesByTo: FileRoutesByTo
to:
| '/'
@@ -167,14 +185,14 @@ export interface FileRouteTypes {
| '/login'
| '/register'
| '/settings'
| '/admin/channels'
| '/admin/media'
| '/admin/roles'
| '/admin/shows'
| '/admin/users'
| '/admin'
| '/admin/channels/$channelId'
| '/admin/shows/$showId'
| '/admin/channels'
| '/admin/shows'
id:
| '__root__'
| '/'
@@ -191,6 +209,8 @@ export interface FileRouteTypes {
| '/admin/'
| '/admin/channels/$channelId'
| '/admin/shows/$showId'
| '/admin/channels/'
| '/admin/shows/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -288,6 +308,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AdminUsersRouteImport
parentRoute: typeof AdminRoute
}
'/admin/channels/': {
id: '/admin/channels/'
path: '/'
fullPath: '/admin/channels/'
preLoaderRoute: typeof AdminChannelsIndexRouteImport
parentRoute: typeof AdminChannelsRoute
}
'/admin/channels/$channelId': {
id: '/admin/channels/$channelId'
path: '/$channelId'
@@ -295,6 +322,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AdminChannelsChannelIdRouteImport
parentRoute: typeof AdminChannelsRoute
}
'/admin/shows/': {
id: '/admin/shows/'
path: '/'
fullPath: '/admin/shows/'
preLoaderRoute: typeof AdminShowsIndexRouteImport
parentRoute: typeof AdminShowsRoute
}
'/admin/shows/$showId': {
id: '/admin/shows/$showId'
path: '/$showId'
@@ -307,10 +341,12 @@ declare module '@tanstack/react-router' {
interface AdminChannelsRouteChildren {
AdminChannelsChannelIdRoute: typeof AdminChannelsChannelIdRoute
AdminChannelsIndexRoute: typeof AdminChannelsIndexRoute
}
const AdminChannelsRouteChildren: AdminChannelsRouteChildren = {
AdminChannelsChannelIdRoute: AdminChannelsChannelIdRoute,
AdminChannelsIndexRoute: AdminChannelsIndexRoute,
}
const AdminChannelsRouteWithChildren = AdminChannelsRoute._addFileChildren(
@@ -319,10 +355,12 @@ const AdminChannelsRouteWithChildren = AdminChannelsRoute._addFileChildren(
interface AdminShowsRouteChildren {
AdminShowsShowIdRoute: typeof AdminShowsShowIdRoute
AdminShowsIndexRoute: typeof AdminShowsIndexRoute
}
const AdminShowsRouteChildren: AdminShowsRouteChildren = {
AdminShowsShowIdRoute: AdminShowsShowIdRoute,
AdminShowsIndexRoute: AdminShowsIndexRoute,
}
const AdminShowsRouteWithChildren = AdminShowsRoute._addFileChildren(
@@ -0,0 +1,4 @@
import { createFileRoute } from '@tanstack/react-router'
import { ChannelsPanel } from '@/features/admin/channels/ChannelsPanel'
export const Route = createFileRoute('/admin/channels/')({ component: ChannelsPanel })
+3 -3
View File
@@ -1,4 +1,4 @@
import { createFileRoute } from '@tanstack/react-router'
import { ChannelsPanel } from '@/features/admin/channels/ChannelsPanel'
import { createFileRoute, Outlet } from '@tanstack/react-router'
export const Route = createFileRoute('/admin/channels')({ component: ChannelsPanel })
// Лейаут для /admin/channels/*: список — в index-роуте, деталь — в channels.$channelId.
export const Route = createFileRoute('/admin/channels')({ component: () => <Outlet /> })
@@ -0,0 +1,4 @@
import { createFileRoute } from '@tanstack/react-router'
import { ShowsPanel } from '@/features/admin/shows/ShowsPanel'
export const Route = createFileRoute('/admin/shows/')({ component: ShowsPanel })
+3 -3
View File
@@ -1,4 +1,4 @@
import { createFileRoute } from '@tanstack/react-router'
import { ShowsPanel } from '@/features/admin/shows/ShowsPanel'
import { createFileRoute, Outlet } from '@tanstack/react-router'
export const Route = createFileRoute('/admin/shows')({ component: ShowsPanel })
// Лейаут для /admin/shows/*: список — в index-роуте, деталь — в shows.$showId.
export const Route = createFileRoute('/admin/shows')({ component: () => <Outlet /> })