@orderly.network/portfolio 2.10.1-alpha.0 → 2.10.2-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.js CHANGED
@@ -2435,7 +2435,7 @@ var init_assets_ui_desktop = __esm({
2435
2435
  return /* @__PURE__ */ jsxRuntime.jsx(
2436
2436
  ui.Card,
2437
2437
  {
2438
- className: "oui-bg-transparent oui-p-0",
2438
+ className: "oui-bg-transparent oui-p-0 oui-border-none oui-shadow-none",
2439
2439
  classNames: { content: "!oui-pt-0" },
2440
2440
  children: /* @__PURE__ */ jsxRuntime.jsxs(
2441
2441
  ui.Tabs,
@@ -4113,6 +4113,11 @@ var init_useAssetHistory = __esm({
4113
4113
  ignoreAggregation: true
4114
4114
  }
4115
4115
  );
4116
+ const [userStatistics] = hooks.useUserStatistics();
4117
+ const todayVolume = React12.useMemo(
4118
+ () => userStatistics?.perp_trading_volume_last_24_hours ?? 0,
4119
+ [userStatistics]
4120
+ );
4116
4121
  const lastBalanceEventRef = React12.useRef(0);
4117
4122
  const refreshTransferHistory = React12.useCallback(() => {
4118
4123
  const now = Date.now();
@@ -4261,12 +4266,12 @@ var init_useAssetHistory = __esm({
4261
4266
  value = value.sub(inputs.transferHistory.IN).add(inputs.transferHistory.OUT);
4262
4267
  return value.toNumber();
4263
4268
  };
4264
- const calculate = (data2, totalValue2, totalTransferIn2, totalTransferOut2) => {
4269
+ const calculate = (data2, totalValue2, totalTransferIn2, totalTransferOut2, todayVol) => {
4265
4270
  const lastItem2 = data2[data2.length - 1];
4266
4271
  return {
4267
4272
  ...lastItem2,
4268
4273
  date: getUTCStr(today),
4269
- perp_volume: 0,
4274
+ perp_volume: todayVol,
4270
4275
  account_value: totalValue2 !== null ? totalValue2 : lastItem2?.account_value ?? 0,
4271
4276
  pnl: calculateLastPnl({
4272
4277
  lastItem: lastItem2,
@@ -4279,7 +4284,7 @@ var init_useAssetHistory = __esm({
4279
4284
  __isCalculated: true
4280
4285
  };
4281
4286
  };
4282
- const mergeData = (data2, totalValue2, totalTransferIn2, totalTransferOut2) => {
4287
+ const mergeData = (data2, totalValue2, totalTransferIn2, totalTransferOut2, todayVol) => {
4283
4288
  if (!Array.isArray(data2) || data2.length === 0) {
4284
4289
  return data2;
4285
4290
  }
@@ -4287,11 +4292,17 @@ var init_useAssetHistory = __esm({
4287
4292
  return data2;
4288
4293
  }
4289
4294
  return data2.concat([
4290
- calculate(data2, totalValue2, totalTransferIn2, totalTransferOut2)
4295
+ calculate(data2, totalValue2, totalTransferIn2, totalTransferOut2, todayVol)
4291
4296
  ]);
4292
4297
  };
4293
- const calculateData = (data2, realtime, totalValue2, totalTransferIn2, totalTransferOut2) => {
4294
- const _data = !realtime ? data2 : mergeData(data2, totalValue2, totalTransferIn2, totalTransferOut2);
4298
+ const calculateData = (data2, realtime, totalValue2, totalTransferIn2, totalTransferOut2, todayVol) => {
4299
+ const _data = !realtime ? data2 : mergeData(
4300
+ data2,
4301
+ totalValue2,
4302
+ totalTransferIn2,
4303
+ totalTransferOut2,
4304
+ todayVol
4305
+ );
4295
4306
  return _data.slice(Math.max(0, _data.length - periodValue));
4296
4307
  };
4297
4308
  const calculatedData = React12.useMemo(() => {
@@ -4306,7 +4317,8 @@ var init_useAssetHistory = __esm({
4306
4317
  isRealtime,
4307
4318
  totalValue,
4308
4319
  totalTransferIn,
4309
- totalTransferOut
4320
+ totalTransferOut,
4321
+ todayVolume
4310
4322
  );
4311
4323
  }, [
4312
4324
  data,
@@ -4314,10 +4326,9 @@ var init_useAssetHistory = __esm({
4314
4326
  assetHistory,
4315
4327
  isRealtime,
4316
4328
  getIndexPrice,
4317
- // transferOutHistory,
4318
- // transferInHistory,
4319
4329
  totalTransferIn,
4320
- totalTransferOut
4330
+ totalTransferOut,
4331
+ todayVolume
4321
4332
  ]);
4322
4333
  const aggregateValue = React12.useMemo(() => {
4323
4334
  let vol = utils.zero;
@@ -4325,6 +4336,7 @@ var init_useAssetHistory = __esm({
4325
4336
  let roi = utils.zero;
4326
4337
  if (Array.isArray(calculatedData) && calculatedData.length) {
4327
4338
  calculatedData.forEach((d) => {
4339
+ vol = vol.add(d.perp_volume ?? 0);
4328
4340
  pnl = pnl.add(d.pnl);
4329
4341
  });
4330
4342
  const tail = calculatedData[0];
@@ -4338,22 +4350,8 @@ var init_useAssetHistory = __esm({
4338
4350
  );
4339
4351
  }
4340
4352
  }
4341
- if (data.length > 0) {
4342
- for (let i = 0; i < periodValue; i++) {
4343
- const item = data[data.length - 1 - i];
4344
- if (item) {
4345
- vol = vol.add(item.perp_volume ?? 0);
4346
- }
4347
- }
4348
- }
4349
4353
  return { vol: vol.toNumber(), pnl: pnl.toNumber(), roi: roi.toNumber() };
4350
- }, [
4351
- calculatedData,
4352
- data,
4353
- periodValue,
4354
- totalTransferInForROI,
4355
- totalDepositForROI
4356
- ]);
4354
+ }, [calculatedData, data, totalTransferInForROI, totalDepositForROI]);
4357
4355
  const createFakeData = (start, end) => {
4358
4356
  return Array.from({ length: 2 }, (_, i) => {
4359
4357
  const date = dateFns.format(i === 0 ? startDate : /* @__PURE__ */ new Date(), "yyyy-MM-dd");
@@ -4470,7 +4468,7 @@ var init_assetChart = __esm({
4470
4468
  init_assetsChart_ui();
4471
4469
  }
4472
4470
  });
4473
- var LazyPeriodTitle2, PerformanceUI, LabelWithHint, PerformancePnL, CumulativePnlChart;
4471
+ var LazyPeriodTitle2, formatForChart, PerformanceUI, LabelWithHint, PerformancePnL, CumulativePnlChart, DailyVolumeChart, CumulativeVolumeChart;
4474
4472
  var init_performance_ui = __esm({
4475
4473
  "src/pages/overview/performance/performance.ui.tsx"() {
4476
4474
  LazyPeriodTitle2 = React12__default.default.lazy(
@@ -4478,6 +4476,11 @@ var init_performance_ui = __esm({
4478
4476
  return { default: mod.PeriodTitle };
4479
4477
  })
4480
4478
  );
4479
+ formatForChart = (value, dp = 2) => {
4480
+ if (value == null) return 0;
4481
+ const decimal = new utils.Decimal(value);
4482
+ return Number(decimal.toFixed(dp, utils.Decimal.ROUND_DOWN));
4483
+ };
4481
4484
  PerformanceUI = (props) => {
4482
4485
  const {
4483
4486
  periodTypes,
@@ -4611,6 +4614,22 @@ var init_performance_ui = __esm({
4611
4614
  invisible: props.invisible || (props.data?.length ?? 0) <= 2
4612
4615
  }
4613
4616
  )
4617
+ ] }),
4618
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { cols: 2, gap: 4, children: [
4619
+ /* @__PURE__ */ jsxRuntime.jsx(
4620
+ DailyVolumeChart,
4621
+ {
4622
+ data: props.data ?? types.EMPTY_LIST,
4623
+ invisible: props.invisible
4624
+ }
4625
+ ),
4626
+ /* @__PURE__ */ jsxRuntime.jsx(
4627
+ CumulativeVolumeChart,
4628
+ {
4629
+ data: props.data ?? types.EMPTY_LIST,
4630
+ invisible: props.invisible || (props.data?.length ?? 0) <= 2
4631
+ }
4632
+ )
4614
4633
  ] })
4615
4634
  ]
4616
4635
  }
@@ -4642,13 +4661,20 @@ var init_performance_ui = __esm({
4642
4661
  };
4643
4662
  PerformancePnL = (props) => {
4644
4663
  const { t } = i18n.useTranslation();
4664
+ const chartData = React12__default.default.useMemo(
4665
+ () => (props.data ?? []).map((d) => ({
4666
+ ...d,
4667
+ pnl: formatForChart(d.pnl)
4668
+ })),
4669
+ [props.data]
4670
+ );
4645
4671
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mt: 4, height: "188px", children: [
4646
4672
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", size: "sm", className: "oui-mb-3", children: t("portfolio.overview.performance.dailyPnl") }),
4647
4673
  /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { r: "md", className: "oui-h-[188px] oui-border oui-border-line-4", children: /* @__PURE__ */ jsxRuntime.jsx(
4648
4674
  chart.PnLBarChart,
4649
4675
  {
4650
- data: props.data,
4651
- invisible: props.invisible || (props.data?.length ?? 0) <= 2
4676
+ data: chartData,
4677
+ invisible: props.invisible || (chartData?.length ?? 0) <= 2
4652
4678
  }
4653
4679
  ) })
4654
4680
  ] });
@@ -4666,6 +4692,43 @@ var init_performance_ui = __esm({
4666
4692
  ) })
4667
4693
  ] });
4668
4694
  };
4695
+ DailyVolumeChart = (props) => {
4696
+ const { t } = i18n.useTranslation();
4697
+ const volumeData = React12__default.default.useMemo(
4698
+ () => (props.data ?? []).map((d) => ({
4699
+ ...d,
4700
+ volume: formatForChart(d.perp_volume ?? 0)
4701
+ })),
4702
+ [props.data]
4703
+ );
4704
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mt: 4, height: "188px", children: [
4705
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", size: "sm", className: "oui-mb-3", children: t("portfolio.overview.performance.dailyVolume") }),
4706
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { r: "md", className: "oui-h-[188px] oui-border oui-border-line-4", children: /* @__PURE__ */ jsxRuntime.jsx(
4707
+ chart.VolBarChart,
4708
+ {
4709
+ data: volumeData,
4710
+ invisible: props.invisible || volumeData.length <= 2,
4711
+ responsiveContainerProps: {
4712
+ width: "100%",
4713
+ height: 188
4714
+ }
4715
+ }
4716
+ ) })
4717
+ ] });
4718
+ };
4719
+ CumulativeVolumeChart = (props) => {
4720
+ const { t } = i18n.useTranslation();
4721
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mt: 4, children: [
4722
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "div", size: "sm", className: "oui-mb-3", children: t("portfolio.overview.performance.cumulativeVolume") }),
4723
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { r: "md", className: "oui-h-[188px] oui-border oui-border-line-4", children: /* @__PURE__ */ jsxRuntime.jsx(
4724
+ chart.VolumeAreaChart,
4725
+ {
4726
+ data: props.data ?? types.EMPTY_LIST,
4727
+ invisible: props.invisible || (props.data?.length ?? 0) <= 2
4728
+ }
4729
+ ) })
4730
+ ] });
4731
+ };
4669
4732
  }
4670
4733
  });
4671
4734
 
@@ -5323,8 +5386,7 @@ var init_createApiKey = __esm({
5323
5386
  fillRule: "evenodd",
5324
5387
  clipRule: "evenodd",
5325
5388
  d: "M6.99072 2.92981C4.78172 2.92981 2.99072 4.72071 2.99072 6.92981V16.9298C2.99072 19.1389 4.78172 20.9298 6.99072 20.9298H16.9907C19.1997 20.9298 20.9907 19.1389 20.9907 16.9298V6.92981C20.9907 4.72071 19.1997 2.92981 16.9907 2.92981H6.99072ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6584 7.31211C19.1139 7.74546 19.1139 8.47384 18.6584 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z",
5326
- fill: "white",
5327
- fillOpacity: "0.54"
5389
+ className: "oui-fill-base-contrast-54"
5328
5390
  }
5329
5391
  )
5330
5392
  }
@@ -5340,8 +5402,7 @@ var init_createApiKey = __esm({
5340
5402
  "path",
5341
5403
  {
5342
5404
  d: "M6.99072 2.92981C4.78172 2.92981 2.99072 4.72071 2.99072 6.92981V16.9298C2.99072 19.1389 4.78172 20.9298 6.99072 20.9298H16.9907C19.1997 20.9298 20.9907 19.1389 20.9907 16.9298V6.92981C20.9907 4.72071 19.1997 2.92981 16.9907 2.92981H6.99072ZM6.99072 4.92981H16.9907C18.0957 4.92981 18.9907 5.82521 18.9907 6.92981V16.9298C18.9907 18.0344 18.0957 18.9298 16.9907 18.9298H6.99072C5.88572 18.9298 4.99072 18.0344 4.99072 16.9298V6.92981C4.99072 5.82521 5.88572 4.92981 6.99072 4.92981Z",
5343
- fill: "white",
5344
- fillOpacity: "0.54"
5405
+ className: "oui-fill-base-contrast-54"
5345
5406
  }
5346
5407
  )
5347
5408
  }
@@ -6398,6 +6459,13 @@ var PerformanceMobileUI = (props) => {
6398
6459
  { account_value: 0, pnl: 0 },
6399
6460
  { account_value: 500, pnl: 500 }
6400
6461
  );
6462
+ const volumeData = React12__default.default.useMemo(
6463
+ () => (mergedData ?? []).map((d) => ({
6464
+ ...d,
6465
+ volume: d.perp_volume ?? 0
6466
+ })),
6467
+ [mergedData]
6468
+ );
6401
6469
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6402
6470
  /* @__PURE__ */ jsxRuntime.jsxs(
6403
6471
  ui.Tabs,
@@ -6531,6 +6599,38 @@ var PerformanceMobileUI = (props) => {
6531
6599
  }
6532
6600
  )
6533
6601
  }
6602
+ ),
6603
+ /* @__PURE__ */ jsxRuntime.jsx(
6604
+ ui.TabPanel,
6605
+ {
6606
+ value: "dailyVolume",
6607
+ title: t("portfolio.overview.performance.dailyVolume"),
6608
+ className: "oui-min-h-40",
6609
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6610
+ chart.VolBarChart,
6611
+ {
6612
+ data: volumeData,
6613
+ invisible: invisible || (mergedData?.length ?? 0) <= 2,
6614
+ responsiveContainerProps: responsiveProps
6615
+ }
6616
+ )
6617
+ }
6618
+ ),
6619
+ /* @__PURE__ */ jsxRuntime.jsx(
6620
+ ui.TabPanel,
6621
+ {
6622
+ value: "cumulativeVolume",
6623
+ title: t("portfolio.overview.performance.cumulativeVolume"),
6624
+ className: "oui-min-h-40",
6625
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6626
+ chart.VolumeAreaChart,
6627
+ {
6628
+ data: mergedData,
6629
+ invisible: invisible || (mergedData?.length ?? 0) <= 2,
6630
+ responsiveContainerProps: responsiveProps
6631
+ }
6632
+ )
6633
+ }
6534
6634
  )
