init matches, tournament runner

This commit is contained in:
2025-08-30 23:58:50 -05:00
parent c37e8e8eb7
commit d2e4f0ca3f
11 changed files with 499 additions and 7 deletions

View 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} />
}