Improving FF taking over 10 acres hay UX.

leave-game
Thomas Hintz 5 years ago
parent 775ec7ed70
commit afd548ae0b

@ -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;
@ -1533,17 +1551,26 @@ class Action extends React.Component {
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
break;
case 'ff-uncle-bert':
const { cash } = this.props.player;
const ffButtons = (
<Fragment>
{this.props.player.cash >= 10000 ? (
<Button onClick={() => { buyUncleBert(); this.props.showNextAction(); }}>
<>
{cash < 10000 ? (
<p>
<Button onClick={() => this.props.showScreen(SCREENS.loans)}>Raise ${formatMoney(10000 - cash)} Now</Button>
</p>
) : (<></>)}
<form onSubmit={this.bertSubmit}>
<label>
<input type="radio" name="bert" value="accept" onClick={this.setBertChoice} />
Yes, take over for $10,000!
</Button>
) : (<Fragment />)}
<Button onClick={() => this.props.showNextAction()}>
</label>
<label>
<input type="radio" name="bert" value="deny" onClick={this.setBertChoice} />
No, continue on
</Button>
</Fragment>
</label>
<Button type="submit" disabled={this.state.bertChoice === 'nothing' || this.state.bertChoice === 'accept' && cash < 10000}>Submit</Button>
</form>
</>
);
view = (
<GroupBox title={`Uncle Bert's inheritance`}>
@ -1551,10 +1578,13 @@ class Action extends React.Component {
<p>
{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!
</>
)}
</p>
<p>
{(this.props.player.name === this.props.game.currentPlayer) ?

Loading…
Cancel
Save