@loafmarkets/ui 0.1.101 → 0.1.103

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
@@ -9695,7 +9695,7 @@ function AssetSelectorBar({
9695
9695
  const isCurrent = item.tokenName === currentTokenName;
9696
9696
  const status = item.status?.toUpperCase();
9697
9697
  const statusLabel = status === "PENDING" ? "Coming Soon" : status === "CLOSED" ? "Closed" : status === "CANCELLED" ? "Cancelled" : null;
9698
- return /* @__PURE__ */ jsxs(
9698
+ return /* @__PURE__ */ jsx(
9699
9699
  IPOOption,
9700
9700
  {
9701
9701
  onClick: () => {
@@ -9706,16 +9706,19 @@ function AssetSelectorBar({
9706
9706
  },
9707
9707
  $selected: isCurrent,
9708
9708
  style: { cursor: isCurrent ? "default" : "pointer" },
9709
- children: [
9710
- /* @__PURE__ */ jsxs(IPOOptionName, { children: [
9711
- item.streetAddress,
9712
- item.ticker ? ` (${item.ticker})` : ""
9713
- ] }),
9714
- /* @__PURE__ */ jsxs(IPOOptionLocation, { children: [
9715
- item.suburb,
9716
- statusLabel && /* @__PURE__ */ jsx("span", { children: statusLabel })
9709
+ children: /* @__PURE__ */ jsxs(IPOOptionInner, { children: [
9710
+ item.imageUrl && /* @__PURE__ */ jsx(IPOOptionThumb, { src: item.imageUrl, alt: item.streetAddress }),
9711
+ /* @__PURE__ */ jsxs("div", { children: [
9712
+ /* @__PURE__ */ jsxs(IPOOptionName, { children: [
9713
+ item.streetAddress,
9714
+ item.ticker ? ` (${item.ticker})` : ""
9715
+ ] }),
9716
+ /* @__PURE__ */ jsxs(IPOOptionLocation, { children: [
9717
+ item.suburb,
9718
+ statusLabel && /* @__PURE__ */ jsx("span", { children: statusLabel })
9719
+ ] })
9717
9720
  ] })
9718
- ]
9721
+ ] })
9719
9722
  },
9720
9723
  item.tokenName
9721
9724
  );
@@ -9902,6 +9905,19 @@ var IPOOption = styled25.div`
9902
9905
  &:hover { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, transparent 100%); }
9903
9906
  ${(p) => p.$selected && `background: linear-gradient(90deg, rgba(56,97,251,0.15) 0%, transparent 100%);`}
9904
9907
  `;
9908
+ var IPOOptionInner = styled25.div`
9909
+ display: flex;
9910
+ align-items: center;
9911
+ gap: 1rem;
9912
+ `;
9913
+ var IPOOptionThumb = styled25.img`
9914
+ width: 36px;
9915
+ height: 36px;
9916
+ border-radius: 6px;
9917
+ object-fit: cover;
9918
+ flex-shrink: 0;
9919
+ border: 1px solid rgba(255, 255, 255, 0.08);
9920
+ `;
9905
9921
  var IPOOptionName = styled25.div`
9906
9922
  font-weight: 600;
9907
9923
  font-size: 1rem;
@@ -11845,6 +11861,7 @@ function PortfolioActivityPanel({
11845
11861
  positions = [],
11846
11862
  showPositionsTab = false,
11847
11863
  onPositionClick,
11864
+ onClosePosition,
11848
11865
  offeringOrders = [],
11849
11866
  openOrders = [],
11850
11867
  orderHistory = [],
@@ -11943,13 +11960,14 @@ function PortfolioActivityPanel({
11943
11960
  activeTab === "positions" && showPositionsTab && /* @__PURE__ */ jsxs(Fragment, { children: [
11944
11961
  positions.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No positions yet. Subscribe to an offering or buy on the secondary market." }),
11945
11962
  positions.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
11946
- /* @__PURE__ */ jsxs(PositionsHeader, { children: [
11963
+ /* @__PURE__ */ jsxs(PositionsHeader, { $hasClose: !!onClosePosition, children: [
11947
11964
  /* @__PURE__ */ jsx(PositionsHeaderCell, { children: "Asset" }),
11948
11965
  /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "Size" }),
11949
11966
  /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "Value" }),
11950
11967
  /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "Entry Price" }),
11951
11968
  /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "Mark Price" }),
11952
- /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "PNL (%)" })
11969
+ /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "PNL (%)" }),
11970
+ onClosePosition && /* @__PURE__ */ jsx(PositionsHeaderCell, { $align: "right", children: "Close" })
11953
11971
  ] }),
11954
11972
  pageSlice(positions).map((pos) => {
11955
11973
  const currentValue = pos.quantity * pos.marketPrice;
@@ -11957,7 +11975,7 @@ function PortfolioActivityPanel({
11957
11975
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
11958
11976
  const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
11959
11977
  const isPositive = pnl >= 0;
11960
- return /* @__PURE__ */ jsxs(PositionsRow, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: [
11978
+ return /* @__PURE__ */ jsxs(PositionsRow, { $hasClose: !!onClosePosition, onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: [
11961
11979
  /* @__PURE__ */ jsx(PositionsCell, { children: /* @__PURE__ */ jsx(HoldingsProperty, { children: pos.tokenName }) }),
11962
11980
  /* @__PURE__ */ jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatNumber2(pos.quantity) }) }),
11963
11981
  /* @__PURE__ */ jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatCurrency5(currentValue) }) }),
@@ -11973,7 +11991,17 @@ function PortfolioActivityPanel({
11973
11991
  pnlPercent.toFixed(1),
11974
11992
  "%"
11975
11993
  ] })
11976
- ] })
11994
+ ] }),
11995
+ onClosePosition && /* @__PURE__ */ jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsxs(CloseActions, { children: [
11996
+ /* @__PURE__ */ jsx(CloseBtn2, { onClick: (e) => {
11997
+ e.stopPropagation();
11998
+ onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice);
11999
+ }, children: "Limit" }),
12000
+ /* @__PURE__ */ jsx(CloseBtn2, { onClick: (e) => {
12001
+ e.stopPropagation();
12002
+ onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice);
12003
+ }, children: "Market" })
12004
+ ] }) })
11977
12005
  ] }, pos.tokenName);
11978
12006
  })
11979
12007
  ] })
@@ -12360,7 +12388,7 @@ var PaginationLabel = styled25.span`
12360
12388
  `;
12361
12389
  var PositionsHeader = styled25.div`
12362
12390
  display: grid;
12363
- grid-template-columns: 1.2fr 0.8fr 1fr 1fr 1fr 1.2fr;
12391
+ grid-template-columns: ${(p) => p.$hasClose ? "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr auto" : "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr"};
12364
12392
  gap: 0 0.5rem;
12365
12393
  padding: 0.4rem 0.5rem;
12366
12394
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
@@ -12374,7 +12402,7 @@ var PositionsHeaderCell = styled25.div`
12374
12402
  `;
12375
12403
  var PositionsRow = styled25.div`
12376
12404
  display: grid;
12377
- grid-template-columns: 1.2fr 0.8fr 1fr 1fr 1fr 1.2fr;
12405
+ grid-template-columns: ${(p) => p.$hasClose ? "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr auto" : "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr"};
12378
12406
  align-items: center;
12379
12407
  gap: 0 0.5rem;
12380
12408
  padding: 0.5rem 0.5rem;
@@ -12497,6 +12525,28 @@ var CancelConfirmProceed = styled25.button`
12497
12525
  cursor: not-allowed;
12498
12526
  }
12499
12527
  `;
12528
+ var CloseActions = styled25.div`
12529
+ display: flex;
12530
+ gap: 0.35rem;
12531
+ align-items: center;
12532
+ `;
12533
+ var CloseBtn2 = styled25.button`
12534
+ background: transparent;
12535
+ border: 1px solid rgba(246, 70, 93, 0.25);
12536
+ border-radius: 4px;
12537
+ padding: 0.15rem 0.5rem;
12538
+ font-size: 0.62rem;
12539
+ font-weight: 600;
12540
+ color: #f6465d;
12541
+ cursor: pointer;
12542
+ white-space: nowrap;
12543
+ transition: all 0.15s ease;
12544
+
12545
+ &:hover {
12546
+ background: rgba(246, 70, 93, 0.1);
12547
+ border-color: rgba(246, 70, 93, 0.5);
12548
+ }
12549
+ `;
12500
12550
  function NewsOrdersSection({ newsItems, newsConnectionStatus, activityData }) {
12501
12551
  return /* @__PURE__ */ jsxs(Row2, { children: [
12502
12552
  /* @__PURE__ */ jsx(