diff --git a/Blackjack/Blackjack/Models/Hand.swift b/Blackjack/Blackjack/Models/Hand.swift index 0ec8b1b..a6ac652 100644 --- a/Blackjack/Blackjack/Models/Hand.swift +++ b/Blackjack/Blackjack/Models/Hand.swift @@ -117,10 +117,11 @@ struct BlackjackHand: Identifiable, Equatable { // MARK: - Card Value Extension extension Card { - /// The blackjack value of this card (Ace = 1 or 11, face cards = 10). + /// The blackjack value of this card for display purposes (Ace = 11, face cards = 10). + /// Note: Hand calculation handles ace flexibility (1 or 11). var blackjackValue: Int { switch rank { - case .ace: return 1 // Or 11, handled by hand calculation + case .ace: return 11 // Show as 11 for display; hand calculation handles soft/hard case .two: return 2 case .three: return 3 case .four: return 4 diff --git a/Blackjack/Blackjack/Views/Table/DealerHandView.swift b/Blackjack/Blackjack/Views/Table/DealerHandView.swift index 03f385c..5327d11 100644 --- a/Blackjack/Blackjack/Views/Table/DealerHandView.swift +++ b/Blackjack/Blackjack/Views/Table/DealerHandView.swift @@ -18,6 +18,7 @@ struct DealerHandView: View { @ScaledMetric(relativeTo: .headline) private var labelFontSize: CGFloat = Design.Size.handLabelFontSize var body: some View { + VStack(spacing: Design.Spacing.small) { // Label and value HStack(spacing: Design.Spacing.small) { @@ -25,17 +26,17 @@ struct DealerHandView: View { .font(.system(size: labelFontSize, weight: .bold, design: .rounded)) .foregroundStyle(.white) - // Show value: always show if hole card visible, or show single card value in European mode + // Show value: full value when hole card visible, otherwise just the face-up card's value if !hand.cards.isEmpty { if showHoleCard { + // All cards visible - show total hand value ValueBadge(value: hand.value, color: Color.Hand.dealer) - } else if hand.cards.count == 1 { - // European mode: show single visible card value + } else { + // Hole card hidden - show only the first (face-up) card's value ValueBadge(value: hand.cards[0].blackjackValue, color: Color.Hand.dealer) } } } - // Cards HStack(spacing: hand.cards.isEmpty ? Design.Spacing.small : cardSpacing) { if hand.cards.isEmpty { @@ -80,6 +81,20 @@ struct DealerHandView: View { } .accessibilityElement(children: .ignore) .accessibilityLabel(dealerAccessibilityLabel) + .background( + GeometryReader { geo in + Color.clear + .onAppear { + print("🃏 DealerHandView SIZE: \(geo.size.width) x \(geo.size.height), cards: \(hand.cards.count), cardWidth: \(cardWidth), cardSpacing: \(cardSpacing)") + } + .onChange(of: geo.size) { oldSize, newSize in + print("🃏 DealerHandView CHANGED: \(oldSize.width)x\(oldSize.height) → \(newSize.width)x\(newSize.height), cards: \(hand.cards.count)") + } + .onChange(of: hand.cards.count) { oldCount, newCount in + print("🃏 DealerHandView CARDS: \(oldCount) → \(newCount), size: \(geo.size.width)x\(geo.size.height)") + } + } + ) } // MARK: - Computed Properties diff --git a/CasinoKit/Sources/CasinoKit/Theme/CasinoDesign.swift b/CasinoKit/Sources/CasinoKit/Theme/CasinoDesign.swift index a31123e..4c98c63 100644 --- a/CasinoKit/Sources/CasinoKit/Theme/CasinoDesign.swift +++ b/CasinoKit/Sources/CasinoKit/Theme/CasinoDesign.swift @@ -149,7 +149,7 @@ public enum CasinoDesign { public static let actionButtonMinWidth: CGFloat = 80 /// Betting zone height. - public static let bettingZoneHeight: CGFloat = 80 + public static let bettingZoneHeight: CGFloat = 70 } // MARK: - Icon Sizes