|
|
|
@ -550,6 +550,11 @@ class Loans extends React.Component {
|
|
|
|
|
this.setState({ repay: 0, takeOut: 0 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleEmergencyLoan = e => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
loan(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
if (this.props.player.debt !== prevProps.player.debt ||
|
|
|
|
|
this.props.game.settings.loanInterest !== prevProps.game.settings.loanInterest ||
|
|
|
|
@ -559,44 +564,48 @@ class Loans extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|
return (
|
|
|
|
|
<GroupBox title={'Loans'}>
|
|
|
|
|
<MoneySummary title='Cash' value={this.props.player.cash} /> {' '}
|
|
|
|
|
<MoneySummary title='Debt' value={this.props.player.debt} />
|
|
|
|
|
/${formatMoney(this.props.game.settings.maxDebt)}
|
|
|
|
|
<br />
|
|
|
|
|
{this.props.game.settings.loanInterest > 0 ? '(' + (this.props.game.settings.loanInterest * 100) + '% interest added to each loan)' : ''}
|
|
|
|
|
<br /><br />
|
|
|
|
|
<form onSubmit={this.handleSubmit}>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='repay' type='number'
|
|
|
|
|
value={this.state.repay === 0 ? '' : this.state.repay}/>
|
|
|
|
|
{'\u00A0'}K / ${this.props.player.debt / 1000}K
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' type='submit'>Repay</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='takeOut' type='number'
|
|
|
|
|
value={this.state.takeOut === 0 ? '' : this.state.takeOut} />
|
|
|
|
|
{'\u00A0'}K / ${this.state.maxLoan / 1000}K
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' type='submit'>Take Out</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</form>
|
|
|
|
|
</GroupBox>
|
|
|
|
|
);
|
|
|
|
|
return (
|
|
|
|
|
<GroupBox title={'Loans'}>
|
|
|
|
|
<MoneySummary title='Cash' value={this.props.player.cash} /> {' '}
|
|
|
|
|
<MoneySummary title='Debt' value={this.props.player.debt} />
|
|
|
|
|
/${formatMoney(this.props.game.settings.maxDebt)}
|
|
|
|
|
<br />
|
|
|
|
|
{this.props.game.settings.loanInterest > 0 ? '(' + (this.props.game.settings.loanInterest * 100) + '% interest added to each loan)' : ''}
|
|
|
|
|
<br />
|
|
|
|
|
{this.props.player.debt >= this.props.game.settings.maxDebt ? (
|
|
|
|
|
<><Button onClick={this.handleEmergencyLoan}>Emergency Loan</Button> $1,000 at 100% interest</>
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
<br />
|
|
|
|
|
<form onSubmit={this.handleSubmit}>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='repay' type='number'
|
|
|
|
|
value={this.state.repay === 0 ? '' : this.state.repay}/>
|
|
|
|
|
{'\u00A0'}K / ${this.props.player.debt / 1000}K
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' type='submit'>Repay</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='takeOut' type='number'
|
|
|
|
|
value={this.state.takeOut === 0 ? '' : this.state.takeOut} />
|
|
|
|
|
{'\u00A0'}K / ${this.state.maxLoan / 1000}K
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' type='submit'>Take Out</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</form>
|
|
|
|
|
</GroupBox>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|