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, getParentMatchOrder,
onAnnounce, onAnnounce,
}) => { }) => {
const isMatchType = (type: string, expected: string) => { const isBye = (type: string) => type?.toLowerCase() === 'bye';
return type?.toLowerCase() === expected.toLowerCase();
};
return ( return (
<Flex direction="column" key={roundIndex} gap={24} justify="space-around"> <Flex direction="column" key={roundIndex} gap={24} justify="space-around">
{matches.map((match, matchIndex) => { {matches.map((match, matchIndex) => {
if (!match) return null; if (!match) return null;
if (isBye(match.type)) return <></>; // for spacing
// Handle bye matches
if (isMatchType(match.type, 'bye') || isMatchType(match.type, 'tbye')) {
return <Flex key={matchIndex}></Flex>;
}
return ( return (
<Flex <Flex
direction="row" direction="row"

View File

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

View File

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

View File

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