From 545271e9bd2e8b6f15aee5ca7bb7db89e155a67a Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sun, 28 Dec 2025 15:56:26 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Baccarat/Views/Game/GameTableView.swift | 6 +-- .../Blackjack/Views/Game/GameTableView.swift | 2 +- .../Views/Chips/ChipSelectorView.swift | 1 + .../Views/Overlays/ResultBannerView.swift | 50 +++++++++++-------- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Baccarat/Baccarat/Views/Game/GameTableView.swift b/Baccarat/Baccarat/Views/Game/GameTableView.swift index 3a7dab9..65a4d52 100644 --- a/Baccarat/Baccarat/Views/Game/GameTableView.swift +++ b/Baccarat/Baccarat/Views/Game/GameTableView.swift @@ -214,14 +214,13 @@ struct GameTableView: View { Spacer(minLength: Design.Spacing.xSmall) - // Chip selector + // Chip selector - full width so all chips are tappable ChipSelectorView( selectedChip: $selectedChip, balance: state.balance, currentBet: state.totalBetAmount, maxBet: state.maxBet ) - .frame(maxWidth: maxContentWidth) .debugBorder(showDebugBorders, color: .pink, label: "ChipSelector") Spacer(minLength: Design.Spacing.xSmall) @@ -310,14 +309,13 @@ struct GameTableView: View { Spacer(minLength: mediumSpacerHeight) .debugBorder(showDebugBorders, color: .yellow, label: "Spacer4") - // Chip selector (from CasinoKit) + // Chip selector - full width so all chips are tappable ChipSelectorView( selectedChip: $selectedChip, balance: state.balance, currentBet: state.totalBetAmount, maxBet: state.maxBet ) - .frame(maxWidth: isLargeScreen ? maxContentWidth : .infinity) .debugBorder(showDebugBorders, color: .pink, label: "ChipSelector") Spacer(minLength: smallSpacerHeight) diff --git a/Blackjack/Blackjack/Views/Game/GameTableView.swift b/Blackjack/Blackjack/Views/Game/GameTableView.swift index df5fa91..722e2da 100644 --- a/Blackjack/Blackjack/Views/Game/GameTableView.swift +++ b/Blackjack/Blackjack/Views/Game/GameTableView.swift @@ -148,6 +148,7 @@ struct GameTableView: View { Spacer(minLength: 0) // Chip selector - only shown during betting phase AND when result banner is NOT showing + // Full width on iPad so all chips are tappable if state.currentPhase == .betting && !state.showResultBanner { ChipSelectorView( selectedChip: $selectedChip, @@ -155,7 +156,6 @@ struct GameTableView: View { currentBet: state.minBetForChipSelector, maxBet: state.settings.maxBet ) - .frame(maxWidth: maxContentWidth) .debugBorder(showDebugBorders, color: .pink, label: "ChipSelector") } diff --git a/CasinoKit/Sources/CasinoKit/Views/Chips/ChipSelectorView.swift b/CasinoKit/Sources/CasinoKit/Views/Chips/ChipSelectorView.swift index 5d76775..ca9ba38 100644 --- a/CasinoKit/Sources/CasinoKit/Views/Chips/ChipSelectorView.swift +++ b/CasinoKit/Sources/CasinoKit/Views/Chips/ChipSelectorView.swift @@ -77,6 +77,7 @@ public struct ChipSelectorView: View { .padding(.vertical, CasinoDesign.Spacing.medium) .frame(minWidth: geometry.size.width) // Center when content fits } + .scrollClipDisabled() // Allow visual overflow during scroll/animation .scrollBounceBehavior(fitsOnScreen ? .basedOnSize : .automatic) } .frame(height: CasinoDesign.Size.chipLarge + CasinoDesign.Spacing.medium * 2) diff --git a/CasinoKit/Sources/CasinoKit/Views/Overlays/ResultBannerView.swift b/CasinoKit/Sources/CasinoKit/Views/Overlays/ResultBannerView.swift index 678bd49..1511d7d 100644 --- a/CasinoKit/Sources/CasinoKit/Views/Overlays/ResultBannerView.swift +++ b/CasinoKit/Sources/CasinoKit/Views/Overlays/ResultBannerView.swift @@ -81,6 +81,7 @@ public struct CasinoResultBannerView: View { @ScaledMetric(relativeTo: .largeTitle) private var resultFontSize: CGFloat = CasinoDesign.BaseFontSize.largeTitle @ScaledMetric(relativeTo: .title3) private var totalFontSize: CGFloat = CasinoDesign.BaseFontSize.xxLarge + CasinoDesign.Spacing.xSmall @ScaledMetric(relativeTo: .headline) private var buttonFontSize: CGFloat = CasinoDesign.BaseFontSize.xLarge + @ScaledMetric(relativeTo: .title) private var gameOverFontSize: CGFloat = CasinoDesign.BaseFontSize.xxLarge // MARK: - Computed Properties @@ -137,9 +138,24 @@ public struct CasinoResultBannerView: View { // Banner card VStack(spacing: CasinoDesign.Spacing.medium) { - // Result text with gradient and glow + // Game Over header (shown prominently at top when out of chips) + if isGameOver { + VStack(spacing: CasinoDesign.Spacing.xSmall) { + Text(String(localized: "GAME OVER", bundle: .module)) + .font(.system(size: gameOverFontSize, weight: .black, design: .rounded)) + .foregroundStyle(.red) + + Text(String(localized: "You've run out of chips!", bundle: .module)) + .font(.system(size: CasinoDesign.BaseFontSize.medium, weight: .medium)) + .foregroundStyle(.white.opacity(CasinoDesign.Opacity.strong)) + } + .scaleEffect(showText ? CasinoDesign.Scale.normal : CasinoDesign.Scale.shrunk) + .opacity(showText ? CasinoDesign.Scale.normal : 0) + } + + // Result text with gradient and glow (smaller when game over) Text(resultText) - .font(.system(size: resultFontSize, weight: .black, design: .rounded)) + .font(.system(size: isGameOver ? resultFontSize * 0.7 : resultFontSize, weight: .black, design: .rounded)) .foregroundStyle( LinearGradient( colors: [.white, resultColor], @@ -208,25 +224,19 @@ public struct CasinoResultBannerView: View { @ViewBuilder private var buttonSection: some View { if isGameOver { - // Game Over - show message and restart button - VStack(spacing: CasinoDesign.Spacing.medium) { - Text(String(localized: "You've run out of chips!", bundle: .module)) - .font(.system(size: CasinoDesign.BaseFontSize.medium, weight: .medium)) - .foregroundStyle(.red.opacity(CasinoDesign.Opacity.heavy)) - - Button { - onPlayAgain() - } label: { - HStack(spacing: CasinoDesign.Spacing.small) { - Image(systemName: "arrow.counterclockwise") - Text(String(localized: "Play Again", bundle: .module)) - } - .font(.system(size: buttonFontSize, weight: .bold)) - .foregroundStyle(.black) - .padding(.horizontal, CasinoDesign.Spacing.xxxLarge + CasinoDesign.Spacing.small) - .padding(.vertical, CasinoDesign.Spacing.medium + CasinoDesign.Spacing.xxSmall) - .background(goldButtonBackground) + // Game Over - show restart button (message is at top) + Button { + onPlayAgain() + } label: { + HStack(spacing: CasinoDesign.Spacing.small) { + Image(systemName: "arrow.counterclockwise") + Text(String(localized: "Play Again", bundle: .module)) } + .font(.system(size: buttonFontSize, weight: .bold)) + .foregroundStyle(.black) + .padding(.horizontal, CasinoDesign.Spacing.xxxLarge + CasinoDesign.Spacing.small) + .padding(.vertical, CasinoDesign.Spacing.medium + CasinoDesign.Spacing.xxSmall) + .background(goldButtonBackground) } } else { // Normal - New Round button