@orderly.network/trading 2.8.3 → 2.8.4

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.js CHANGED
@@ -2645,7 +2645,7 @@ var init_fundingRate_ui = __esm({
2645
2645
  }
2646
2646
  ),
2647
2647
  predFundingRate === null ? "--" : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "orderly-flex orderly-gap-1 oui-text-2xs oui-text-base-contrast-36", children: [
2648
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { coloring: true, suffix: "%", dp: 4, children: predFundingRate ?? "--" }),
2648
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { suffix: "%", dp: 4, intensity: 80, children: predFundingRate ?? "--" }),
2649
2649
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: " in" }),
2650
2650
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: " " + countDown })
2651
2651
  ] })
@@ -4973,7 +4973,7 @@ var init_orderBookAndEntry = __esm({
4973
4973
  init_orderBookAndEntry_script();
4974
4974
  }
4975
4975
  });
4976
- var useDataListScript2;
4976
+ var useDataListScript2, getDialogInfo;
4977
4977
  var init_dataList_script2 = __esm({
4978
4978
  "src/components/mobile/dataList/dataList.script.tsx"() {
4979
4979
  init_hooks();
@@ -4987,21 +4987,30 @@ var init_dataList_script2 = __esm({
4987
4987
  const { t } = i18n.useTranslation();
4988
4988
  const { onSymbolChange } = exports.useTradingPageContext();
4989
4989
  const localStorage2 = exports.useTradingLocalStorage();
4990
- const [_, { cancelAllOrders, cancelAllTPSLOrders }] = hooks.useOrderStream({});
4990
+ const [_, { cancelAllPendingOrders, cancelAllTPSLOrders }] = hooks.useOrderStream(
4991
+ {}
4992
+ );
4991
4993
  const { positionCount } = exports.usePositionsCount(symbol);
4992
4994
  const { pendingOrderCount, tpSlOrderCount } = exports.usePendingOrderCount(symbol);
4993
4995
  const onCloseAll = (type) => {
4994
- const title = type === uiOrders.TabType.pending ? t("orders.pending.cancelAll") : type === uiOrders.TabType.tp_sl ? t("orders.tpsl.cancelAll") : "";
4995
- const content = type === uiOrders.TabType.pending ? t("orders.pending.cancelAll.description") : type === uiOrders.TabType.tp_sl ? t("orders.tpsl.cancelAll.description") : "";
4996
+ const { title, content } = getDialogInfo(
4997
+ type,
4998
+ t,
4999
+ localStorage2.showAllSymbol ? void 0 : symbol
5000
+ );
4996
5001
  ui.modal.confirm({
4997
5002
  title,
4998
5003
  content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", children: content }),
4999
5004
  onOk: async () => {
5000
5005
  try {
5001
5006
  if (tab === "TP/SL" /* tp_sl */) {
5002
- await cancelAllTPSLOrders();
5007
+ await cancelAllTPSLOrders(
5008
+ localStorage2.showAllSymbol ? void 0 : symbol
5009
+ );
5003
5010
  } else {
5004
- await cancelAllOrders();
5011
+ await cancelAllPendingOrders(
5012
+ localStorage2.showAllSymbol ? void 0 : symbol
5013
+ );
5005
5014
  }
5006
5015
  return Promise.resolve(true);
5007
5016
  } catch (error) {
@@ -5030,6 +5039,46 @@ var init_dataList_script2 = __esm({
5030
5039
  onSymbolChange
5031
5040
  };
5032
5041
  };
5042
+ getDialogInfo = (type, t, symbol) => {
5043
+ const formattedSymbol = symbol ? utils.formatSymbol(symbol, "base") : symbol;
5044
+ switch (type) {
5045
+ case uiOrders.TabType.pending:
5046
+ if (symbol !== void 0) {
5047
+ return {
5048
+ title: t("orders.pending.cancelAll.forSymbol", {
5049
+ symbol: formattedSymbol
5050
+ }),
5051
+ content: t("orders.pending.cancelAll.forSymbol.description", {
5052
+ symbol: formattedSymbol
5053
+ })
5054
+ };
5055
+ }
5056
+ return {
5057
+ title: t("orders.pending.cancelAll"),
5058
+ content: t("orders.pending.cancelAll.description")
5059
+ };
5060
+ case uiOrders.TabType.tp_sl:
5061
+ if (symbol !== void 0) {
5062
+ return {
5063
+ title: t("orders.tpsl.cancelAll.forSymbol", {
5064
+ symbol: formattedSymbol
5065
+ }),
5066
+ content: t("orders.tpsl.cancelAll.forSymbol.description", {
5067
+ symbol: formattedSymbol
5068
+ })
5069
+ };
5070
+ }
5071
+ return {
5072
+ title: t("orders.tpsl.cancelAll"),
5073
+ content: t("orders.tpsl.cancelAll.description")
5074
+ };
5075
+ default:
5076
+ return {
5077
+ title: "",
5078
+ content: ""
5079
+ };
5080
+ }
5081
+ };
5033
5082
  }
5034
5083
  });
5035
5084
  var LazyPositionHeaderWidget2, SymbolControlHeader, OrdersView, PositionsView2, HistoryTab, DataList2;
@@ -5042,7 +5091,18 @@ var init_dataList_ui2 = __esm({
5042
5091
  })
5043
5092
  );
5044
5093
  SymbolControlHeader = (props) => {
5094
+ const { pendingOrderCount, tpSlOrderCount, type, symbol } = props;
5045
5095
  const { t } = i18n.useTranslation();
5096
+ const cancelAllDisabled = React11.useMemo(() => {
5097
+ if (type === uiOrders.TabType.pending) {
5098
+ return pendingOrderCount === 0;
5099
+ }
5100
+ if (type === uiOrders.TabType.tp_sl) {
5101
+ return tpSlOrderCount === 0;
5102
+ }
5103
+ return false;
5104
+ }, [pendingOrderCount, tpSlOrderCount, type]);
5105
+ const formattedSymbol = props.showAllSymbol ? void 0 : symbol ? utils.formatSymbol(symbol, "base") : symbol;
5046
5106
  return /* @__PURE__ */ jsxRuntime.jsxs(
5047
5107
  ui.Flex,
5048
5108
  {
@@ -5083,7 +5143,8 @@ var init_dataList_ui2 = __esm({
5083
5143
  size: "xs",
5084
5144
  color: "secondary",
5085
5145
  onClick: () => props.onCloseAll(props.type),
5086
- children: t("trading.orders.closeAll")
5146
+ disabled: cancelAllDisabled,
5147
+ children: !props.showAllSymbol ? t("orders.cancelAll.ofSymbol", { symbol: formattedSymbol }) : t("orders.cancelAll")
5087
5148
  }
5088
5149
  )
5089
5150
  ]