From 9d5f8c5b55697cce0bf567b97b964f016920a975 Mon Sep 17 00:00:00 2001 From: yohlo Date: Sat, 23 Aug 2025 23:24:35 -0500 Subject: [PATCH] more bracket refactoring again --- src/features/bracket/components/bracket-round.tsx | 12 +++--------- src/features/bracket/components/bracket.tsx | 2 +- src/features/bracket/components/match-card.tsx | 6 +++--- src/features/bracket/utils/bracket-maps.ts | 15 +-------------- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/features/bracket/components/bracket-round.tsx b/src/features/bracket/components/bracket-round.tsx index 3267e4f..af770ac 100644 --- a/src/features/bracket/components/bracket-round.tsx +++ b/src/features/bracket/components/bracket-round.tsx @@ -16,20 +16,14 @@ export const BracketRound: React.FC = ({ getParentMatchOrder, onAnnounce, }) => { - const isMatchType = (type: string, expected: string) => { - return type?.toLowerCase() === expected.toLowerCase(); - }; + const isBye = (type: string) => type?.toLowerCase() === 'bye'; return ( {matches.map((match, matchIndex) => { if (!match) return null; - - // Handle bye matches - if (isMatchType(match.type, 'bye') || isMatchType(match.type, 'tbye')) { - return ; - } - + if (isBye(match.type)) return <>; // for spacing + return ( = ({ winners, losers, bracketMaps }) => { const height = useAppShellHeight(); - if (!bracketMaps) return

Data not available.

+ if (!bracketMaps) return

Bracket not available.

return ( = ({ {match.reset && ( - IF NECESSARY + * If necessary )} diff --git a/src/features/bracket/utils/bracket-maps.ts b/src/features/bracket/utils/bracket-maps.ts index 169cab3..bf58b6d 100644 --- a/src/features/bracket/utils/bracket-maps.ts +++ b/src/features/bracket/utils/bracket-maps.ts @@ -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;