init matches, tournament runner
This commit is contained in:
@@ -25,6 +25,7 @@ import { Route as AuthedProfilePlayerIdRouteImport } from './routes/_authed/prof
|
||||
import { Route as AuthedAdminPreviewRouteImport } from './routes/_authed/admin/preview'
|
||||
import { Route as AuthedAdminTournamentsIndexRouteImport } from './routes/_authed/admin/tournaments/index'
|
||||
import { Route as AuthedAdminTournamentsIdRouteImport } from './routes/_authed/admin/tournaments/$id'
|
||||
import { Route as AuthedAdminTournamentsRunIdRouteImport } from './routes/_authed/admin/tournaments/run.$id'
|
||||
import { ServerRoute as ApiTournamentsUploadLogoServerRouteImport } from './routes/api/tournaments/upload-logo'
|
||||
import { ServerRoute as ApiEventsSplatServerRouteImport } from './routes/api/events.$'
|
||||
import { ServerRoute as ApiAuthSplatServerRouteImport } from './routes/api/auth.$'
|
||||
@@ -104,6 +105,12 @@ const AuthedAdminTournamentsIdRoute =
|
||||
path: '/tournaments/$id',
|
||||
getParentRoute: () => AuthedAdminRoute,
|
||||
} as any)
|
||||
const AuthedAdminTournamentsRunIdRoute =
|
||||
AuthedAdminTournamentsRunIdRouteImport.update({
|
||||
id: '/tournaments/run/$id',
|
||||
path: '/tournaments/run/$id',
|
||||
getParentRoute: () => AuthedAdminRoute,
|
||||
} as any)
|
||||
const ApiTournamentsUploadLogoServerRoute =
|
||||
ApiTournamentsUploadLogoServerRouteImport.update({
|
||||
id: '/api/tournaments/upload-logo',
|
||||
@@ -141,6 +148,7 @@ export interface FileRoutesByFullPath {
|
||||
'/tournaments': typeof AuthedTournamentsIndexRoute
|
||||
'/admin/tournaments/$id': typeof AuthedAdminTournamentsIdRoute
|
||||
'/admin/tournaments': typeof AuthedAdminTournamentsIndexRoute
|
||||
'/admin/tournaments/run/$id': typeof AuthedAdminTournamentsRunIdRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/login': typeof LoginRoute
|
||||
@@ -155,6 +163,7 @@ export interface FileRoutesByTo {
|
||||
'/tournaments': typeof AuthedTournamentsIndexRoute
|
||||
'/admin/tournaments/$id': typeof AuthedAdminTournamentsIdRoute
|
||||
'/admin/tournaments': typeof AuthedAdminTournamentsIndexRoute
|
||||
'/admin/tournaments/run/$id': typeof AuthedAdminTournamentsRunIdRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
@@ -172,6 +181,7 @@ export interface FileRoutesById {
|
||||
'/_authed/tournaments/': typeof AuthedTournamentsIndexRoute
|
||||
'/_authed/admin/tournaments/$id': typeof AuthedAdminTournamentsIdRoute
|
||||
'/_authed/admin/tournaments/': typeof AuthedAdminTournamentsIndexRoute
|
||||
'/_authed/admin/tournaments/run/$id': typeof AuthedAdminTournamentsRunIdRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
@@ -189,6 +199,7 @@ export interface FileRouteTypes {
|
||||
| '/tournaments'
|
||||
| '/admin/tournaments/$id'
|
||||
| '/admin/tournaments'
|
||||
| '/admin/tournaments/run/$id'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/login'
|
||||
@@ -203,6 +214,7 @@ export interface FileRouteTypes {
|
||||
| '/tournaments'
|
||||
| '/admin/tournaments/$id'
|
||||
| '/admin/tournaments'
|
||||
| '/admin/tournaments/run/$id'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/_authed'
|
||||
@@ -219,6 +231,7 @@ export interface FileRouteTypes {
|
||||
| '/_authed/tournaments/'
|
||||
| '/_authed/admin/tournaments/$id'
|
||||
| '/_authed/admin/tournaments/'
|
||||
| '/_authed/admin/tournaments/run/$id'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -373,6 +386,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof AuthedAdminTournamentsIdRouteImport
|
||||
parentRoute: typeof AuthedAdminRoute
|
||||
}
|
||||
'/_authed/admin/tournaments/run/$id': {
|
||||
id: '/_authed/admin/tournaments/run/$id'
|
||||
path: '/tournaments/run/$id'
|
||||
fullPath: '/admin/tournaments/run/$id'
|
||||
preLoaderRoute: typeof AuthedAdminTournamentsRunIdRouteImport
|
||||
parentRoute: typeof AuthedAdminRoute
|
||||
}
|
||||
}
|
||||
}
|
||||
declare module '@tanstack/react-start/server' {
|
||||
@@ -413,6 +433,7 @@ interface AuthedAdminRouteChildren {
|
||||
AuthedAdminIndexRoute: typeof AuthedAdminIndexRoute
|
||||
AuthedAdminTournamentsIdRoute: typeof AuthedAdminTournamentsIdRoute
|
||||
AuthedAdminTournamentsIndexRoute: typeof AuthedAdminTournamentsIndexRoute
|
||||
AuthedAdminTournamentsRunIdRoute: typeof AuthedAdminTournamentsRunIdRoute
|
||||
}
|
||||
|
||||
const AuthedAdminRouteChildren: AuthedAdminRouteChildren = {
|
||||
@@ -420,6 +441,7 @@ const AuthedAdminRouteChildren: AuthedAdminRouteChildren = {
|
||||
AuthedAdminIndexRoute: AuthedAdminIndexRoute,
|
||||
AuthedAdminTournamentsIdRoute: AuthedAdminTournamentsIdRoute,
|
||||
AuthedAdminTournamentsIndexRoute: AuthedAdminTournamentsIndexRoute,
|
||||
AuthedAdminTournamentsRunIdRoute: AuthedAdminTournamentsRunIdRoute,
|
||||
}
|
||||
|
||||
const AuthedAdminRouteWithChildren = AuthedAdminRoute._addFileChildren(
|
||||
|
||||
@@ -27,6 +27,7 @@ export function createRouter() {
|
||||
header: defaultHeaderConfig,
|
||||
refresh: [],
|
||||
withPadding: true,
|
||||
fullWidth: false,
|
||||
},
|
||||
defaultPreload: "intent",
|
||||
defaultErrorComponent: DefaultCatchBoundary,
|
||||
|
||||
@@ -26,6 +26,7 @@ export const Route = createRootRouteWithContext<{
|
||||
header: HeaderConfig;
|
||||
refresh: string[];
|
||||
withPadding: boolean;
|
||||
fullWidth: boolean;
|
||||
}>()({
|
||||
head: () => ({
|
||||
meta: [
|
||||
|
||||
31
src/app/routes/_authed/admin/tournaments/run.$id.tsx
Normal file
31
src/app/routes/_authed/admin/tournaments/run.$id.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router'
|
||||
import { tournamentQueries } from '@/features/tournaments/queries'
|
||||
import { ensureServerQueryData } from '@/lib/tanstack-query/utils/ensure'
|
||||
import RunTournament from '@/features/tournaments/components/run-tournament'
|
||||
|
||||
export const Route = createFileRoute('/_authed/admin/tournaments/run/$id')({
|
||||
beforeLoad: async ({ context, params }) => {
|
||||
const { queryClient } = context
|
||||
const tournament = await ensureServerQueryData(
|
||||
queryClient,
|
||||
tournamentQueries.details(params.id)
|
||||
)
|
||||
if (!tournament) throw redirect({ to: '/admin/tournaments' })
|
||||
return {
|
||||
tournament,
|
||||
}
|
||||
},
|
||||
loader: ({ context }) => ({
|
||||
fullWidth: true,
|
||||
header: {
|
||||
withBackButton: true,
|
||||
title: `Run ${context.tournament.name}`,
|
||||
},
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
const { id } = Route.useParams()
|
||||
return <RunTournament tournamentId={id} />
|
||||
}
|
||||
Reference in New Issue
Block a user