@loafmarkets/ui 0.1.291 → 0.1.292

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
@@ -13664,7 +13664,6 @@ function PortfolioActivityPanel({
13664
13664
  }) {
13665
13665
  const resolvedDefaultTab = defaultTab ?? (showPositionsTab ? "positions" : showSubscriptionsTab ? "subscriptions" : "orders");
13666
13666
  const [activeTab, setActiveTab] = React5.useState(resolvedDefaultTab);
13667
- const [activityPage, setActivityPage] = React5.useState(0);
13668
13667
  const [pendingCancelOrderId, setPendingCancelOrderId] = React5.useState(null);
13669
13668
  const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = React5.useState(false);
13670
13669
  const [cancellingAll, setCancellingAll] = React5.useState(false);
@@ -13767,7 +13766,7 @@ function PortfolioActivityPanel({
13767
13766
  }));
13768
13767
  return [...orderHistory, ...mapped].sort((a, b) => b.createdAt - a.createdAt);
13769
13768
  }, [showSubscriptionsTab, offeringOrders, orderHistory]);
13770
- const activeTabTotal = React5.useMemo(() => {
13769
+ React5.useMemo(() => {
13771
13770
  switch (activeTab) {
13772
13771
  case "positions":
13773
13772
  return positions.length;
@@ -13801,11 +13800,8 @@ function PortfolioActivityPanel({
13801
13800
  }).length,
13802
13801
  [offeringOrders]
13803
13802
  );
13804
- const activityTotalPages = Math.ceil(activeTabTotal / pageSize);
13805
- const pageSlice = (arr) => arr.slice(activityPage * pageSize, (activityPage + 1) * pageSize);
13806
13803
  const handleTabChange = (tab) => {
13807
13804
  setActiveTab(tab);
13808
- setActivityPage(0);
13809
13805
  };
13810
13806
  return /* @__PURE__ */ jsxRuntime.jsxs(Container3, { className, style, children: [
13811
13807
  /* @__PURE__ */ jsxRuntime.jsx(PanelTitle, { children: "Activity" }),
@@ -13867,7 +13863,7 @@ function PortfolioActivityPanel({
13867
13863
  onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(CToolbarLink, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
13868
13864
  ] })
13869
13865
  ] }),
13870
- pageSlice(sortedPositions).map((pos) => {
13866
+ sortedPositions.map((pos) => {
13871
13867
  const currentValue = pos.quantity * pos.marketPrice;
13872
13868
  const costBasis = pos.quantity * pos.averageEntryPrice;
13873
13869
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
@@ -13961,7 +13957,7 @@ function PortfolioActivityPanel({
13961
13957
  ] }),
13962
13958
  onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
13963
13959
  ] }),
13964
- pageSlice(sortedPositions).map((pos) => {
13960
+ sortedPositions.map((pos) => {
13965
13961
  const currentValue = pos.quantity * pos.marketPrice;
13966
13962
  const costBasis = pos.quantity * pos.averageEntryPrice;
13967
13963
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
@@ -14038,7 +14034,7 @@ function PortfolioActivityPanel({
14038
14034
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14039
14035
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14040
14036
  ] }),
14041
- pageSlice(offeringOrders).map((order) => {
14037
+ offeringOrders.map((order) => {
14042
14038
  const meta = getOrderStatusMeta(order.status);
14043
14039
  return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14044
14040
  /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
@@ -14065,7 +14061,7 @@ function PortfolioActivityPanel({
14065
14061
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14066
14062
  onCancelOrder && /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, {})
14067
14063
  ] }),
14068
- pageSlice(openOrders).map((order) => {
14064
+ openOrders.map((order) => {
14069
14065
  const meta = getOrderStatusMeta(order.status);
14070
14066
  const isMarket = order.type === "MARKET";
14071
14067
  const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
@@ -14110,7 +14106,7 @@ function PortfolioActivityPanel({
14110
14106
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14111
14107
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14112
14108
  ] }),
14113
- pageSlice(mergedOrderHistory).map((order) => {
14109
+ mergedOrderHistory.map((order) => {
14114
14110
  const meta = getOrderStatusMeta(order.status);
14115
14111
  const isMarket = order.type === "MARKET";
14116
14112
  const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
@@ -14143,7 +14139,7 @@ function PortfolioActivityPanel({
14143
14139
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Fee" }),
14144
14140
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14145
14141
  ] }),
14146
- pageSlice(tradeHistory).map((trade) => /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14142
+ tradeHistory.map((trade) => /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14147
14143
  /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: trade.tokenName }) }),
14148
14144
  /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(trade.side), children: sideLabel(trade.side) }) }),
14149
14145
  /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(trade.quantity) }) }),
@@ -14164,7 +14160,7 @@ function PortfolioActivityPanel({
14164
14160
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14165
14161
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14166
14162
  ] }),
14167
- pageSlice(transfers).map((t, idx) => {
14163
+ transfers.map((t, idx) => {
14168
14164
  const isDeposit = t.type === "DEPOSIT";
14169
14165
  const statusMeta = getOrderStatusMeta(t.status);
14170
14166
  return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "0.8fr 1fr 1.5fr 0.8fr 1fr", children: [
@@ -14179,31 +14175,6 @@ function PortfolioActivityPanel({
14179
14175
  ] }, t.blockchainTxHash ?? `transfer-${idx}`);
14180
14176
  })
14181
14177
  ] })
14182
- ] }),
14183
- activityTotalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs(PaginationRow, { children: [
14184
- /* @__PURE__ */ jsxRuntime.jsx(
14185
- PaginationButton,
14186
- {
14187
- type: "button",
14188
- onClick: () => setActivityPage((p) => p - 1),
14189
- disabled: activityPage === 0,
14190
- children: "\u2190 Prev"
14191
- }
14192
- ),
14193
- /* @__PURE__ */ jsxRuntime.jsxs(PaginationLabel, { children: [
14194
- activityPage + 1,
14195
- " / ",
14196
- activityTotalPages
14197
- ] }),
14198
- /* @__PURE__ */ jsxRuntime.jsx(
14199
- PaginationButton,
14200
- {
14201
- type: "button",
14202
- onClick: () => setActivityPage((p) => p + 1),
14203
- disabled: activityPage >= activityTotalPages - 1,
14204
- children: "Next \u2192"
14205
- }
14206
- )
14207
14178
  ] })