6535
6635
  ] })
6536
6636
  ] });
@@ -6746,15 +6846,29 @@ var PortfolioChartsMobileUI = (props) => {
6746
6846
  direction: "column",
6747
6847
  children: /* @__PURE__ */ jsxRuntime.jsx(chart.AreaChart, { data: data || types.EMPTY_LIST, width: 160, height: 52, children: !invisible && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6748
6848
  /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: colorId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
6749
- /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#00B49E", offset: "0%", stopOpacity: 0.5 }),
6750
- /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#00B49E", offset: "100%", stopOpacity: 0 })
6849
+ /* @__PURE__ */ jsxRuntime.jsx(
6850
+ "stop",
6851
+ {
6852
+ stopColor: "rgb(var(--oui-color-success))",
6853
+ offset: "0%",
6854
+ stopOpacity: 0.5
6855
+ }
6856
+ ),
6857
+ /* @__PURE__ */ jsxRuntime.jsx(
6858
+ "stop",
6859
+ {
6860
+ stopColor: "rgb(var(--oui-color-success))",
6861
+ offset: "100%",
6862
+ stopOpacity: 0
6863
+ }
6864
+ )
6751
6865
  ] }) }),
6752
6866
  /* @__PURE__ */ jsxRuntime.jsx(
6753
6867
  chart.Area,
6754
6868
  {
6755
6869
  type: "natural",
6756
6870
  dataKey: "account_value",
6757
- stroke: "rgb(41, 233, 169)",
6871
+ stroke: "rgb(var(--oui-color-trading-profit))",
6758
6872
  strokeWidth: 1.5,
6759
6873
  dot: false,
6760
6874
  isAnimationActive: false,
@@ -6787,19 +6901,19 @@ var useCurrentStatus = () => {
6787
6901
  const statusText = {
6788
6902
  wrongNetwork: {
6789
6903
  description: t("connector.wrongNetwork.tooltip"),
6790
- rootClass: "oui-bg-[linear-gradient(15deg,#D25F00_0%,transparent_30%)]"
6904
+ rootClass: "oui-bg-[linear-gradient(15deg,rgb(var(--oui-color-warning-darken))_0%,transparent_30%)]"
6791
6905
  },
6792
6906
  connectWallet: {
6793
6907
  description: t("connector.trade.connectWallet.tooltip"),
6794
- rootClass: "oui-bg-[linear-gradient(15deg,#27FDFE_0%,transparent_30%)]"
6908
+ rootClass: "oui-bg-[linear-gradient(15deg,rgb(var(--oui-gradient-brand-start))_0%,transparent_30%)]"
6795
6909
  },
6796
6910
  notSignedIn: {
6797
6911
  description: t("connector.trade.createAccount.tooltip"),
6798
- rootClass: "oui-bg-[linear-gradient(15deg,#335FFC_0%,transparent_30%)]"
6912
+ rootClass: "oui-bg-[linear-gradient(15deg,rgb(var(--oui-color-primary-darken))_0%,transparent_30%)]"
6799
6913
  },
6800
6914
  disabledTrading: {
6801
6915
  description: t("connector.trade.enableTrading.tooltip"),
6802
- rootClass: "oui-bg-[linear-gradient(15deg,#335FFC_0%,transparent_30%)]"
6916
+ rootClass: "oui-bg-[linear-gradient(15deg,rgb(var(--oui-color-primary-darken))_0%,transparent_30%)]"
6803
6917
  },
6804
6918
  default: {
6805
6919
  description: "",
@@ -6877,7 +6991,7 @@ var EVMChains = () => {
6877
6991
  }
6878
6992
  ) }),
6879
6993
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-left-[-9px] oui-flex oui-items-center oui-justify-center oui-gap-1", children: [
6880
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-[#282e3a]", children: /* @__PURE__ */ jsxRuntime.jsx(EVMChainPopover, { children: /* @__PURE__ */ jsxRuntime.jsx(
6994
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-5", children: /* @__PURE__ */ jsxRuntime.jsx(EVMChainPopover, { children: /* @__PURE__ */ jsxRuntime.jsx(
6881
6995
  MoreIcon,
6882
6996
  {
6883
6997
  className: "oui-relative oui-z-10 oui-size-3 oui-text-base-contrast-54 hover:oui-text-base-contrast",
@@ -6948,9 +7062,9 @@ var ShowAccount = () => {
6948
7062
  const bgClass = React12.useMemo(() => {
6949
7063
  let bg = "";
6950
7064
  if (currentNamespace == types.ChainNamespace.evm) {
6951
- bg = "oui-bg-[linear-gradient(15deg,#283BEE_-11%,transparent_30%,transparent_77%,#A53411_100%)]";
7065
+ bg = "oui-bg-[linear-gradient(15deg,rgb(var(--oui-color-primary))_-11%,transparent_30%,transparent_77%,rgb(var(--oui-color-danger-darken))_100%)]";
6952
7066
  } else if (currentNamespace == types.ChainNamespace.solana) {
6953
- bg = "oui-bg-[linear-gradient(15deg,#7400D0_-11%,transparent_30%,transparent_77%,#009A7E_100%)]";
7067
+ bg = "oui-bg-[linear-gradient(15deg,rgb(var(--oui-color-link))_-11%,transparent_30%,transparent_77%,rgb(var(--oui-color-success))_100%)]";
6954
7068
  }
6955
7069
  return bg;
6956
7070
  }, [currentNamespace]);
@@ -7192,13 +7306,13 @@ var PortfolioValueMobile = (props) => {
7192
7306
  p: 4,
7193
7307
  children: [
7194
7308
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "row", gapX: 1, itemAlign: "center", children: [
7195
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-sm oui-text-base-contrast-54", children: t("portfolio.overview.handle.title") }),
7309
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-sm oui-text-base-static-54", children: t("portfolio.overview.handle.title") }),
7196
7310
  /* @__PURE__ */ jsxRuntime.jsx(
7197
7311
  ui.EyeIcon,
7198
7312
  {
7199
7313
  size: 16,
7200
7314
  className: ui.cn(
7201
- props.canTrade ? "oui-text-base-contrast-54" : "oui-hidden"
7315
+ props.canTrade ? "oui-text-base-static-54" : "oui-hidden"
7202
7316
  ),
7203
7317
  onClick: props.toggleVisible
7204
7318
  }
@@ -7216,11 +7330,11 @@ var PortfolioValueMobile = (props) => {
7216
7330
  ui.Text.numeral,
7217
7331
  {
7218
7332
  visible: props.visible,
7219
- className: "oui-text-3xl oui-font-bold oui-text-base-contrast",
7333
+ className: "oui-text-3xl oui-font-bold oui-text-base-static",
7220
7334
  children: props.portfolioValue ?? "--"
7221
7335
  }
7222
7336
  ),
7223
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base oui-font-bold oui-text-base-contrast-80", children: "USDC" })
7337
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base oui-font-bold oui-text-base-static-80", children: "USDC" })
7224
7338
  ]
7225
7339
  }
7226
7340
  ),
@@ -7230,7 +7344,7 @@ var PortfolioValueMobile = (props) => {
7230
7344
  direction: "row",
7231
7345
  gapX: 1,
7232
7346
  itemAlign: "center",
7233
- className: "oui-text-sm oui-text-base-contrast",
7347
+ className: "oui-text-sm oui-text-base-static",
7234
7348
  children: [
7235
7349
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text.pnl, { visible: props.visible, children: props.unrealPnL ?? "--" }),
7236
7350
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7254,7 +7368,14 @@ var PortfolioValueMobile = (props) => {
7254
7368
  href: "/portfolio/assets" /* Assets */,
7255
7369
  name: "Assets"
7256
7370
  }),
7257
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.ArrowRightShortIcon, { size: 18, color: "white", opacity: 0.54 })
7371
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7372
+ ui.ArrowRightShortIcon,
7373
+ {
7374
+ size: 18,
7375
+ opacity: 0.99,
7376
+ className: "oui-text-base-static"
7377
+ }
7378
+ )
7258
7379
  }
7259
7380
  )
7260
7381
  ]
@@ -7518,7 +7639,7 @@ var FeeTierTable = (props) => {
7518
7639
  return {
7519
7640
  "data-state": "active",
7520
7641
  className: ui.cn(
7521
- "oui-pointer-events-none oui-h-[54px] oui-text-[rgba(0,0,0,0.88)] oui-gradient-brand"
7642
+ "oui-pointer-events-none oui-h-[54px] oui-text-base-contrast-80 oui-gradient-brand"
7522
7643
  ),
7523
7644
  ...config.active
7524
7645
  };
@@ -8019,17 +8140,23 @@ __export(setting_exports, {
8019
8140
  SettingWidget: () => SettingWidget
8020
8141
  });
8021
8142
  var ORDERLY_ORDER_SOUND_ALERT_KEY = "orderly_order_sound_alert";
8143
+ var ORDERLY_ORDER_SOUND_OPTION_KEY = "orderly_order_sound_option";
8022
8144
  var ORDERLY_MWEB_ORDER_ENTRY_SIDE_MARKETS_LAYOUT = "orderly_mweb_order_entry_side_markets_layout";
8023
8145
  var useSettingScript = () => {
8024
- const { data, mutate: refresh } = hooks.useAccountInfo();
8146
+ const { data } = hooks.useAccountInfo();
8025
8147
  const { wrongNetwork, disabledConnect } = reactApp.useAppContext();
8026
- const [update, { isMutating }] = hooks.useMutation("/v1/client/maintenance_config");
8148
+ const [update] = hooks.useMutation("/v1/client/maintenance_config");
8027
8149
  const [checked, setChecked] = React12.useState(false);
8028
8150
  const { notification } = hooks.useOrderlyContext();
8151
+ const { themes, currentThemeId, setCurrentThemeId } = ui.useOrderlyTheme();
8152
+ const soundOptions = notification?.orderFilled?.soundOptions;
8153
+ const hasSoundOptions = Boolean(soundOptions && soundOptions.length > 0);
8154
+ const defaultSoundValue = notification?.orderFilled?.defaultSoundValue ?? soundOptions?.[0]?.value;
8029
8155
  const [soundAlert, setSoundAlert] = hooks.useLocalStorage(
8030
8156
  ORDERLY_ORDER_SOUND_ALERT_KEY,
8031
8157
  notification?.orderFilled?.defaultOpen ?? false
8032
8158
  );
8159
+ const [selectedSoundValue, setSelectedSoundValue] = hooks.useLocalStorage(ORDERLY_ORDER_SOUND_OPTION_KEY, defaultSoundValue ?? null);
8033
8160
  const [orderPanelLayout, setOrderPanelLayout] = hooks.useLocalStorage(
8034
8161
  ORDERLY_MWEB_ORDER_ENTRY_SIDE_MARKETS_LAYOUT,
8035
8162
  "right"
@@ -8063,12 +8190,139 @@ var useSettingScript = () => {
8063
8190
  soundAlert,
8064
8191
  setSoundAlert,
8065
8192
  hasOrderFilledMedia: Boolean(notification?.orderFilled?.media),
8193
+ soundOptions,
8194
+ hasSoundOptions,
8195
+ selectedSoundValue,
8196
+ setSelectedSoundValue,
8066
8197
  orderPanelLayout,
8067
- setOrderPanelLayout
8198
+ setOrderPanelLayout,
8199
+ themes,
8200
+ currentThemeId,
8201
+ setCurrentThemeId
8068
8202
  };
8069
8203
  };
8204
+ var SoundRadioButton = ({
8205
+ sel,
8206
+ label,
8207
+ onCheckChange
8208
+ }) => {
8209
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8210
+ ui.Flex,
8211
+ {
8212
+ onClick: (e) => {
8213
+ onCheckChange();
8214
+ e.stopPropagation();
8215
+ },
8216
+ gap: 1,
8217
+ className: "oui-cursor-pointer",
8218
+ children: [
8219
+ sel ? /* @__PURE__ */ jsxRuntime.jsx(SoundSelIcon, { className: "oui-fill-base-contrast" }) : /* @__PURE__ */ jsxRuntime.jsx(SoundUnselIcon, { className: "oui-fill-base-contrast-54" }),
8220
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: sel ? 98 : 54, children: label })
8221
+ ]
8222
+ }
8223
+ );
8224
+ };
8225
+ var SoundSelIcon = (props) => {
8226
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8227
+ "svg",
8228
+ {
8229
+ width: "16",
8230
+ height: "16",
8231
+ viewBox: "0 0 16 16",
8232
+ fill: "currentColor",
8233
+ xmlns: "http://www.w3.org/2000/svg",
8234
+ className: props.className,
8235
+ children: [
8236
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667" }),
8237
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "3.333" })
8238
+ ]
8239
+ }
8240
+ );
8241
+ };
8242
+ var SoundUnselIcon = (props) => {
8243
+ return /* @__PURE__ */ jsxRuntime.jsx(
8244
+ "svg",
8245
+ {
8246
+ width: "16",
8247
+ height: "16",
8248
+ viewBox: "0 0 16 16",
8249
+ fill: "currentColor",
8250
+ xmlns: "http://www.w3.org/2000/svg",
8251
+ className: props.className,
8252
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667" })
8253
+ }
8254
+ );
8255
+ };
8256
+ var ThemeSettingCard = (props) => {
8257
+ const { t } = i18n.useTranslation();
8258
+ const { themes, currentThemeId, setCurrentThemeId, classNames } = props;
8259
+ if (!themes || themes.length <= 1) {
8260
+ return null;
8261
+ }
8262
+ return /* @__PURE__ */ jsxRuntime.jsx(
8263
+ ui.Card,
8264
+ {
8265
+ title: t("portfolio.setting.theme"),
8266
+ id: "portfolio-theme-setting",
8267
+ classNames: { root: classNames?.card },
8268
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8269
+ ui.Flex,
8270
+ {
8271
+ direction: "row",
8272
+ gap: 4,
8273
+ width: "100%",
8274
+ itemAlign: "center",
8275
+ className: ui.cn(
8276
+ "oui-border-t-2 oui-border-line-6 oui-font-semibold",
8277
+ classNames?.content
8278
+ ),
8279
+ children: themes.length === 2 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "row", itemAlign: "center", gap: 2, children: themes.map((theme) => /* @__PURE__ */ jsxRuntime.jsx(
8280
+ ui.Button,
8281
+ {
8282
+ variant: theme.id === currentThemeId ? "contained" : "outlined",
8283
+ size: "sm",
8284
+ onClick: () => setCurrentThemeId?.(theme.id),
8285
+ children: theme.displayName
8286
+ },
8287
+ theme.id
8288
+ )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
8289
+ ui.Select.options,
8290
+ {
8291
+ value: currentThemeId,
8292
+ onValueChange: (value) => {
8293
+ setCurrentThemeId?.(value);
8294
+ },
8295
+ options: themes.map((theme) => ({
8296
+ value: theme.id,
8297
+ label: theme.displayName
8298
+ })),
8299
+ size: "sm",
8300
+ testid: "oui-testid-setting-theme-select",
8301
+ classNames: { trigger: "oui-min-w-[100px]" }
8302
+ }
8303
+ ) })
8304
+ }
8305
+ )
8306
+ }
8307
+ );
8308
+ };
8070
8309
  var SettingDesktop = (props) => {
8071
8310
  const { t } = i18n.useTranslation();
8311
+ const audioRef = React12.useRef(null);
8312
+ const playPreview = React12.useCallback((media) => {
8313
+ if (!media) return;
8314
+ try {
8315
+ if (!audioRef.current) {
8316
+ audioRef.current = new Audio();
8317
+ }
8318
+ const audio = audioRef.current;
8319
+ audio.pause();
8320
+ audio.currentTime = 0;
8321
+ audio.src = media;
8322
+ void audio.play().catch(() => void 0);
8323
+ } catch {
8324
+ }
8325
+ }, []);
8072
8326
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8073
8327
  /* @__PURE__ */ jsxRuntime.jsx(
8074
8328
  ui.Card,
@@ -8106,7 +8360,7 @@ var SettingDesktop = (props) => {
8106
8360
  )
8107
8361
  }
8108
8362
  ),
