import { Link } from "react-router"; import type { Route } from "./+types/admin.tournaments._index"; import { findAllTournamentsGroupedBySport } from "~/models/tournament"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "~/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "~/components/ui/table"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; import { Trophy } from "lucide-react"; export function meta(): Route.MetaDescriptors { return [{ title: "Tournaments - Brackt Admin" }]; } export async function loader() { const grouped = await findAllTournamentsGroupedBySport(); return { grouped }; } export default function AdminTournamentsIndex({ loaderData, }: Route.ComponentProps) { const { grouped } = loaderData; const totalCount = grouped.reduce( (acc, g) => acc + g.tournaments.length, 0 ); return (
Canonical tournaments across all sports. Enter results once here and they fan out to every linked scoring window.
Canonical tournaments are created automatically by the backfill or data-sync flows.
{totalCount} {totalCount === 1 ? "tournament" : "tournaments"}{" "} across {grouped.length}{" "} {grouped.length === 1 ? "sport" : "sports"}
{grouped.map((group) => (