@orderly.network/ui-order-entry 2.8.9-alpha.0 → 2.8.10-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4138,8 +4138,11 @@ var OrderEntry = (props) => {
4138
4138
  const soundAlertId = useId();
4139
4139
  const { getErrorMsg } = useOrderEntryFormErrorMsg(validated ? errors : null);
4140
4140
  const buttonLabel = useMemo(() => {
4141
+ if (isMobile && freeCollateral <= 0) {
4142
+ return t("common.deposit");
4143
+ }
4141
4144
  return side === OrderSide.BUY ? t("orderEntry.buyLong") : t("orderEntry.sellShort");
4142
- }, [side, t]);
4145
+ }, [side, t, isMobile, freeCollateral]);
4143
4146
  useEffect(() => {
4144
4147
  if (validated) {
4145
4148
  setErrorMsgVisible(true);
@@ -4411,9 +4414,17 @@ var OrderEntry = (props) => {
4411
4414
  id: "order-entry-submit-button",
4412
4415
  "data-type": OrderSide.BUY,
4413
4416
  className: cn(
4414
- side === OrderSide.BUY ? "orderly-order-entry-submit-button-buy oui-bg-success-darken hover:oui-bg-success-darken/80 active:oui-bg-success-darken/80" : "orderly-order-entry-submit-button-sell oui-bg-danger-darken hover:oui-bg-danger-darken/80 active:oui-bg-danger-darken/80"
4417
+ isMobile && freeCollateral <= 0 ? "oui-bg-primary-darken hover:oui-bg-primary-darken/80 active:oui-bg-primary-darken/80" : side === OrderSide.BUY ? "orderly-order-entry-submit-button-buy oui-bg-success-darken hover:oui-bg-success-darken/80 active:oui-bg-success-darken/80" : "orderly-order-entry-submit-button-sell oui-bg-danger-darken hover:oui-bg-danger-darken/80 active:oui-bg-danger-darken/80"
4415
4418
  ),
4416
- onClick: validateSubmit,
4419
+ onClick: () => {
4420
+ if (isMobile && freeCollateral <= 0) {
4421
+ modal.show("DepositAndWithdrawWithSheetId", {
4422
+ activeTab: "deposit"
4423
+ });
4424
+ } else {
4425
+ validateSubmit();
4426
+ }
4427
+ },
4417
4428
  loading: props.isMutating,
4418
4429
  disabled: !props.canTrade,
4419
4430
  children: buttonLabel