8109
- props.hasOrderFilledMedia && /* @__PURE__ */ jsxRuntime.jsx(
8363
+ (props.hasOrderFilledMedia || props.hasSoundOptions) && /* @__PURE__ */ jsxRuntime.jsx(
8110
8364
  ui.Card,
8111
8365
  {
8112
8366
  title: t("portfolio.setting.soundAlerts"),
@@ -8115,35 +8369,65 @@ var SettingDesktop = (props) => {
8115
8369
  children: /* @__PURE__ */ jsxRuntime.jsxs(
8116
8370
  ui.Flex,
8117
8371
  {
8118
- direction: "row",
8119
- gap: 4,
8372
+ direction: "column",
8373
+ gap: 3,
8120
8374
  width: "100%",
8121
- itemAlign: "center",
8122
8375
  pt: 4,
8376
+ itemAlign: "start",
8123
8377
  className: "oui-border-t-2 oui-border-line-6 oui-font-semibold",
8124
8378
  children: [
8125
- /* @__PURE__ */ jsxRuntime.jsx(
8126
- ui.Flex,
8127
- {
8128
- direction: "column",
8129
- itemAlign: "start",
8130
- className: "oui-flex-1",
8131
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 54, size: "sm", children: t("portfolio.setting.soundAlerts.description") })
8132
- }
8133
- ),
8134
- /* @__PURE__ */ jsxRuntime.jsx(uiConnector.AuthGuardTooltip, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
8135
- ui.Switch,
8136
- {
8137
- checked: props.soundAlert,
8138
- onCheckedChange: (checked) => props.setSoundAlert(checked),
8139
- disabled: !props.canTouch,
8140
- "data-testid": "oui-testid-setting-sound-switch-btn"
8141
- }
8142
- ) })
8379
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "row", gap: 4, width: "100%", itemAlign: "center", children: [
8380
+ /* @__PURE__ */ jsxRuntime.jsx(
8381
+ ui.Flex,
8382
+ {
8383
+ direction: "column",
8384
+ itemAlign: "start",
8385
+ className: "oui-flex-1",
8386
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 54, size: "sm", children: t("portfolio.setting.soundAlerts.description") })
8387
+ }
8388
+ ),
8389
+ /* @__PURE__ */ jsxRuntime.jsx(uiConnector.AuthGuardTooltip, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
8390
+ ui.Switch,
8391
+ {
8392
+ checked: props.soundAlert,
8393
+ onCheckedChange: (checked) => props.setSoundAlert(checked),
8394
+ disabled: !props.canTouch,
8395
+ "data-testid": "oui-testid-setting-sound-switch-btn"
8396
+ }
8397
+ ) })
8398
+ ] }),
8399
+ props.hasSoundOptions && props.soundOptions?.length && props.soundAlert && /* @__PURE__ */ jsxRuntime.jsx(uiConnector.AuthGuardTooltip, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "row", gap: 3, className: "oui-cursor-pointer", children: props.soundOptions.map((option) => {
8400
+ const sel = props.selectedSoundValue === option.value;
8401
+ return /* @__PURE__ */ jsxRuntime.jsx(
8402
+ SoundRadioButton,
8403
+ {
8404
+ sel,
8405
+ label: option.label,
8406
+ onCheckChange: () => {
8407
+ props.setSelectedSoundValue(option.value);
8408
+ props.setSoundAlert(Boolean(option.media));
8409
+ playPreview(option.media);
8410
+ }
8411
+ },
8412
+ option.value
8413
+ );
8414
+ }) }) })
8143
8415
  ]
