Transform currency support v2 #23

Merged
bilal.catic merged 4 commits from transform-currency-support-v2 into master 2020-10-06 14:41:29 +02:00
Showing only changes of commit cb01467900 - Show all commits

View File

@@ -6,7 +6,6 @@ import {Button, Select, TextInput} from "react-materialize";
const ChipSelection = (props) => {
const [chips, setChips] = useState([]);
const [selectedChip, setSelectedChip] = useState('1');
const [chipScale, setChipScale] = useState('2');
useEffect(() => {
(async() => {
@@ -26,7 +25,7 @@ const ChipSelection = (props) => {
const chipsToOptions = chips.map( (chip, index) => <option key={index} value={chip.id}>{`${chip.code}${chip.name}`}</option>);
const disableSubmit = () => {
return !((parseInt(selectedChip) > 0) && (parseInt(chipScale) > 0));
return !(parseInt(selectedChip) > 0);
}
const handleSubmit = async () => {
@@ -37,7 +36,7 @@ const ChipSelection = (props) => {
chip_code: chipData.code,
chip_symbol: chipData.symbol,
chip_prefixed: chipData.prefixed,
chip_scale: parseInt(chipScale)
chip_scale: chipData.scale
}
try{
@@ -61,14 +60,6 @@ const ChipSelection = (props) => {
{ chipsToOptions }
</Select>
<TextInput
id='chipScale'
label="Chip scale"
value={chipScale}
type='number'
onChange={(e) => setChipScale(e.target.value)}
/>
<Button disabled={disableSubmit()} waves="light" onClick={handleSubmit}>
Do It
</Button>