Browse Source
Replace formatting of quantity with input addon
debug-collab-settlement
Thomas Eizinger
3 years ago
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
2 changed files with
20 additions and
18 deletions
-
taker-frontend/src/App.tsx
-
taker-frontend/src/components/Trade.tsx
|
|
@ -100,9 +100,6 @@ export const App = () => { |
|
|
|
500, |
|
|
|
); |
|
|
|
|
|
|
|
const format = (val: any) => `$` + val; |
|
|
|
const parse = (val: any) => val.replace(/^\$/, ""); |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Nav walletInfo={walletInfo} connectedToMaker={connectedToMaker} /> |
|
|
@ -119,7 +116,7 @@ export const App = () => { |
|
|
|
<Trade |
|
|
|
connectedToMaker={connectedToMaker} |
|
|
|
orderId={order?.id} |
|
|
|
quantity={format(effectiveQuantity)} |
|
|
|
quantity={effectiveQuantity} |
|
|
|
maxQuantity={max_quantity || 0} |
|
|
|
minQuantity={min_quantity || 0} |
|
|
|
referencePrice={referencePrice} |
|
|
@ -129,7 +126,7 @@ export const App = () => { |
|
|
|
liquidationPrice={liquidationPrice} |
|
|
|
onQuantityChange={(valueString: string) => { |
|
|
|
setUserHasEdited(true); |
|
|
|
setQuantity(parse(valueString)); |
|
|
|
setQuantity(valueString); |
|
|
|
}} |
|
|
|
onLongSubmit={makeNewOrderRequest} |
|
|
|
isLongSubmitting={isCreatingNewOrderRequest} |
|
|
|
|
|
@ -15,6 +15,8 @@ import { |
|
|
|
Grid, |
|
|
|
GridItem, |
|
|
|
HStack, |
|
|
|
InputGroup, |
|
|
|
InputLeftAddon, |
|
|
|
Modal, |
|
|
|
ModalBody, |
|
|
|
ModalCloseButton, |
|
|
@ -281,19 +283,22 @@ function Quantity({ min, max, onChange, quantity }: QuantityProps) { |
|
|
|
return ( |
|
|
|
<FormControl id="quantity"> |
|
|
|
<FormLabel>Quantity</FormLabel> |
|
|
|
<NumberInput |
|
|
|
min={min} |
|
|
|
max={max} |
|
|
|
default={min} |
|
|
|
onChange={onChange} |
|
|
|
value={quantity} |
|
|
|
> |
|
|
|
<NumberInputField /> |
|
|
|
<NumberInputStepper> |
|
|
|
<NumberIncrementStepper /> |
|
|
|
<NumberDecrementStepper /> |
|
|
|
</NumberInputStepper> |
|
|
|
</NumberInput> |
|
|
|
<InputGroup> |
|
|
|
<InputLeftAddon>$</InputLeftAddon> |
|
|
|
<NumberInput |
|
|
|
min={min} |
|
|
|
max={max} |
|
|
|
default={min} |
|
|
|
onChange={onChange} |
|
|
|
value={quantity} |
|
|
|
> |
|
|
|
<NumberInputField /> |
|
|
|
<NumberInputStepper> |
|
|
|
<NumberIncrementStepper /> |
|
|
|
<NumberDecrementStepper /> |
|
|
|
</NumberInputStepper> |
|
|
|
</NumberInput> |
|
|
|
</InputGroup> |
|
|
|
<FormHelperText>How much do you want to buy or sell?</FormHelperText> |
|
|
|
</FormControl> |
|
|
|
); |
|
|
|