8144
8416
  }
8145
8417
  )
8146
8418
  }
8419
+ ),
8420
+ /* @__PURE__ */ jsxRuntime.jsx(
8421
+ ThemeSettingCard,
8422
+ {
8423
+ themes: props.themes,
8424
+ currentThemeId: props.currentThemeId,
8425
+ setCurrentThemeId: props.setCurrentThemeId,
8426
+ classNames: {
8427
+ card: "oui-bg-base-9 oui-font-semibold oui-mt-3",
8428
+ content: "oui-pt-4"
8429
+ }
8430
+ }
8147
8431
  )
8148
8432
  ] });
8149
8433
  };
@@ -8153,6 +8437,21 @@ var SettingMobile = (props) => {
8153
8437
  const onLanguageChange = () => {
8154
8438
  setOpen(true);
8155
8439
  };
8440
+ const audioRef = React12.useRef(null);
8441
+ const playPreview = React12.useCallback((media) => {
8442
+ if (!media) return;
8443
+ try {
8444
+ if (!audioRef.current) {
8445
+ audioRef.current = new Audio();
8446
+ }
8447
+ const audio = audioRef.current;
8448
+ audio.pause();
8449
+ audio.currentTime = 0;
8450
+ audio.src = media;
8451
+ void audio.play().catch(() => void 0);
8452
+ } catch {
8453
+ }
8454
+ }, []);
8156
8455
  const renderItem = (position) => {
8157
8456
  const isSelected = props.orderPanelLayout === position;
8158
8457
  const handleClick = () => props.setOrderPanelLayout(position);
@@ -8297,7 +8596,7 @@ var SettingMobile = (props) => {
8297
8596
  )
8298
8597
  }
8299
8598
  ),
