Skip to content

Commit

Permalink
fix #514/3,11
Browse files Browse the repository at this point in the history
  • Loading branch information
b1acksun committed Nov 9, 2017
1 parent af7afe9 commit 5de7c6f
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions app/components/modules/AssetCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class AssetCreate extends React.Component {
isBitAsset: isBitAsset,
is_prediction_market: false,
core_exchange_rate: {
quote: '1 null',
quote: '1 -',
base: '1 GOLOS'
},
bitasset_opts: {
Expand Down Expand Up @@ -360,15 +360,10 @@ class AssetCreate extends React.Component {
onCoreRateChange(type, e) {
let amount, asset;
if (type === "quote") {
amount = utils.limitByPrecision(e.target.value, this.props.core);
const { symbol } = this.state.update;
asset = symbol;
amount = e.amount == "" ? "0" :utils.limitByPrecision(e.amount, this.state.update.precision);
asset = this.state.update.symbol;
} else {
if (!e || !("amount" in e)) {
return;
}
const precision = utils.get_asset_precision(this.props.core);
amount = e.amount == "" ? "0" : utils.limitByPrecision(e.amount, precision);
amount = e.amount == "" ? "0" : utils.limitByPrecision(e.amount, this.props.core.get('precision'));
asset = 'GOLOS';
}

Expand Down Expand Up @@ -588,27 +583,22 @@ class AssetCreate extends React.Component {
{errors.quote_asset ? <p className="error">{errors.quote_asset}</p> : null}
{errors.base_asset ? <p className="error">{errors.base_asset}</p> : null}
<div className="column small-12 medium-6">
<div className="amount-selector" style={{width: "100%", paddingRight: "10px"}}>
{tt('user_issued_assets.quote')}
<div className="inline-label">
<input
type="text"
placeholder="0.001"
onChange={this.onCoreRateChange.bind(this, "quote")}
value={assetUtils.splitAmount(core_exchange_rate.quote)[0]}
/>
</div>
</div>
<AmountSelector
label={tt('user_issued_assets.quote')}
amount={formatAmount(core_exchange_rate.quote.split(' ')[0])}
onChange={this.onCoreRateChange.bind(this, "quote")}
asset={assetUtils.splitAmount(core_exchange_rate.quote)[1]}
placeholder="0.001"
/>

</div>
<div className="column small-12 medium-6">
<AmountSelector
label={tt('user_issued_assets.base')}
amount={assetUtils.splitAmount(core_exchange_rate.base)[0]}
amount={formatAmount(core_exchange_rate.base.split(' ')[0])}
onChange={this.onCoreRateChange.bind(this, "base")}
asset={assetUtils.splitAmount(core_exchange_rate.base)[1]}
placeholder="0.001"
tabIndex={1}
/>
</div>
</div>
Expand Down

0 comments on commit 5de7c6f

Please sign in to comment.