mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 03:16:24 +00:00
Rename boolean explicit for is_explicit/isExplicit
This commit is contained in:
parent
c4b625a993
commit
c71d95ccd0
@ -53,7 +53,7 @@ class Order(models.Model):
|
|||||||
payment_method = models.CharField(max_length=30, null=False, default="Not specified")
|
payment_method = models.CharField(max_length=30, null=False, default="Not specified")
|
||||||
premium = models.DecimalField(max_digits=5, decimal_places=2, default=0, null=True, validators=[MinValueValidator(-100), MaxValueValidator(999)])
|
premium = models.DecimalField(max_digits=5, decimal_places=2, default=0, null=True, validators=[MinValueValidator(-100), MaxValueValidator(999)])
|
||||||
satoshis = models.PositiveBigIntegerField(null=True, validators=[MinValueValidator(min_satoshis_trade), MaxValueValidator(max_satoshis_trade)])
|
satoshis = models.PositiveBigIntegerField(null=True, validators=[MinValueValidator(min_satoshis_trade), MaxValueValidator(max_satoshis_trade)])
|
||||||
explicit = models.BooleanField(default=False, null=False) # pricing method. A explicit amount of sats, or a relative premium above/below market.
|
is_explicit = models.BooleanField(default=False, null=False) # pricing method. A explicit amount of sats, or a relative premium above/below market.
|
||||||
|
|
||||||
# order participants
|
# order participants
|
||||||
maker = models.ForeignKey(User, related_name='maker', on_delete=models.SET_NULL, null=True, default=None) # unique = True, a maker can only make one order
|
maker = models.ForeignKey(User, related_name='maker', on_delete=models.SET_NULL, null=True, default=None) # unique = True, a maker can only make one order
|
||||||
|
@ -4,9 +4,9 @@ from .models import Order
|
|||||||
class OrderSerializer(serializers.ModelSerializer):
|
class OrderSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Order
|
model = Order
|
||||||
fields = ('id','status','created_at','type','currency','amount','payment_method','explicit','premium','satoshis','maker','taker')
|
fields = ('id','status','created_at','type','currency','amount','payment_method','is_explicit','premium','satoshis','maker','taker')
|
||||||
|
|
||||||
class MakeOrderSerializer(serializers.ModelSerializer):
|
class MakeOrderSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Order
|
model = Order
|
||||||
fields = ('type','currency','amount','payment_method','explicit','premium','satoshis')
|
fields = ('type','currency','amount','payment_method','is_explicit','premium','satoshis')
|
@ -29,7 +29,7 @@ export default class MakerPage extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
explicit: false,
|
isExplicit: false,
|
||||||
type: 0,
|
type: 0,
|
||||||
currency: this.defaultCurrency,
|
currency: this.defaultCurrency,
|
||||||
currencyCode: this.defaultCurrencyCode,
|
currencyCode: this.defaultCurrencyCode,
|
||||||
@ -74,14 +74,14 @@ export default class MakerPage extends Component {
|
|||||||
}
|
}
|
||||||
handleClickRelative=(e)=>{
|
handleClickRelative=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
explicit: false,
|
isExplicit: false,
|
||||||
satoshis: null,
|
satoshis: null,
|
||||||
premium: 0,
|
premium: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleClickExplicit=(e)=>{
|
handleClickisExplicit=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
explicit: true,
|
isExplicit: true,
|
||||||
satoshis: 10000,
|
satoshis: 10000,
|
||||||
premium: null,
|
premium: null,
|
||||||
});
|
});
|
||||||
@ -97,7 +97,7 @@ export default class MakerPage extends Component {
|
|||||||
currency: this.state.currency,
|
currency: this.state.currency,
|
||||||
amount: this.state.amount,
|
amount: this.state.amount,
|
||||||
payment_method: this.state.payment_method,
|
payment_method: this.state.payment_method,
|
||||||
explicit: this.state.explicit,
|
is_explicit: this.state.isExplicit,
|
||||||
premium: this.state.premium,
|
premium: this.state.premium,
|
||||||
satoshis: this.state.satoshis,
|
satoshis: this.state.satoshis,
|
||||||
}),
|
}),
|
||||||
@ -210,7 +210,7 @@ export default class MakerPage extends Component {
|
|||||||
control={<Radio color="secondary"/>}
|
control={<Radio color="secondary"/>}
|
||||||
label="Explicit"
|
label="Explicit"
|
||||||
labelPlacement="Top"
|
labelPlacement="Top"
|
||||||
onClick={this.handleClickExplicit}
|
onClick={this.handleClickisExplicit}
|
||||||
onShow="false"
|
onShow="false"
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
@ -222,7 +222,7 @@ 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.explicit
|
{ this.state.isExplicit
|
||||||
? <Grid item xs={12} align="center">
|
? <Grid item xs={12} align="center">
|
||||||
<FormControl >
|
<FormControl >
|
||||||
<TextField
|
<TextField
|
||||||
@ -270,7 +270,7 @@ export default class MakerPage extends Component {
|
|||||||
<Typography component="subtitle2" variant="subtitle2">
|
<Typography component="subtitle2" variant="subtitle2">
|
||||||
<div align='center'>
|
<div align='center'>
|
||||||
Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode}
|
Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode}
|
||||||
{this.state.explicit ? " of " + this.state.satoshis + " Satoshis" :
|
{this.state.isExplicit ? " of " + this.state.satoshis + " Satoshis" :
|
||||||
(this.state.premium == 0 ? " at market price" :
|
(this.state.premium == 0 ? " at market price" :
|
||||||
(this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount")
|
(this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount")
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ export default class OrderPage extends Component {
|
|||||||
is_participant: false,
|
is_participant: false,
|
||||||
amount: 1,
|
amount: 1,
|
||||||
paymentMethod:"",
|
paymentMethod:"",
|
||||||
explicit: false,
|
isExplicit: false,
|
||||||
premium: 0,
|
premium: 0,
|
||||||
satoshis: null,
|
satoshis: null,
|
||||||
makerId: "",
|
makerId: "",
|
||||||
@ -33,7 +33,7 @@ export default class OrderPage extends Component {
|
|||||||
currency: data.currency,
|
currency: data.currency,
|
||||||
amount: data.amount,
|
amount: data.amount,
|
||||||
paymentMethod: data.payment_method,
|
paymentMethod: data.payment_method,
|
||||||
explicit: data.explicit,
|
isExplicit: data.is_explicit,
|
||||||
//premium: data.premium,
|
//premium: data.premium,
|
||||||
// satoshis: satoshis,
|
// satoshis: satoshis,
|
||||||
// makerId: maker,
|
// makerId: maker,
|
||||||
@ -55,7 +55,7 @@ export default class OrderPage extends Component {
|
|||||||
<p>Currency: {this.state.currencyCode}</p>
|
<p>Currency: {this.state.currencyCode}</p>
|
||||||
<p>Amount: {this.state.amount}</p>
|
<p>Amount: {this.state.amount}</p>
|
||||||
<p>Payment method: {this.state.paymentMethod}</p>
|
<p>Payment method: {this.state.paymentMethod}</p>
|
||||||
<p>Pricing method is explicit: {this.state.explicit.toString()}</p>
|
<p>Pricing method is explicit: {this.state.isExplicit.toString()}</p>
|
||||||
{/* <p>Premium: {this.state.premium}</p>
|
{/* <p>Premium: {this.state.premium}</p>
|
||||||
<p>Maker: {this.makerId}</p> */}
|
<p>Maker: {this.makerId}</p> */}
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user