8300
- props.hasOrderFilledMedia && /* @__PURE__ */ jsxRuntime.jsx(
8599
+ (props.hasOrderFilledMedia || props.hasSoundOptions) && /* @__PURE__ */ jsxRuntime.jsx(
8301
8600
  ui.Card,
8302
8601
  {
8303
8602
  title: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-sm", children: t("portfolio.setting.soundAlerts") }),
@@ -8332,7 +8631,23 @@ var SettingMobile = (props) => {
8332
8631
  disabled: !props.canTouch,
8333
8632
  "data-testid": "oui-testid-setting-sound-switch-btn"
8334
8633
  }
8335
- ) })
8634
+ ) }),
8635
+ props.hasSoundOptions && props.soundOptions?.length && props.soundAlert && /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "row", gap: 3, wrap: "wrap", children: props.soundOptions.map((option) => {
8636
+ const sel = props.selectedSoundValue === option.value;
8637
+ return /* @__PURE__ */ jsxRuntime.jsx(
8638
+ SoundRadioButton,
8639
+ {
8640
+ sel,
8641
+ label: option.label,
8642
+ onCheckChange: () => {
8643
+ props.setSelectedSoundValue(option.value);
8644
+ props.setSoundAlert(Boolean(option.media));
8645
+ playPreview(option.media);
8646
+ }
8647
+ },
8648
+ option.value
8649
+ );
8650
+ }) })
8336
8651
  ]
