diff --git a/Blackjack/Blackjack/Engine/GameState.swift b/Blackjack/Blackjack/Engine/GameState.swift index 5dfe86f..772ed42 100644 --- a/Blackjack/Blackjack/Engine/GameState.swift +++ b/Blackjack/Blackjack/Engine/GameState.swift @@ -520,6 +520,12 @@ final class GameState: CasinoGameState { // Animation timing let animationDuration = Design.Animation.springDuration * settings.dealingSpeed + + // Brief delay to let SwiftUI render the player hands container before cards fly in + // This ensures the container with placeholders is visible before the first card animates + if settings.showAnimations { + try? await Task.sleep(for: .milliseconds(200)) + } // Small delay for card to appear on screen before updating badge (~15% of animation) let cardAppearDelay = settings.showAnimations ? animationDuration * 0.15 : 0 // Remaining delay after badge update to complete the animation diff --git a/Blackjack/Blackjack/Views/Table/BlackjackTableView.swift b/Blackjack/Blackjack/Views/Table/BlackjackTableView.swift index fd68f69..f1186eb 100644 --- a/Blackjack/Blackjack/Views/Table/BlackjackTableView.swift +++ b/Blackjack/Blackjack/Views/Table/BlackjackTableView.swift @@ -116,8 +116,9 @@ struct BlackjackTableView: View { Spacer(minLength: Design.Spacing.small) .debugBorder(showDebugBorders, color: .yellow, label: "BottomSpacer") - // Player hands area - only show when there are cards dealt - if state.playerHands.first?.cards.isEmpty == false { + // Player hands area - show when not betting (includes dealing phase) + // This ensures the container with placeholders is visible BEFORE cards fly in + if state.currentPhase != .betting { ZStack { PlayerHandsContainer( hands: state.playerHands, diff --git a/CasinoKit/Sources/CasinoKit/Views/Badges/ValueBadge.swift b/CasinoKit/Sources/CasinoKit/Views/Badges/ValueBadge.swift index 873d743..2636ab3 100644 --- a/CasinoKit/Sources/CasinoKit/Views/Badges/ValueBadge.swift +++ b/CasinoKit/Sources/CasinoKit/Views/Badges/ValueBadge.swift @@ -7,7 +7,7 @@ import SwiftUI -/// A circular badge showing a numeric value. +/// A capsule badge showing a numeric value. public struct ValueBadge: View { /// The value to display. public let value: Int @@ -21,7 +21,8 @@ public struct ValueBadge: View { // MARK: - Scaled Font Sizes (Dynamic Type) @ScaledMetric(relativeTo: .headline) private var valueFontSize: CGFloat = 15 - @ScaledMetric(relativeTo: .headline) private var badgeSize: CGFloat = CasinoDesign.Size.valueBadge + @ScaledMetric(relativeTo: .headline) private var badgeHeight: CGFloat = CasinoDesign.Size.valueBadge + @ScaledMetric(relativeTo: .headline) private var badgePadding: CGFloat = 8 /// Creates a value badge. /// - Parameters: @@ -34,17 +35,20 @@ public struct ValueBadge: View { self.size = size } - private var displaySize: CGFloat { - size ?? badgeSize + private var displayHeight: CGFloat { + size ?? badgeHeight } public var body: some View { Text("\(value)") .font(.system(size: valueFontSize, weight: .black, design: .rounded)) .foregroundStyle(.white) - .frame(width: displaySize, height: displaySize) + .lineLimit(1) + .fixedSize(horizontal: true, vertical: false) + .padding(.horizontal, badgePadding) + .frame(minWidth: displayHeight, minHeight: displayHeight) .background( - Circle() + Capsule() .fill(color) ) .accessibilityLabel("\(value)")