From afd548ae0b09d4d1ca19f2f0568c1c822e40b087 Mon Sep 17 00:00:00 2001 From: Thomas Hintz Date: Thu, 16 Apr 2020 09:37:51 -0700 Subject: [PATCH] Improving FF taking over 10 acres hay UX. --- src/components/farm/Board.jsx | 84 ++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/src/components/farm/Board.jsx b/src/components/farm/Board.jsx index 7e990ba..a2ba6e4 100644 --- a/src/components/farm/Board.jsx +++ b/src/components/farm/Board.jsx @@ -1498,6 +1498,24 @@ class Moving extends React.Component { } class Action extends React.Component { + state = { + bertChoice: 'nothing' + } + + setBertChoice = (e) => { + this.setState({ bertChoice: e.target.value }); + } + + bertSubmit = (e) => { + e.preventDefault(); + if (this.state.bertChoice === 'accept') { + buyUncleBert(); + this.props.showNextAction(); + } else if (this.state.bertChoice === 'deny') { + this.props.showNextAction(); + } + } + render() { let view, buttons; const { currentPlayer } = this.props; @@ -1522,39 +1540,51 @@ class Action extends React.Component { buttons = (); break; case 'farmers-fate': - view = ( -
- -
- -
- ); - buttons = (); - break; - case 'ff-uncle-bert': - const ffButtons = ( - - {this.props.player.cash >= 10000 ? ( - - ) : ()} - - - ); + view = ( +
+ +
+ +
+ ); + buttons = (); + break; + case 'ff-uncle-bert': + const { cash } = this.props.player; + const ffButtons = ( + <> + {cash < 10000 ? ( +

+ +

+ ) : (<>)} +
+ + + +
+ + ); view = (

{currentPlayer.cash >= 10000 ? `You have enough cash to take over Uncle Bert's farm!` : - `You must raise another $` + - formatMoney(10000 - currentPlayer.cash) + - ` to be able to take over Uncle Berts farm!` - } + ( + <> + You must raise another $ + {formatMoney(10000 - currentPlayer.cash) + ' '} + to be able to take over Uncle Berts farm! + + )}

{(this.props.player.name === this.props.game.currentPlayer) ?