import React from 'react'
import styles from './AmountUnitField.scss'
import { DropdownButton, MenuItem } from 'react-bootstrap'
-import { converIntToDec, addZeroToDecimalPosition } from 'utility/buildInOutDisplay'
+import { converIntToDec, addZeroToDecimalPosition, formatBTMAmount, parseBTMAmount } from 'utility/buildInOutDisplay'
import { FieldLabel } from 'features/shared/components'
import pick from 'lodash/pick'
if (this.props.fieldProps.onChange) {
// Notify the normalized value
this.props.fieldProps.onChange(
- this.props.normalize(value, this.state.pos )
+ parseBTMAmount(value, this.state.pos )
)
}
}
{<input className='form-control'
type={this.state.type}
{...fieldProps}
- value={this.props.format(this.state.value, this.state.pos)}
+ value={formatBTMAmount(this.state.value, this.state.pos)}
onBlur={this.handleBlur}
onChange={this.handleChange}
/>}
import React from 'react'
-import { ErrorBanner, HiddenField, Autocomplete, JsonField, TextField, ObjectSelectorField } from 'features/shared/components'
+import { ErrorBanner, HiddenField, Autocomplete, JsonField, TextField, ObjectSelectorField, AmountUnitField } from 'features/shared/components'
import styles from './FormActionItem.scss'
const ISSUE_KEY = 'issue'
this.props.remove(this.props.index)
}
+ const btmAmounUnitVisible = (assetAlias.value === 'btm' ||
+ assetId.value === 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' )
+
const classNames = [styles.main]
if (type.error) classNames.push(styles.error)
}}
/>}
- {visible.amount &&
+ {visible.amount && !btmAmounUnitVisible &&
<TextField title='Amount' fieldProps={amount} />}
+ {visible.amount && btmAmounUnitVisible &&
+ <AmountUnitField title='Amount' fieldProps={amount} />}
+
{visible.password && false &&
<TextField title='Password' placeholder='Password' fieldProps={password} autoFocus={false} type={'password'} />
}
import React from 'react'
import styles from './New.scss'
import balanceActions from 'features/balances/actions'
-import { normalizeBTMAmountUnit, formatBTMAmount, parseBTMAmount } from 'utility/buildInOutDisplay'
+import { normalizeBTMAmountUnit } from 'utility/buildInOutDisplay'
const rangeOptions = [
{
<TextField title='Address' fieldProps={normalTransaction.address}/>
{!showBtmAmountUnit && <TextField title='Amount' fieldProps={normalTransaction.amount}
/>}
- {showBtmAmountUnit && <AmountUnitField
- title='Amount'
- fieldProps={{
- ...normalTransaction.amount,
- }}
- format={formatBTMAmount}
- normalize={parseBTMAmount}
+ {showBtmAmountUnit && <AmountUnitField title='Amount' fieldProps={normalTransaction.amount}
/>}
</div>