Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2025-12-28 19:23:19 -06:00
parent e8e0a68c24
commit d16bf6eb2e
2 changed files with 65 additions and 34 deletions

View File

@ -50,6 +50,11 @@ struct GameTableView: View {
isLandscape ? CasinoDesign.Size.maxContentWidthLandscape : CasinoDesign.Size.maxContentWidthPortrait 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 { private var state: GameState {
gameState ?? GameState(settings: settings) gameState ?? GameState(settings: settings)
} }
@ -246,21 +251,24 @@ struct GameTableView: View {
Spacer(minLength: Design.Spacing.xSmall) Spacer(minLength: Design.Spacing.xSmall)
// Action buttons // Action buttons - hidden on small screens during dealing to save space
ActionButtonsView( if !isDealing {
gameState: state, // Action buttons
onDeal: { ActionButtonsView(
Task { gameState: state,
await state.deal() onDeal: {
} Task {
}, await state.deal()
onClear: { state.clearBets() }, }
onNewRound: { state.newRound() } },
) onClear: { state.clearBets() },
.frame(maxWidth: maxContentWidth * 0.8) onNewRound: { state.newRound() }
.padding(.horizontal) )
.padding(.bottom, Design.Spacing.small) .frame(maxWidth: maxContentWidth * 0.8)
.debugBorder(showDebugBorders, color: .green, label: "ActionBtns") .padding(.horizontal)
.padding(.bottom, Design.Spacing.small)
.debugBorder(showDebugBorders, color: .green, label: "ActionBtns")
}
} }
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.animation(.easeInOut(duration: Design.Animation.quick), value: state.currentPhase) .animation(.easeInOut(duration: Design.Animation.quick), value: state.currentPhase)
@ -308,6 +316,17 @@ struct GameTableView: View {
Spacer(minLength: smallSpacerHeight) Spacer(minLength: smallSpacerHeight)
.debugBorder(showDebugBorders, color: .yellow, label: "Spacer2") .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 // Betting table
BettingTableView( BettingTableView(
gameState: state, gameState: state,
@ -341,21 +360,26 @@ struct GameTableView: View {
.debugBorder(showDebugBorders, color: .pink, label: "ChipSelector") .debugBorder(showDebugBorders, color: .pink, label: "ChipSelector")
} }
// Action buttons // Action buttons - hidden on small screens during dealing to save space
ActionButtonsView( if isSmallScreen && isDealing {
gameState: state, Spacer()
onDeal: { .frame(height: 5)
Task { } else {
await state.deal() ActionButtonsView(
} gameState: state,
}, onDeal: {
onClear: { state.clearBets() }, Task {
onNewRound: { state.newRound() } await state.deal()
) }
.frame(maxWidth: isLargeScreen ? maxContentWidth * 0.8 : .infinity) },
.padding(.horizontal) onClear: { state.clearBets() },
.padding(.bottom, bottomPadding) onNewRound: { state.newRound() }
.debugBorder(showDebugBorders, color: .green, label: "ActionBtns") )
.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) .animation(.easeInOut(duration: Design.Animation.quick), value: state.currentPhase)
.safeAreaPadding(.bottom) .safeAreaPadding(.bottom)

View File

@ -92,7 +92,7 @@ struct CardsDisplayArea: View {
guard height > 100 else { return horizontalHandWidth } guard height > 100 else { return horizontalHandWidth }
// Blackjack uses 0.18, but in landscape we may need slightly smaller // 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 let cardWidth = height * percentage
// CompactHandView: cardWidth = containerWidth / divisor // CompactHandView: cardWidth = containerWidth / divisor
@ -147,17 +147,24 @@ struct CardsDisplayArea: View {
// Use different layouts but keep view identity with matchedGeometryEffect // Use different layouts but keep view identity with matchedGeometryEffect
Group { Group {
if isDealing { if isDealing {
// Vertical layout // Vertical layout with flexible spacing between hands
VStack(spacing: handsSpacing) { VStack(spacing: 0) {
// Top position
if playerOnBottom { if playerOnBottom {
bankerHandSection(width: handSectionWidth) bankerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "banker", in: animation) .matchedGeometryEffect(id: "banker", in: animation)
// Flexible spacer expands on taller screens
Spacer(minLength: handsSpacing)
playerHandSection(width: handSectionWidth) playerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "player", in: animation) .matchedGeometryEffect(id: "player", in: animation)
} else { } else {
playerHandSection(width: handSectionWidth) playerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "player", in: animation) .matchedGeometryEffect(id: "player", in: animation)
// Flexible spacer expands on taller screens
Spacer(minLength: handsSpacing)
bankerHandSection(width: handSectionWidth) bankerHandSection(width: handSectionWidth)
.matchedGeometryEffect(id: "banker", in: animation) .matchedGeometryEffect(id: "banker", in: animation)
} }