match status

This commit is contained in:
yohlo
2025-09-11 14:04:05 -05:00
parent 22be6682dd
commit 8dfff139e1
8 changed files with 89 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { createFileRoute, redirect, useRouter } from '@tanstack/react-router'
import { tournamentQueries } from '@/features/tournaments/queries'
import { tournamentQueries, useTournament } from '@/features/tournaments/queries'
import { ensureServerQueryData } from '@/lib/tanstack-query/utils/ensure'
import SeedTournament from '@/features/tournaments/components/seed-tournament'
import { Container, Alert, Text } from '@mantine/core'
@@ -32,8 +32,8 @@ export const Route = createFileRoute('/_authed/admin/tournaments/run/$id')({
})
function RouteComponent() {
const { tournament } = Route.useRouteContext()
const router = useRouter()
const { id } = Route.useParams();
const { data: tournament } = useTournament(id)
const bracket: BracketData = useMemo(() => {
if (!tournament.matches || tournament.matches.length === 0) {
@@ -67,18 +67,12 @@ function RouteComponent() {
return { winners, losers }
}, [tournament.matches])
const handleSuccess = () => {
router.navigate({
to: '/admin/tournaments/$id',
params: { id: tournament.id }
})
}
const handleStartMatch = (match: Match) => {
}
console.log(tournament.matches)
return (
<Container size="md">
{
@@ -88,7 +82,6 @@ function RouteComponent() {
<SeedTournament
tournamentId={tournament.id}
teams={tournament.teams || []}
onSuccess={handleSuccess}
/>)
}
</Container>

View File

@@ -18,7 +18,7 @@ function RouteComponent() {
const urlParams = new URLSearchParams(window.location.search)
const redirect = urlParams.get('redirect')
if (redirect) {
if (redirect && !redirect.startsWith('/_serverFn')) {
window.location.href = decodeURIComponent(redirect)
} else {
window.location.href = '/'