import React, { useMemo } from "react"; import { Text, ScrollArea } from "@mantine/core"; import { BracketData } from "../types"; import { Bracket } from "./bracket"; import useAppShellHeight from "@/hooks/use-appshell-height"; import { Match } from "@/features/matches/types"; import styles from "./styles.module.css"; interface BracketViewProps { bracket: BracketData; showControls?: boolean; groupConfig?: { num_groups: number; advance_per_group: number; }; renderMatch?: (match: Match) => React.ReactNode; bottomOffset?: number; } const BracketView: React.FC = ({ bracket, showControls, groupConfig, renderMatch, bottomOffset }) => { const height = useAppShellHeight(); const orders = useMemo(() => { const map: Record = {}; bracket.winners.flat().forEach(match => map[match.lid] = match.order); bracket.losers.flat().forEach(match => map[match.lid] = match.order); return map; }, [bracket.winners, bracket.losers]); return
Winners Bracket
{bracket.losers && bracket.losers.length > 0 && bracket.losers.some(round => round.length > 0) && (
Losers Bracket
)} {bottomOffset ?
: null} }; export default BracketView;