Improve amount specification UI

This commit is contained in:
Reckless_Satoshi 2022-03-24 08:43:31 -07:00
parent 93da75607c
commit 5aa0304d32
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 22 additions and 11 deletions

View File

@ -113,7 +113,7 @@ class Logics:
if min_sats > max_sats/1.5: if min_sats > max_sats/1.5:
return False, { return False, {
"bad_request": "bad_request":
"min_sats*1.5 has to be smaller than max_sats" "max amount must be at least 50 percent larger than min amount"
} }
elif max_sats > MAX_TRADE: elif max_sats > MAX_TRADE:
return False, { return False, {
@ -128,7 +128,7 @@ class Logics:
"bad_request": "bad_request":
"Your order minimum amount is too small. It is worth " + "Your order minimum amount is too small. It is worth " +
"{:,}".format(int(min_sats)) + "{:,}".format(int(min_sats)) +
" Sats now, but the limit is " + "{:,}".format(MAX_TRADE) + " Sats now, but the limit is " + "{:,}".format(MIN_TRADE) +
" Sats" " Sats"
} }
elif min_sats < max_sats/5: elif min_sats < max_sats/5:

View File

@ -182,8 +182,8 @@ export default class OrderPage extends Component {
<Grid containter xs={12} align="center" alignItems="stretch" justifyContent="center" style={{ display: "flex"}}> <Grid containter xs={12} align="center" alignItems="stretch" justifyContent="center" style={{ display: "flex"}}>
<this.InactiveMakerDialog/> <this.InactiveMakerDialog/>
<div style={{maxWidth:120}}> <div style={{maxWidth:120}}>
<Tooltip placement="top" enterTouchDelay="500" enterDelay="700" enterNextDelay="2000" title="Amount of fiat to exchange for bitcoin"> <Tooltip placement="top" enterTouchDelay="500" enterDelay="700" enterNextDelay="2000" title="Enter amount of fiat to exchange for bitcoin">
<Paper sx={{maxHeight:40}}> <Paper elevation={5} sx={{maxHeight:40}}>
<TextField <TextField
error={(this.state.takeAmount < this.state.min_amount || this.state.takeAmount > this.state.max_amount) & this.state.takeAmount != "" } error={(this.state.takeAmount < this.state.min_amount || this.state.takeAmount > this.state.max_amount) & this.state.takeAmount != "" }
helperText={this.amountHelperText()} helperText={this.amountHelperText()}
@ -202,12 +202,23 @@ export default class OrderPage extends Component {
</Paper> </Paper>
</Tooltip> </Tooltip>
</div> </div>
<div style={{height:38, top:'1px', position:'relative'}}> <div style={{height:38, top:'1px', position:'relative', display: (this.state.takeAmount < this.state.min_amount || this.state.takeAmount > this.state.max_amount || this.state.takeAmount == "" || this.state.takeAmount == null) ? '':'none'}}>
<Button sx={{height:38}} variant='contained' color='primary' <Tooltip placement="top" enterTouchDelay="0" enterDelay="500" enterNextDelay="1200" title="You must specify an amount first">
onClick={this.state.maker_status=='Inactive' ? this.handleClickOpenInactiveMakerDialog : this.takeOrder} <Paper elevation={4}>
disabled={this.state.takeAmount < this.state.min_amount || this.state.takeAmount > this.state.max_amount || this.state.takeAmount == "" || this.state.takeAmount == null } > <Button sx={{height:38}} variant='contained' color='primary'
Take Order disabled={true}>
</Button> Take Order
</Button>
</Paper>
</Tooltip>
</div>
<div style={{height:38, top:'1px', position:'relative', display: (this.state.takeAmount < this.state.min_amount || this.state.takeAmount > this.state.max_amount || this.state.takeAmount == "" || this.state.takeAmount == null) ? 'none':''}}>
<Paper elevation={4}>
<Button sx={{height:38}} variant='contained' color='primary'
onClick={this.state.maker_status=='Inactive' ? this.handleClickOpenInactiveMakerDialog : this.takeOrder}>
Take Order
</Button>
</Paper>
</div> </div>
</Grid> </Grid>
) )

File diff suppressed because one or more lines are too long