8337
8652
  }
8338
8653
  )
@@ -8340,6 +8655,18 @@ var SettingMobile = (props) => {
8340
8655
  )
8341
8656
  }
8342
8657
  ),
8658
+ /* @__PURE__ */ jsxRuntime.jsx(
8659
+ ThemeSettingCard,
8660
+ {
8661
+ themes: props.themes,
8662
+ currentThemeId: props.currentThemeId,
8663
+ setCurrentThemeId: props.setCurrentThemeId,
8664
+ classNames: {
8665
+ card: "oui-mt-2 oui-bg-base-9 oui-font-semibold oui-p-3",
8666
+ content: "oui-pt-3"
8667
+ }
8668
+ }
8669
+ ),
8343
8670
  /* @__PURE__ */ jsxRuntime.jsx(
8344
8671
  ui.Card,
8345
8672
  {
@@ -8372,10 +8699,11 @@ var EmptyBlockIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
8372
8699
  width: "50",
8373
8700
  height: "80",
8374
8701
  viewBox: "0 0 50 80",
8375
- fill: "none",
8702
+ fill: "currentColor",
8703
+ className: "oui-fill-base-7",
8376
8704
  xmlns: "http://www.w3.org/2000/svg",
8377
8705
  ...props,
8378
- children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "50", height: "80", rx: "2", fill: "#181C23" })
8706
+ children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "50", height: "80", rx: "2" })
8379
8707
  }
