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 { 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() { render() {
let view, buttons; let view, buttons;
const { currentPlayer } = this.props; const { currentPlayer } = this.props;
@ -1522,39 +1540,51 @@ class Action extends React.Component {
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>); buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
break; break;
case 'farmers-fate': case 'farmers-fate':
view = ( view = (
<div className='game-card'> <div className='game-card'>
<GroupBox title={fateCard}> <GroupBox title={fateCard}>
<div className='card' <div className='card'
dangerouslySetInnerHTML={{ __html: this.props.ui.actionValue }} /> dangerouslySetInnerHTML={{ __html: this.props.ui.actionValue }} />
</GroupBox> </GroupBox>
</div> </div>
); );
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>); buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
break; break;
case 'ff-uncle-bert': case 'ff-uncle-bert':
const ffButtons = ( const { cash } = this.props.player;
<Fragment> const ffButtons = (
{this.props.player.cash >= 10000 ? ( <>
<Button onClick={() => { buyUncleBert(); this.props.showNextAction(); }}> {cash < 10000 ? (
Yes, take over for $10,000! <p>
</Button> <Button onClick={() => this.props.showScreen(SCREENS.loans)}>Raise ${formatMoney(10000 - cash)} Now</Button>
) : (<Fragment />)} </p>
<Button onClick={() => this.props.showNextAction()}> ) : (<></>)}
No, continue on <form onSubmit={this.bertSubmit}>
</Button> <label>
</Fragment> <input type="radio" name="bert" value="accept" onClick={this.setBertChoice} />
); Yes, take over for $10,000!
</label>
<label>
<input type="radio" name="bert" value="deny" onClick={this.setBertChoice} />
No, continue on
</label>
<Button type="submit" disabled={this.state.bertChoice === 'nothing' || this.state.bertChoice === 'accept' && cash < 10000}>Submit</Button>
</form>
</>
);
view = ( view = (
<GroupBox title={`Uncle Bert's inheritance`}> <GroupBox title={`Uncle Bert's inheritance`}>
<div className='center'> <div className='center'>
<p> <p>
{currentPlayer.cash >= 10000 ? {currentPlayer.cash >= 10000 ?
`You have enough cash to take over Uncle Bert's farm!` : `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>
<p> <p>
{(this.props.player.name === this.props.game.currentPlayer) ? {(this.props.player.name === this.props.game.currentPlayer) ?

Loading…
Cancel
Save