@loafmarkets/ui 0.1.268 → 0.1.270

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,27 @@ 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
+ }));
13726
+ return [...orderHistory, ...mapped].sort((a, b) => b.createdAt - a.createdAt);
13727
+ }, [showSubscriptionsTab, offeringOrders, orderHistory]);
13706
13728
  const activeTabTotal = useMemo(() => {
13707
13729
  switch (activeTab) {
13708
13730
  case "positions":
@@ -13712,7 +13734,7 @@ function PortfolioActivityPanel({
13712
13734
  case "open-orders":
13713
13735
  return openOrders.length;
13714
13736
  case "orders":
13715
- return orderHistory.length;
13737
+ return mergedOrderHistory.length;
13716
13738
  case "trades":
13717
13739
  return tradeHistory.length;
13718
13740
  case "transfers":
@@ -13720,15 +13742,15 @@ function PortfolioActivityPanel({
13720
13742
  default:
13721
13743
  return 0;
13722
13744
  }
13723
- }, [activeTab, positions.length, offeringOrders.length, openOrders.length, orderHistory.length, tradeHistory.length, transfers.length]);
13745
+ }, [activeTab, positions.length, offeringOrders.length, openOrders.length, mergedOrderHistory.length, tradeHistory.length, transfers.length]);
13724
13746
  const positionsCount = positions.length;
13725
13747
  const openOrdersCount = useMemo(
13726
13748
  () => openOrders.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13727
13749
  [openOrders]
13728
13750
  );
13729
13751
  const pendingHistoryCount = useMemo(
13730
- () => orderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13731
- [orderHistory]
13752
+ () => mergedOrderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
13753
+ [mergedOrderHistory]
13732
13754
  );
13733
13755
  const pendingOfferingsCount = useMemo(
13734
13756
  () => offeringOrders.filter((o) => {
@@ -13754,7 +13776,7 @@ function PortfolioActivityPanel({
13754
13776
  ")"
13755
13777
  ] })
13756
13778
  ] }),
13757
- /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
13779
+ showSubscriptionsTab && /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
13758
13780
  "Initial Offerings",
13759
13781
  pendingOfferingsCount > 0 && /* @__PURE__ */ jsxs(TabCount, { children: [
13760
13782
  " (",
@@ -14032,8 +14054,8 @@ function PortfolioActivityPanel({
14032
14054
  ] })
14033
14055
  ] }),
14034
14056
  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: [
14057
+ mergedOrderHistory.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
14058
+ mergedOrderHistory.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
14037
14059
  /* @__PURE__ */ jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14038
14060
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Asset" }),
14039
14061
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Side" }),
@@ -14044,7 +14066,7 @@ function PortfolioActivityPanel({
14044
14066
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Status" }),
14045
14067
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Date" })
14046
14068
  ] }),
14047
- pageSlice(orderHistory).map((order) => {
14069
+ pageSlice(mergedOrderHistory).map((order) => {
14048
14070
  const meta = getOrderStatusMeta(order.status);
14049
14071
  const isMarket = order.type === "MARKET";
14050
14072
  const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
@@ -14201,6 +14223,7 @@ var ContentScroll = styled9.div`
14201
14223
  flex: 1;
14202
14224
  overflow-y: auto;
14203
14225
  min-height: 0;
14226
+ padding-bottom: 1rem;
14204
14227
  scrollbar-width: thin;
14205
14228
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
14206
14229
  &::-webkit-scrollbar { width: 4px; }