14208
14179
  ] }),
14209
14180
  cancelAllConfirmOpen && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
@@ -14418,33 +14389,6 @@ var EmptyState = styled9__default.default.div`
14418
14389
  font-size: 0.8rem;
14419
14390
  color: rgba(255, 255, 255, 0.45);
14420
14391
  `;
14421
- var PaginationRow = styled9__default.default.div`
14422
- display: flex;
14423
- align-items: center;
14424
- justify-content: center;
14425
- gap: 0.75rem;
14426
- margin-top: 1rem;
14427
- padding-top: 1rem;
14428
- border-top: 1px solid rgba(255, 255, 255, 0.06);
14429
- `;
14430
- var PaginationButton = styled9__default.default.button`
14431
- background: transparent;
14432
- border: 1px solid rgba(255, 255, 255, 0.12);
14433
- border-radius: 8px;
14434
- padding: 0.35rem 0.75rem;
14435
- font-size: 0.8rem;
14436
- cursor: pointer;
14437
- color: rgba(255, 255, 255, 0.7);
14438
-
14439
- &:disabled {
14440
- color: rgba(255, 255, 255, 0.2);
14441
- cursor: default;
14442
- }
14443
- `;
14444
- var PaginationLabel = styled9__default.default.span`
14445
- font-size: 0.8rem;
14446
- color: rgba(255, 255, 255, 0.4);
14447
- `;
14448
14392
  var PositionsHeader = styled9__default.default.div`
14449
14393
  display: grid;
14450
14394
  grid-template-columns: ${(p) => p.$hasClose ? "repeat(6, 1fr) minmax(130px, auto)" : "repeat(6, 1fr)"};