Browse Source
Disable taker's "go long" button under the same conditions as older UI
Disable the button when there's no order or there's an in-flight order request
already.
new-http-api
Mariusz Klochowicz
3 years ago
No known key found for this signature in database
GPG Key ID: 470C865699C8D4D
2 changed files with
9 additions and
2 deletions
-
taker-frontend/src/App.tsx
-
taker-frontend/src/components/Trade.tsx
|
|
@ -167,6 +167,7 @@ export const App = () => { |
|
|
|
}; |
|
|
|
calculateMargin(payload); |
|
|
|
}} |
|
|
|
canSubmit={order != null && !isCreatingNewOrderRequest} |
|
|
|
onLongSubmit={makeNewOrderRequest} |
|
|
|
isSubmitting={isCreatingNewOrderRequest} |
|
|
|
/> |
|
|
|
|
|
@ -55,6 +55,7 @@ interface TradeProps { |
|
|
|
leverage?: number; |
|
|
|
quantity: string; |
|
|
|
liquidationPrice?: number; |
|
|
|
canSubmit: boolean; |
|
|
|
isSubmitting: boolean; |
|
|
|
onQuantityChange: any; |
|
|
|
onLongSubmit: (payload: CfdOrderRequestPayload) => void; |
|
|
@ -71,6 +72,7 @@ const Trade = ( |
|
|
|
margin: marginAsNumber, |
|
|
|
leverage, |
|
|
|
liquidationPrice: liquidationPriceAsNumber, |
|
|
|
canSubmit, |
|
|
|
onLongSubmit, |
|
|
|
order_id, |
|
|
|
}: TradeProps, |
|
|
@ -148,14 +150,18 @@ const Trade = ( |
|
|
|
</GridItem> |
|
|
|
<GridItem colSpan={1}> |
|
|
|
<Center> |
|
|
|
<ButtonGroup variant="solid" padding="3" spacing="6"> |
|
|
|
<ButtonGroup |
|
|
|
variant="solid" |
|
|
|
padding="3" |
|
|
|
spacing="6" |
|
|
|
> |
|
|
|
<Button colorScheme="red" size="lg" disabled h={16}> |
|
|
|
<VStack> |
|
|
|
<Text as="b">Short</Text> |
|
|
|
<Text fontSize={"sm"}>{quantity.replace("$", "")}@{askPrice}</Text> |
|
|
|
</VStack> |
|
|
|
</Button> |
|
|
|
<Button colorScheme="green" size="lg" onClick={onOpen} h={16}> |
|
|
|
<Button disabled={!canSubmit} colorScheme="green" size="lg" onClick={onOpen} h={16}> |
|
|
|
<VStack> |
|
|
|
<Text as="b">Long</Text> |
|
|
|
<Text fontSize={"sm"}>{quantity.replace("$", "")}@{askPrice}</Text> |
|
|
|