From 2efe0a7aa161c5056d5ca327433c687273ddeb40 Mon Sep 17 00:00:00 2001
From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com>
Date: Fri, 22 Mar 2024 19:21:39 +0200
Subject: [PATCH] fix(trading): align checkboxes tp/sl (#6088)
---
.../components/deal-ticket/deal-ticket.tsx | 212 +++++++++---------
1 file changed, 108 insertions(+), 104 deletions(-)
diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
index 2693449ab..6e1accfef 100644
--- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
+++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx
@@ -663,114 +663,79 @@ export const DealTicket = ({
/>
)}
-
- {featureFlags.TAKE_PROFIT_STOP_LOSS && (
-
(
- {t('TP_SL_TOOLTIP', 'Take profit / Stop loss')}
- }
- >
-
-
-
-
- )}
- />
- )}
- (
-
-
- {disableReduceOnlyCheckbox
- ? t(
- '"Reduce only" can be used only with non-persistent orders, such as "Fill or Kill" or "Immediate or Cancel".'
- )
- : t(REDUCE_ONLY_TOOLTIP)}
- {' '}
-
- {t('Find out more')}
-
- >
- }
- >
-
- {
- field.onChange(reduceOnly);
- setValue('postOnly', false);
- }}
- label={t('Reduce only')}
- />
-
-
+
+
+ {featureFlags.TAKE_PROFIT_STOP_LOSS && (
+
(
+ {t('TP_SL_TOOLTIP', 'Take profit / Stop loss')}
+ }
+ >
+
+
+
+
+ )}
+ />
)}
- />
-
- {isLimitType && (
-
-
(
-
- {t(
- 'ICEBERG_TOOLTIP',
- 'Trade only a fraction of the order size at once. After the peak size of the order has traded, the size is reset. This is repeated until the order is cancelled, expires, or its full volume trades away. For example, an iceberg order with a size of 1000 and a peak size of 100 will effectively be split into 10 orders with a size of 100 each. Note that the full volume of the order is not hidden and is still reflected in the order book.'
- )}{' '}
-
- {t('Find out more')}
- {' '}
-
- }
- >
-
-
-
-
- )}
- />
+ {isLimitType && (
+ (
+
+ {t(
+ 'ICEBERG_TOOLTIP',
+ 'Trade only a fraction of the order size at once. After the peak size of the order has traded, the size is reset. This is repeated until the order is cancelled, expires, or its full volume trades away. For example, an iceberg order with a size of 1000 and a peak size of 100 will effectively be split into 10 orders with a size of 100 each. Note that the full volume of the order is not hidden and is still reflected in the order book.'
+ )}{' '}
+
+ {t('Find out more')}
+ {' '}
+
+ }
+ >
+
+
+
+
+ )}
+ />
+ )}
+
+
(
- {disablePostOnlyCheckbox
+ {disableReduceOnlyCheckbox
? t(
- '"Post only" can not be used on "Fill or Kill" or "Immediate or Cancel" orders.'
+ '"Reduce only" can be used only with non-persistent orders, such as "Fill or Kill" or "Immediate or Cancel".'
)
- : t(
- '"Post only" will ensure the order is not filled immediately but is placed on the order book as a passive order. When the order is processed it is either stopped (if it would not be filled immediately), or placed in the order book as a passive order until the price taker matches with it.'
- )}
+ : t(REDUCE_ONLY_TOOLTIP)}
{' '}
{t('Find out more')}
@@ -780,21 +745,60 @@ export const DealTicket = ({
>
{
- field.onChange(postOnly);
- setValue('reduceOnly', false);
+ name="reduce-only"
+ checked={!disableReduceOnlyCheckbox && field.value}
+ disabled={disableReduceOnlyCheckbox}
+ onCheckedChange={(reduceOnly) => {
+ field.onChange(reduceOnly);
+ setValue('postOnly', false);
}}
- label={t('Post only')}
+ label={t('Reduce only')}
/>
)}
/>
+ {isLimitType && (
+ (
+
+
+ {disablePostOnlyCheckbox
+ ? t(
+ '"Post only" can not be used on "Fill or Kill" or "Immediate or Cancel" orders.'
+ )
+ : t(
+ '"Post only" will ensure the order is not filled immediately but is placed on the order book as a passive order. When the order is processed it is either stopped (if it would not be filled immediately), or placed in the order book as a passive order until the price taker matches with it.'
+ )}
+ {' '}
+
+ {t('Find out more')}
+
+ >
+ }
+ >
+
+ {
+ field.onChange(postOnly);
+ setValue('reduceOnly', false);
+ }}
+ label={t('Post only')}
+ />
+
+
+ )}
+ />
+ )}
- )}
+
{isLimitType && iceberg && (