@orderly.network/trading 2.8.3-alpha.0 → 2.8.4-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
@@ -7,7 +7,7 @@ import { installExtension, ExtensionPositionEnum, cn, Button, formatAddress, reg
7
7
  import { useTranslation, i18n, Trans } from '@orderly.network/i18n';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { PositionHistoryWidget, LiquidationWidget, PositionsWidget, CloseAllPositionsWidget, MobileLiquidationWidget, MobilePositionsWidget, MobilePositionHistoryWidget } from '@orderly.network/ui-positions';
10
- import { isTestnet, Decimal, commifyOptional, removeTrailingZeros, optimizeSymbolDisplay, getPrecisionByNumber } from '@orderly.network/utils';
10
+ import { isTestnet, Decimal, commifyOptional, removeTrailingZeros, formatSymbol, optimizeSymbolDisplay, getPrecisionByNumber } from '@orderly.network/utils';
11
11
  import { AssetsModule } from '@orderly.network/portfolio';
12
12
  import { AuthGuard } from '@orderly.network/ui-connector';
13
13
  import { OrderEntryWidget, LTVRiskTooltipWidget } from '@orderly.network/ui-order-entry';
@@ -2638,7 +2638,7 @@ var init_fundingRate_ui = __esm({
2638
2638
  }
2639
2639
  ),
2640
2640
  predFundingRate === null ? "--" : /* @__PURE__ */ jsxs("div", { className: "orderly-flex orderly-gap-1 oui-text-2xs oui-text-base-contrast-36", children: [
2641
- /* @__PURE__ */ jsx(Text.numeral, { coloring: true, suffix: "%", dp: 4, children: predFundingRate ?? "--" }),
2641
+ /* @__PURE__ */ jsx(Text.numeral, { suffix: "%", dp: 4, intensity: 80, children: predFundingRate ?? "--" }),
2642
2642
  /* @__PURE__ */ jsx("span", { children: " in" }),
2643
2643
  /* @__PURE__ */ jsx("span", { children: " " + countDown })
2644
2644
  ] })
@@ -4966,7 +4966,7 @@ var init_orderBookAndEntry = __esm({
4966
4966
  init_orderBookAndEntry_script();
4967
4967
  }
4968
4968
  });
