@loafmarkets/ui 0.1.240 → 0.1.241

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
@@ -13696,6 +13696,7 @@ function PortfolioActivityPanel({
13696
13696
  tradeHistory = [],
13697
13697
  transfers = [],
13698
13698
  onCancelOrder,
13699
+ onCancelAllOrders,
13699
13700
  onAmendOrder,
13700
13701
  cancellingOrderId = null,
13701
13702
  defaultTab,
@@ -13708,6 +13709,8 @@ function PortfolioActivityPanel({
13708
13709
  const [activeTab, setActiveTab] = useState(resolvedDefaultTab);
13709
13710
  const [activityPage, setActivityPage] = useState(0);
13710
13711
  const [pendingCancelOrderId, setPendingCancelOrderId] = useState(null);
13712
+ const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = useState(false);
13713
+ const [cancellingAll, setCancellingAll] = useState(false);
13711
13714
  const [closeAllOpen, setCloseAllOpen] = useState(false);
13712
13715
  const [closeAllType, setCloseAllType] = useState("market");
13713
13716
  const [posSortKey, setPosSortKey] = useState("asset");
@@ -13947,6 +13950,7 @@ function PortfolioActivityPanel({
13947
13950
  activeTab === "open-orders" && /* @__PURE__ */ jsxs(Fragment, { children: [
13948
13951
  openOrders.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
13949
13952
  openOrders.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
13953
+ onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsx(CancelAllRow, { children: /* @__PURE__ */ jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
13950
13954
  /* @__PURE__ */ jsxs(GridHeader, { $columns: onCancelOrder ? "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 70px" : "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr", children: [
13951
13955
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Asset" }),
13952
13956
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Side" }),
@@ -14096,6 +14100,36 @@ function PortfolioActivityPanel({
14096
14100
  }
14097
14101
  )
14098
14102
  ] }),
14103
+ cancelAllConfirmOpen && /* @__PURE__ */ jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14104
+ /* @__PURE__ */ jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
14105
+ /* @__PURE__ */ jsxs(CancelConfirmBody, { children: [
14106
+ "Are you sure you want to cancel all ",
14107
+ openOrdersCount,
14108
+ " open orders? This action cannot be undone."
14109
+ ] }),
14110
+ /* @__PURE__ */ jsxs(CancelConfirmActions, { children: [
14111
+ /* @__PURE__ */ jsx(CancelConfirmDismiss, { type: "button", onClick: () => setCancelAllConfirmOpen(false), children: "Keep Orders" }),
14112
+ /* @__PURE__ */ jsx(
14113
+ CancelConfirmProceed,
14114
+ {
14115
+ type: "button",
14116
+ disabled: cancellingAll,
14117
+ onClick: async () => {
14118
+ if (onCancelAllOrders) {
14119
+ setCancellingAll(true);
14120
+ try {
14121
+ await onCancelAllOrders();
14122
+ } finally {
14123
+ setCancellingAll(false);
14124
+ }
14125
+ }
14126
+ setCancelAllConfirmOpen(false);
14127
+ },
14128
+ children: cancellingAll ? "Cancelling\u2026" : "Yes, Cancel All"
14129
+ }
14130
+ )
14131
+ ] })
14132
+ ] }) }),
14099
14133
  pendingCancelOrderId !== null && /* @__PURE__ */ jsx(CancelConfirmOverlay, { onClick: () => setPendingCancelOrderId(null), children: /* @__PURE__ */ jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14100
14134
  /* @__PURE__ */ jsx(CancelConfirmTitle, { children: "Cancel Order" }),
14101
14135
  /* @__PURE__ */ jsx(CancelConfirmBody, { children: "Are you sure you want to cancel this order? This action cannot be undone." }),
@@ -14371,6 +14405,33 @@ var CancelButton = styled9.button`
14371
14405
  cursor: not-allowed;
14372
14406
  }
14373
14407
  `;
14408
+ var CancelAllRow = styled9.div`
14409
+ display: flex;
14410
+ justify-content: flex-end;
14411
+ margin-bottom: 0.4rem;
14412
+ `;
14413
+ var CancelAllBtn = styled9.button`
14414
+ background: rgba(246, 70, 93, 0.08);
14415
+ border: 1px solid rgba(246, 70, 93, 0.3);
14416
+ border-radius: 4px;
14417
+ padding: 0.2rem 0.7rem;
14418
+ font-size: 0.62rem;
14419
+ font-weight: 600;
14420
+ color: #f6465d;
14421
+ cursor: pointer;
14422
+ white-space: nowrap;
14423
+ transition: all 0.15s ease;
14424
+
14425
+ &:hover {
14426
+ background: rgba(246, 70, 93, 0.18);
14427
+ border-color: rgba(246, 70, 93, 0.5);
14428
+ }
14429
+
14430
+ &:disabled {
14431
+ opacity: 0.4;
14432
+ cursor: not-allowed;
14433
+ }
14434
+ `;
14374
14435
  var GridHeader = styled9.div`
14375
14436
  display: grid;
14376
14437
  grid-template-columns: ${(p) => p.$columns};