Add memory to textInput premium/satoshis

This commit is contained in:
Reckless_Satoshi 2022-01-31 14:42:43 -08:00
parent 18d5cac16a
commit bd8d2d8512
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 30 additions and 29 deletions

View File

@ -46,7 +46,7 @@ def follow_send_payment(lnpayment):
MACAROON = b64decode(config('LND_MACAROON_BASE64')) MACAROON = b64decode(config('LND_MACAROON_BASE64'))
fee_limit_sat = max(lnpayment.num_satoshis * 0.0002, 10) # 200 ppm or 10 sats max fee_limit_sat = int(max(lnpayment.num_satoshis * float(config('PROPORTIONAL_ROUTING_FEE_LIMIT')), float(config('MIN_FLAT_ROUTING_FEE_LIMIT')))) # 200 ppm or 10 sats
request = LNNode.routerrpc.SendPaymentRequest( request = LNNode.routerrpc.SendPaymentRequest(
payment_request=lnpayment.invoice, payment_request=lnpayment.invoice,
fee_limit_sat=fee_limit_sat, fee_limit_sat=fee_limit_sat,

View File

@ -89,15 +89,15 @@ export default class MakerPage extends Component {
handleClickRelative=(e)=>{ handleClickRelative=(e)=>{
this.setState({ this.setState({
is_explicit: false, is_explicit: false,
satoshis: null,
premium: 0,
}); });
this.handlePremiumChange();
} }
handleClickExplicit=(e)=>{ handleClickExplicit=(e)=>{
this.setState({ this.setState({
is_explicit: true, is_explicit: true,
premium: null,
}); });
this.handleSatoshisChange();
} }
handleCreateOfferButtonPressed=()=>{ handleCreateOfferButtonPressed=()=>{
@ -239,14 +239,15 @@ export default class MakerPage extends Component {
</FormControl> </FormControl>
</Grid> </Grid>
{/* conditional shows either Premium % field or Satoshis field based on pricing method */} {/* conditional shows either Premium % field or Satoshis field based on pricing method */}
{ this.state.is_explicit <Grid item xs={12} align="center">
? <Grid item xs={12} align="center"> <div style={{display: this.state.is_explicit ? '':'none'}}>
<TextField <TextField
label="Satoshis" label="Satoshis"
error={this.state.badSatoshis} error={this.state.badSatoshis}
helperText={this.state.badSatoshis} helperText={this.state.badSatoshis}
type="number" type="number"
required="true" required="true"
value={this.state.satoshis}
inputProps={{ inputProps={{
// TODO read these from .env file // TODO read these from .env file
min:this.minTradeSats , min:this.minTradeSats ,
@ -256,8 +257,8 @@ export default class MakerPage extends Component {
onChange={this.handleSatoshisChange} onChange={this.handleSatoshisChange}
// defaultValue={this.defaultSatoshis} // defaultValue={this.defaultSatoshis}
/> />
</Grid> </div>
: <Grid item xs={12} align="center"> <div style={{display: this.state.is_explicit ? 'none':''}}>
<TextField <TextField
label="Premium over Market (%)" label="Premium over Market (%)"
type="number" type="number"
@ -267,8 +268,8 @@ export default class MakerPage extends Component {
}} }}
onChange={this.handlePremiumChange} onChange={this.handlePremiumChange}
/> />
</div>
</Grid> </Grid>
}
</Paper> </Paper>
</Grid> </Grid>
<Grid item xs={12} align="center"> <Grid item xs={12} align="center">

View File

@ -517,7 +517,7 @@ export default class OrderPage extends Component {
{this.orderBox()} {this.orderBox()}
</Grid> </Grid>
<Grid item xs={6} align="left"> <Grid item xs={6} align="left">
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} /> <TradeBox push={this.props.history.push} width={330} data={this.state} completeSetState={this.completeSetState} />
</Grid> </Grid>
</Grid> </Grid>
) )
@ -553,7 +553,7 @@ export default class OrderPage extends Component {
{this.orderBox()} {this.orderBox()}
</div> </div>
<div style={{display: this.state.showContractBox == 1 ? '':'none'}}> <div style={{display: this.state.showContractBox == 1 ? '':'none'}}>
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} /> <TradeBox push={this.props.history.push} width={330} data={this.state} completeSetState={this.completeSetState} />
</div> </div>
</Grid> </Grid>
</Grid> </Grid>

View File

@ -677,7 +677,7 @@ handleRatingChange=(e)=>{
<Rating name="size-large" defaultValue={2} size="large" onChange={this.handleRatingChange} /> <Rating name="size-large" defaultValue={2} size="large" onChange={this.handleRatingChange} />
</Grid> </Grid>
<Grid item xs={12} align="center"> <Grid item xs={12} align="center">
<Button color='primary' href='/' component="a">Start Again</Button> <Button color='primary' onClick={this.props.push('/')}>Start Again</Button>
</Grid> </Grid>
</Grid> </Grid>
) )