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
}
/// 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)

View File

@ -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)
}