From d16bf6eb2e35dd833f5627177b4f97606a46a97f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sun, 28 Dec 2025 19:23:19 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Baccarat/Views/Game/GameTableView.swift | 84 ++++++++++++------- .../Views/Table/CardsDisplayArea.swift | 15 +++- 2 files changed, 65 insertions(+), 34 deletions(-) diff --git a/Baccarat/Baccarat/Views/Game/GameTableView.swift b/Baccarat/Baccarat/Views/Game/GameTableView.swift index c871d78..20bffac 100644 --- a/Baccarat/Baccarat/Views/Game/GameTableView.swift +++ b/Baccarat/Baccarat/Views/Game/GameTableView.swift @@ -50,6 +50,11 @@ struct GameTableView: View { isLandscape ? CasinoDesign.Size.maxContentWidthLandscape : CasinoDesign.Size.maxContentWidthPortrait } + /// Whether we're on a small screen (like iPhone SE) where space is tight + private var isSmallScreen: Bool { + screenSize.height < 700 + } + private var state: GameState { gameState ?? GameState(settings: settings) } @@ -246,21 +251,24 @@ struct GameTableView: View { Spacer(minLength: Design.Spacing.xSmall) - // Action buttons - ActionButtonsView( - gameState: state, - onDeal: { - Task { - await state.deal() - } - }, - onClear: { state.clearBets() }, - onNewRound: { state.newRound() } - ) - .frame(maxWidth: maxContentWidth * 0.8) - .padding(.horizontal) - .padding(.bottom, Design.Spacing.small) - .debugBorder(showDebugBorders, color: .green, label: "ActionBtns") + // Action buttons - hidden on small screens during dealing to save space + if !isDealing { + // Action buttons + ActionButtonsView( + gameState: state, + onDeal: { + Task { + await state.deal() + } + }, + onClear: { state.clearBets() }, + onNewRound: { state.newRound() } + ) + .frame(maxWidth: maxContentWidth * 0.8) + .padding(.horizontal) + .padding(.bottom, Design.Spacing.small) + .debugBorder(showDebugBorders, color: .green, label: "ActionBtns") + } } .frame(maxWidth: .infinity) .animation(.easeInOut(duration: Design.Animation.quick), value: state.currentPhase) @@ -308,6 +316,17 @@ struct GameTableView: View { Spacer(minLength: smallSpacerHeight) .debugBorder(showDebugBorders, color: .yellow, label: "Spacer2") + // Road map history - show in portrait before deal on larger screens + if settings.showHistory && !isSmallScreen && !isDealing { + RoadMapView(results: state.recentResults) + .frame(maxWidth: isLargeScreen ? maxContentWidth : .infinity) + .padding(.horizontal, Design.Spacing.medium) + .debugBorder(showDebugBorders, color: .orange, label: "RoadMap") + + Spacer(minLength: smallSpacerHeight) + .debugBorder(showDebugBorders, color: .yellow, label: "Spacer3") + } + // Betting table BettingTableView( gameState: state, @@ -341,21 +360,26 @@ struct GameTableView: View { .debugBorder(showDebugBorders, color: .pink, label: "ChipSelector") } - // Action buttons - ActionButtonsView( - gameState: state, - onDeal: { - Task { - await state.deal() - } - }, - onClear: { state.clearBets() }, - onNewRound: { state.newRound() } - ) - .frame(maxWidth: isLargeScreen ? maxContentWidth * 0.8 : .infinity) - .padding(.horizontal) - .padding(.bottom, bottomPadding) - .debugBorder(showDebugBorders, color: .green, label: "ActionBtns") + // Action buttons - hidden on small screens during dealing to save space + if isSmallScreen && isDealing { + Spacer() + .frame(height: 5) + } else { + ActionButtonsView( + gameState: state, + onDeal: { + Task { + await state.deal() + } + }, + onClear: { state.clearBets() }, + onNewRound: { state.newRound() } + ) + .frame(maxWidth: isLargeScreen ? maxContentWidth * 0.8 : .infinity) + .padding(.horizontal) + .padding(.bottom, bottomPadding) + .debugBorder(showDebugBorders, color: .green, label: "ActionBtns") + } } .animation(.easeInOut(duration: Design.Animation.quick), value: state.currentPhase) .safeAreaPadding(.bottom) diff --git a/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift b/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift index 58202e0..94308f0 100644 --- a/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift +++ b/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift @@ -92,7 +92,7 @@ struct CardsDisplayArea: View { guard height > 100 else { return horizontalHandWidth } // Blackjack uses 0.18, but in landscape we may need slightly smaller - let percentage: CGFloat = isLandscape ? 0.14 : 0.18 + let percentage: CGFloat = isLandscape ? 0.175 : height < 700 ? 0.14 : 0.18 let cardWidth = height * percentage // CompactHandView: cardWidth = containerWidth / divisor @@ -147,17 +147,24 @@ struct CardsDisplayArea: View { // Use different layouts but keep view identity with matchedGeometryEffect Group { if isDealing { - // Vertical layout - VStack(spacing: handsSpacing) { - // Top position + // Vertical layout with flexible spacing between hands + VStack(spacing: 0) { if playerOnBottom { bankerHandSection(width: handSectionWidth) .matchedGeometryEffect(id: "banker", in: animation) + + // Flexible spacer expands on taller screens + Spacer(minLength: handsSpacing) + playerHandSection(width: handSectionWidth) .matchedGeometryEffect(id: "player", in: animation) } else { playerHandSection(width: handSectionWidth) .matchedGeometryEffect(id: "player", in: animation) + + // Flexible spacer expands on taller screens + Spacer(minLength: handsSpacing) + bankerHandSection(width: handSectionWidth) .matchedGeometryEffect(id: "banker", in: animation) }