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

This commit is contained in:
Matt Bruce 2025-12-22 18:04:18 -06:00
parent e41eadff3c
commit 501f134678
4 changed files with 53 additions and 5 deletions

View File

@ -318,6 +318,18 @@ final class GameState {
return bet.amount >= minBet
}
/// Whether the main bet exists but is below the minimum required.
var isMainBetBelowMinimum: Bool {
guard let bet = mainBet else { return false }
return bet.amount < minBet
}
/// Amount needed to reach the minimum bet.
var amountNeededForMinimum: Int {
guard let bet = mainBet else { return minBet }
return max(0, minBet - bet.amount)
}
/// Whether a bet type can accept more chips (hasn't hit max).
func canAddToBet(type: BetType, amount: Int) -> Bool {
let currentAmount = betAmount(for: type)

View File

@ -457,6 +457,28 @@
}
}
},
"Add $%lld more to meet minimum" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add $%lld more to meet minimum"
}
},
"es-MX" : {
"stringUnit" : {
"state" : "translated",
"value" : "Añade $%lld más para alcanzar el mínimo"
}
},
"fr-CA" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ajoutez %lld$ de plus pour atteindre le minimum"
}
}
}
},
"After generating:" : {
"comment" : "A heading for the instructions section of the icon generator view.",
"localizations" : {

View File

@ -29,7 +29,7 @@ struct ActionButtonsView: View {
private let buttonFontSize: CGFloat = Design.BaseFontSize.xLarge
private let iconSize: CGFloat = Design.BaseFontSize.xxLarge + Design.Spacing.xSmall
private let statusFontSize: CGFloat = Design.BaseFontSize.medium
private let containerHeight: CGFloat = 50
private let containerHeight: CGFloat = 70
// MARK: - Body
@ -57,10 +57,21 @@ struct ActionButtonsView: View {
// MARK: - Private Views
private var bettingButtons: some View {
HStack(spacing: Design.Spacing.medium) {
clearButton
dealButton
VStack(spacing: Design.Spacing.small) {
// Show hint if main bet is below minimum
if gameState.isMainBetBelowMinimum {
Text(String(localized: "Add $\(gameState.amountNeededForMinimum) more to meet minimum"))
.font(.system(size: Design.BaseFontSize.small, weight: .medium))
.foregroundStyle(.orange)
.transition(.opacity.combined(with: .scale(scale: 0.8)))
}
HStack(spacing: Design.Spacing.medium) {
clearButton
dealButton
}
}
.animation(.easeInOut(duration: Design.Animation.standard), value: gameState.isMainBetBelowMinimum)
}
private var dealingIndicator: some View {

View File

@ -36,6 +36,7 @@ struct ActionButtonsView: View {
}
}
.animation(.spring(duration: Design.Animation.quick), value: state.currentPhase)
.animation(.easeInOut(duration: Design.Animation.standard), value: state.currentBet > 0)
}
.frame(minHeight: containerHeight)
.padding(.horizontal, Design.Spacing.large)
@ -52,7 +53,7 @@ struct ActionButtonsView: View {
Text(String(localized: "Add $\(state.amountNeededForMinimum) more to meet minimum"))
.font(.system(size: Design.BaseFontSize.small, weight: .medium))
.foregroundStyle(.orange)
.transition(.opacity)
.transition(.opacity.combined(with: .scale(scale: 0.8)))
}
HStack(spacing: Design.Spacing.medium) {
@ -76,6 +77,8 @@ struct ActionButtonsView: View {
.disabled(!state.canDeal)
}
}
.transition(.opacity.combined(with: .scale(scale: 0.9)))
.animation(.easeInOut(duration: Design.Animation.standard), value: state.isBetBelowMinimum)
}
}