4969
- var useDataListScript2;
4969
+ var useDataListScript2, getDialogInfo;
4970
4970
  var init_dataList_script2 = __esm({
4971
4971
  "src/components/mobile/dataList/dataList.script.tsx"() {
4972
4972
  init_hooks();
@@ -4980,21 +4980,30 @@ var init_dataList_script2 = __esm({
4980
4980
  const { t } = useTranslation();
4981
4981
  const { onSymbolChange } = useTradingPageContext();
4982
4982
  const localStorage2 = useTradingLocalStorage();
4983
- const [_, { cancelAllOrders, cancelAllTPSLOrders }] = useOrderStream({});
4983
+ const [_, { cancelAllPendingOrders, cancelAllTPSLOrders }] = useOrderStream(
4984
+ {}
4985
+ );
4984
4986
  const { positionCount } = usePositionsCount(symbol);
4985
4987
  const { pendingOrderCount, tpSlOrderCount } = usePendingOrderCount(symbol);
4986
4988
  const onCloseAll = (type) => {
4987
- const title = type === TabType.pending ? t("orders.pending.cancelAll") : type === TabType.tp_sl ? t("orders.tpsl.cancelAll") : "";
4988
- const content = type === TabType.pending ? t("orders.pending.cancelAll.description") : type === TabType.tp_sl ? t("orders.tpsl.cancelAll.description") : "";
4989
+ const { title, content } = getDialogInfo(
4990
+ type,
4991
+ t,
4992
+ localStorage2.showAllSymbol ? void 0 : symbol
4993
+ );
4989
4994
  modal.confirm({
4990
4995
  title,
4991
4996
  content: /* @__PURE__ */ jsx(Text, { size: "2xs", children: content }),
4992
4997
  onOk: async () => {
4993
4998
  try {
4994
4999
  if (tab === "TP/SL" /* tp_sl */) {
4995
- await cancelAllTPSLOrders();
5000
+ await cancelAllTPSLOrders(
5001
+ localStorage2.showAllSymbol ? void 0 : symbol
5002
+ );
4996
5003
  } else {
4997
- await cancelAllOrders();
5004
+ await cancelAllPendingOrders(
5005
+ localStorage2.showAllSymbol ? void 0 : symbol
5006
+ );
4998
5007
  }
4999
5008
  return Promise.resolve(true);
5000
5009
  } catch (error) {
@@ -5023,6 +5032,46 @@ var init_dataList_script2 = __esm({
5023
5032
  onSymbolChange
5024
5033
  };
5025
5034
  };
5035
+ getDialogInfo = (type, t, symbol) => {
5036
+ const formattedSymbol = symbol ? formatSymbol(symbol, "base") : symbol;
5037
+ switch (type) {
5038
+ case TabType.pending:
5039
+ if (symbol !== void 0) {
5040
+ return {
5041
+ title: t("orders.pending.cancelAll.forSymbol", {
5042
+ symbol: formattedSymbol
5043
+ }),
5044
+ content: t("orders.pending.cancelAll.forSymbol.description", {
5045
+ symbol: formattedSymbol
5046
+ })
5047
+ };
5048
+ }
5049
+ return {
5050
+ title: t("orders.pending.cancelAll"),
5051
+ content: t("orders.pending.cancelAll.description")
5052
+ };
5053
+ case TabType.tp_sl:
5054
+ if (symbol !== void 0) {
5055
+ return {
5056
+ title: t("orders.tpsl.cancelAll.forSymbol", {
5057
+ symbol: formattedSymbol
5058
+ }),
5059
+ content: t("orders.tpsl.cancelAll.forSymbol.description", {
5060
+ symbol: formattedSymbol
5061
+ })
5062
+ };
5063
+ }
5064
+ return {
5065
+ title: t("orders.tpsl.cancelAll"),
5066
+ content: t("orders.tpsl.cancelAll.description")
5067
+ };
5068
+ default:
5069
+ return {
5070
+ title: "",
5071
+ content: ""
5072
+ };
5073
+ }
5074
+ };
5026
5075
  }
5027
5076
  });
5028
5077
  var LazyPositionHeaderWidget2, SymbolControlHeader, OrdersView, PositionsView2, HistoryTab, DataList2;
@@ -5035,7 +5084,18 @@ var init_dataList_ui2 = __esm({
5035
5084
  })
5036
5085
  );
5037
5086
  SymbolControlHeader = (props) => {
5087
+ const { pendingOrderCount, tpSlOrderCount, type, symbol } = props;
5038
5088
  const { t } = useTranslation();
5089
+ const cancelAllDisabled = useMemo(() => {
5090
+ if (type === TabType.pending) {
5091
+ return pendingOrderCount === 0;
5092
+ }
5093
+ if (type === TabType.tp_sl) {
5094
+ return tpSlOrderCount === 0;
5095
+ }
5096
+ return false;
5097
+ }, [pendingOrderCount, tpSlOrderCount, type]);
5098
+ const formattedSymbol = props.showAllSymbol ? void 0 : symbol ? formatSymbol(symbol, "base") : symbol;
5039
5099
  return /* @__PURE__ */ jsxs(
5040
5100
  Flex,
5041
5101
  {
@@ -5076,7 +5136,8 @@ var init_dataList_ui2 = __esm({
5076
5136
  size: "xs",
5077
5137
  color: "secondary",
5078
5138
  onClick: () => props.onCloseAll(props.type),
5079
- children: t("trading.orders.closeAll")
5139
+ disabled: cancelAllDisabled,
5140
+ children: !props.showAllSymbol ? t("orders.cancelAll.ofSymbol", { symbol: formattedSymbol }) : t("orders.cancelAll")
5080
5141
  }
5081
5142
  )
5082
5143
  ]