8380
8708
  );
8381
8709
  var OrderEntryStripIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -8388,10 +8716,40 @@ var OrderEntryStripIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
8388
8716
  xmlns: "http://www.w3.org/2000/svg",
8389
8717
  ...props,
8390
8718
  children: [
8391
- /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "50", height: "80", rx: "2", fill: "#181C23" }),
8392
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "3", width: "21", height: "11", rx: "2", fill: "#008676" }),
8393
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "26", y: "3", width: "21", height: "11", rx: "2", fill: "#D92D6B" }),
8394
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "69", width: "44", height: "8", rx: "2", fill: "#008676" })
8719
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "50", height: "80", rx: "2", fill: "rgb(var(--oui-color-base-7))" }),
8720
+ /* @__PURE__ */ jsxRuntime.jsx(
8721
+ "rect",
8722
+ {
8723
+ x: "3",
8724
+ y: "3",
8725
+ width: "21",
8726
+ height: "11",
8727
+ rx: "2",
8728
+ fill: "rgb(var(--oui-color-success-darken))"
8729
+ }
8730
+ ),
8731
+ /* @__PURE__ */ jsxRuntime.jsx(
8732
+ "rect",
8733
+ {
8734
+ x: "26",
8735
+ y: "3",
8736
+ width: "21",
8737
+ height: "11",
8738
+ rx: "2",
8739
+ fill: "rgb(var(--oui-color-danger-darken))"
8740
+ }
8741
+ ),
8742
+ /* @__PURE__ */ jsxRuntime.jsx(
8743
+ "rect",
8744
+ {
8745
+ x: "3",
8746
+ y: "69",
8747
+ width: "44",
8748
+ height: "8",
8749
+ rx: "2",
8750
+ fill: "rgb(var(--oui-color-success-darken))"
8751
+ }
8752
+ )
8395
8753
  ]
