From 8a4c75e8608b0076733f9736674bcea26217049f Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 25 Apr 2026 09:14:04 +0000 Subject: [PATCH] Move hasHeaderMenu out of IIFE into component body Computing it before the return statement is the right place since it only depends on props, not loop variables. Removes the IIFE entirely and fixes the indentation of the map callback body. https://claude.ai/code/session_017JCShLVs9xZ6FZmyrUFaE1 --- app/components/draft/MiniDraftGrid.tsx | 101 ++++++++++++------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/app/components/draft/MiniDraftGrid.tsx b/app/components/draft/MiniDraftGrid.tsx index 2aca6d0..687c5bb 100644 --- a/app/components/draft/MiniDraftGrid.tsx +++ b/app/components/draft/MiniDraftGrid.tsx @@ -142,6 +142,8 @@ export const MiniDraftGrid = memo(function MiniDraftGrid({ if (draftGrid.length === 0) return null; + const hasHeaderMenu = !!(onAdjustTimeBankOpen || onSetAutodraftOpen); + // h-14 (56px) + gap-1.5 (6px) fallback until first measurement const effectiveRowHeight = rowHeight > 0 ? rowHeight : 56; @@ -154,60 +156,57 @@ export const MiniDraftGrid = memo(function MiniDraftGrid({
{/* Team header */}
- {(() => { - const hasHeaderMenu = !!(onAdjustTimeBankOpen || onSetAutodraftOpen); - return draftSlots.map((slot) => { - const teamTime = teamTimers[slot.team.id]; - const isAutodraft = autodraftStatus[slot.team.id]?.isEnabled ?? false; - const isConnected = connectedTeams ? connectedTeams.has(slot.team.id) : true; + {draftSlots.map((slot) => { + const teamTime = teamTimers[slot.team.id]; + const isAutodraft = autodraftStatus[slot.team.id]?.isEnabled ?? false; + const isConnected = connectedTeams ? connectedTeams.has(slot.team.id) : true; - const headerContent = ( - <> -
- {isAutodraft && ( - A - )} - - {ownerMap[slot.team.id] || slot.team.name} - -
-
- {formatClockTime(teamTime)} -
- - ); - - if (hasHeaderMenu) { - return ( - - -
- {headerContent} -
-
- - {onAdjustTimeBankOpen && ( - onAdjustTimeBankOpen(slot.team.id)}> - Adjust Time Bank... - - )} - {onSetAutodraftOpen && ( - onSetAutodraftOpen(slot.team.id)}> - Set Autodraft... - - )} - -
- ); - } - - return ( -
- {headerContent} + const headerContent = ( + <> +
+ {isAutodraft && ( + A + )} + + {ownerMap[slot.team.id] || slot.team.name} +
+
+ {formatClockTime(teamTime)} +
+ + ); + + if (hasHeaderMenu) { + return ( + + +
+ {headerContent} +
+
+ + {onAdjustTimeBankOpen && ( + onAdjustTimeBankOpen(slot.team.id)}> + Adjust Time Bank... + + )} + {onSetAutodraftOpen && ( + onSetAutodraftOpen(slot.team.id)}> + Set Autodraft... + + )} + +
); - }); - })()} + } + + return ( +
+ {headerContent} +
+ ); + })}
{/* Rows — clipped to 2-row height, slides to reveal new round */}