more bracket refactoring again

This commit is contained in:
yohlo
2025-08-23 23:24:35 -05:00
parent 3cf00cc426
commit 9d5f8c5b55
4 changed files with 8 additions and 27 deletions

View File

@@ -16,20 +16,14 @@ export const BracketRound: React.FC<BracketRoundProps> = ({
getParentMatchOrder,
onAnnounce,
}) => {
const isMatchType = (type: string, expected: string) => {
return type?.toLowerCase() === expected.toLowerCase();
};
const isBye = (type: string) => type?.toLowerCase() === 'bye';
return (
<Flex direction="column" key={roundIndex} gap={24} justify="space-around">
{matches.map((match, matchIndex) => {
if (!match) return null;
// Handle bye matches
if (isMatchType(match.type, 'bye') || isMatchType(match.type, 'tbye')) {
return <Flex key={matchIndex}></Flex>;
}
if (isBye(match.type)) return <></>; // for spacing
return (
<Flex
direction="row"

View File

@@ -13,7 +13,7 @@ interface BracketProps {
const Bracket: React.FC<BracketProps> = ({ winners, losers, bracketMaps }) => {
const height = useAppShellHeight();
if (!bracketMaps) return <p>Data not available.</p>
if (!bracketMaps) return <p>Bracket not available.</p>
return (
<ScrollArea

View File

@@ -34,13 +34,13 @@ export const MatchCard: React.FC<MatchCardProps> = ({
{match.reset && (
<Text
pos="absolute"
top={-8}
top={-20}
left={8}
size="xs"
c="orange"
c="dimmed"
fw="bold"
>
IF NECESSARY
* If necessary
</Text>
)}

View File

@@ -1,17 +1,4 @@
interface Match {
lid: number;
round: number;
order: number | null;
type: string;
home: any;
away?: any;
reset?: boolean;
}
interface BracketData {
winners: Match[][];
losers: Match[][];
}
import { BracketData, Match } from "../types";
export interface BracketMaps {
matchByLid: Map<number, Match>;