8396
8754
  }
8397
8755
  );
@@ -8658,7 +9016,7 @@ init_assets_ui_desktop();
8658
9016
  // src/pages/assets/assetsPage/assets.ui.mobile.tsx
8659
9017
  init_assets_ui_desktop();
8660
9018
  var AccountTag = ({ name }) => {
8661
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-2 oui-flex oui-h-[18px] oui-w-fit oui-items-center oui-rounded oui-bg-white/[0.06] oui-px-2 oui-text-2xs oui-font-semibold oui-text-base-contrast-36", children: name });
9019
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-2 oui-flex oui-h-[18px] oui-w-fit oui-items-center oui-rounded oui-bg-base-contrast-6 oui-px-2 oui-text-2xs oui-font-semibold oui-text-base-contrast-36", children: name });
8662
9020
  };
8663
9021
  var AssetMobileItem = (props) => {
8664
9022
  const { item } = props;
@@ -8853,7 +9211,7 @@ var AssetMobileItem = (props) => {
8853
9211
  });
8854
9212
  },
8855
9213
  className: ui.cn(
8856
- "oui-flex-1 oui-border-white/[0.36] oui-text-base-contrast-54"
9214
+ "oui-flex-1 oui-border-base-contrast-36 oui-text-base-contrast-54"
8857
9215
  ),
8858
9216
  children: t("transfer.convert")
8859
9217
  }
@@ -8872,7 +9230,7 @@ var AssetMobileItem = (props) => {
8872
9230
  });
8873
9231
  },
8874
9232
  className: ui.cn(
8875
- "oui-flex-1 oui-border-white/[0.36] oui-text-base-contrast-54"
9233
+ "oui-flex-1 oui-border-base-contrast-36 oui-text-base-contrast-54"
8876
9234
  ),
8877
9235
  children: t("common.transfer")
8878
9236
  }