Problem
When a player joins a table and their balance is less than the maximum buy-in, the buy-in modal defaults to the maximum amount instead of their actual balance. This creates a poor UX where the player must manually adjust the slider/input.
Example:
- Table max buy-in: $2.00
- Player balance: $0.80
- Current behavior: Buy-in defaults to $2.00 (shows red warning, player must adjust)
- Expected behavior: Buy-in should default to $0.80 (if >= min buy-in)
Current Implementation
In src/components/modals/BuyInModal.tsx:84:
// Initialize buyInAmount with maxBuyInFormatted
const [buyInAmount, setBuyInAmount] = useState(() => maxBuyInFormatted);
This always defaults to the maximum, regardless of player balance.
Proposed Solution
Update the initialization logic to:
const [buyInAmount, setBuyInAmount] = useState(() => {
// Default to max buy-in, but cap at player balance if lower
const maxBuyIn = parseFloat(maxBuyInFormatted);
const balance = balanceFormatted;
return Math.min(maxBuyIn, balance).toFixed(2);
});
Edge cases to handle:
- If balance < min buy-in: Default to min (will show error, but still UX improvement)
- If balance >= max buy-in: Default to max (current behavior)
- If min <= balance < max: Default to player's balance
Related Issues
This complements the buy-in UX improvements:
Files to Modify
src/components/modals/BuyInModal.tsx - Update buyInAmount initialization (line 84)
- Optional: Add unit tests for default buy-in logic
Acceptance Criteria
Additional Context
This improves UX by reducing friction during the join flow. Players with lower balances won't need to manually adjust the amount every time they join a table.
Problem
When a player joins a table and their balance is less than the maximum buy-in, the buy-in modal defaults to the maximum amount instead of their actual balance. This creates a poor UX where the player must manually adjust the slider/input.
Example:
Current Implementation
In
src/components/modals/BuyInModal.tsx:84:This always defaults to the maximum, regardless of player balance.
Proposed Solution
Update the initialization logic to:
Edge cases to handle:
Related Issues
This complements the buy-in UX improvements:
Files to Modify
src/components/modals/BuyInModal.tsx- UpdatebuyInAmountinitialization (line 84)Acceptance Criteria
Additional Context
This improves UX by reducing friction during the join flow. Players with lower balances won't need to manually adjust the amount every time they join a table.