@loafmarkets/ui 0.1.269 → 0.1.271

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
@@ -13602,6 +13602,7 @@ function EditableField({ value, onCommit, format }) {
13602
13602
  function PortfolioActivityPanel({
13603
13603
  positions = [],
13604
13604
  showPositionsTab = false,
13605
+ showSubscriptionsTab = true,
13605
13606
  onPositionClick,
13606
13607
  onClosePosition,
13607
13608
  offeringOrders = [],
@@ -13620,7 +13621,7 @@ function PortfolioActivityPanel({
13620
13621
  className,
13621
13622
  style
13622
13623
  }) {
13623
- const resolvedDefaultTab = defaultTab ?? (showPositionsTab ? "positions" : "subscriptions");
13624
+ const resolvedDefaultTab = defaultTab ?? (showPositionsTab ? "positions" : showSubscriptionsTab ? "subscriptions" : "orders");
13624
13625
  const [activeTab, setActiveTab] = useState(resolvedDefaultTab);
13625
13626
  const [activityPage, setActivityPage] = useState(0);
13626
13627
  const [pendingCancelOrderId, setPendingCancelOrderId] = useState(null);
@@ -13703,6 +13704,28 @@ function PortfolioActivityPanel({
13703
13704
  setAllExpanded(true);
13704
13705
  }
13705
13706
  };
13707
+ const mergedOrderHistory = useMemo(() => {
13708
+ if (showSubscriptionsTab || offeringOrders.length === 0) return orderHistory;
13709
+ const mapped = offeringOrders.map((o, i) => ({
13710
+ id: o.ipoOrderId ?? -(i + 1),
13711
+ propertyId: 0,
13712
+ tokenName: o.tokenName,
13713
+ side: "BUY",
13714
+ type: "MARKET",
13715
+ timeInForce: "GTC",
13716
+ quantity: o.quantity,
13717
+ price: o.price,
13718
+ status: o.status.toUpperCase() === "ALLOCATED" ? "FILLED" : o.status.toUpperCase(),
13719
+ filledQuantity: o.status.toUpperCase() === "ALLOCATED" || o.status.toUpperCase() === "FILLED" || o.status.toUpperCase() === "CONFIRMED" ? o.quantity : 0,
13720
+ rejectionReason: null,
13721
+ deadline: 0,
13722
+ filledAt: o.status.toUpperCase() === "ALLOCATED" || o.status.toUpperCase() === "FILLED" || o.status.toUpperCase() === "CONFIRMED" ? o.createdAt : null,
13723
+ cancelledAt: null,
13724
+ createdAt: o.createdAt,
13725
+ isOfferingOrder: true
13726
+ }));
13727
+ return [...orderHistory, ...mapped].sort((a, b) => b.createdAt - a.createdAt);
13728
+ }, [showSubscriptionsTab, offeringOrders, orderHistory]);
13706
13729
  const activeTabTotal = useMemo(() => {
13707
13730
  switch (activeTab) {
13708
13731
  case "positions":
@@ -13712,7 +13735,7 @@ function PortfolioActivityPanel({
13712
13735
  case "open-orders":
13713
13736
  return openOrders.length;
13714
13737
  case "orders":
13715
- return orderHistory.length;
13738
+ return mergedOrderHistory.length;
13716
13739
  case "trades":
13717
13740
  return tradeHistory.length;
13718
13741
  case "transfers":
@@ -13720,15 +13743,15 @@ function PortfolioActivityPanel({
13720
13743
  default:
13721
13744
  return 0;
13722
13745
  }
13723
- }, [activeTab, positions.length, offeringOrders.length, openOrders.length, orderHistory.length, tradeHistory.length, transfers.length]);
13746
+ }, [activeTab, positions.length, offeringOrders.length, openOrders.length, mergedOrderHistory.length, tradeHistory.length, transfers.length]);
13724
13747
  const positionsCount = positions.length;
13725
13748
  const openOrdersCount = useMemo(
13726
13749
  () => openOrders.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13727
13750
  [openOrders]
13728
13751
  );
13729
13752
  const pendingHistoryCount = useMemo(
13730
- () => orderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13731
- [orderHistory]
13753
+ () => mergedOrderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13754
+ [mergedOrderHistory]
13732
13755
  );
13733
13756
  const pendingOfferingsCount = useMemo(
13734
13757
  () => offeringOrders.filter((o) => {
@@ -13754,7 +13777,7 @@ function PortfolioActivityPanel({
13754
13777
  ")"
13755
13778
  ] })
13756
13779
  ] }),
13757
- /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
13780
+ showSubscriptionsTab && /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
13758
13781
  "Initial Offerings",
13759
13782
  pendingOfferingsCount > 0 && /* @__PURE__ */ jsxs(TabCount, { children: [
13760
13783
  " (",
@@ -14032,8 +14055,8 @@ function PortfolioActivityPanel({
14032
14055
  ] })
14033
14056
  ] }),
14034
14057
  activeTab === "orders" && /* @__PURE__ */ jsxs(Fragment, { children: [
14035
- orderHistory.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
14036
- orderHistory.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
14058
+ mergedOrderHistory.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
14059
+ mergedOrderHistory.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
14037
14060
  /* @__PURE__ */ jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14038
14061
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Asset" }),
14039
14062
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Side" }),
@@ -14044,14 +14067,15 @@ function PortfolioActivityPanel({
14044
14067
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Status" }),
14045
14068
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Date" })
14046
14069
  ] }),
14047
- pageSlice(orderHistory).map((order) => {
14070
+ pageSlice(mergedOrderHistory).map((order) => {
14048
14071
  const meta = getOrderStatusMeta(order.status);
14049
14072
  const isMarket = order.type === "MARKET";
14050
14073
  const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
14074
+ const typeLabel = order.isOfferingOrder ? "Initial Offering" : prettyLabel(order.type);
14051
14075
  return /* @__PURE__ */ jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14052
14076
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $primary: true, children: order.tokenName }) }),
14053
14077
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
14054
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
14078
+ /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: typeLabel }) }),
14055
14079
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14056
14080
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
14057
14081
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsxs(CellText, { $muted: true, children: [