@loafmarkets/ui 0.1.266 → 0.1.268

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
@@ -13807,362 +13807,364 @@ function PortfolioActivityPanel({
13807
13807
  /* @__PURE__ */ jsxRuntime.jsx(Tab, { $active: activeTab === "trades", onClick: () => handleTabChange("trades"), children: "Trade History" }),
13808
13808
  /* @__PURE__ */ jsxRuntime.jsx(Tab, { $active: activeTab === "transfers", onClick: () => handleTabChange("transfers"), children: "Transfers" })
13809
13809
  ] }),
13810
- activeTab === "positions" && showPositionsTab && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13811
- positions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No positions yet. Subscribe to an offering or buy on the secondary market." }),
13812
- positions.length > 0 && compactPositions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13813
- /* @__PURE__ */ jsxRuntime.jsxs(CToolbar, { children: [
13814
- /* @__PURE__ */ jsxRuntime.jsxs(CSortWrap, { children: [
13815
- /* @__PURE__ */ jsxRuntime.jsxs(CSortBtn, { onClick: () => setSortDropdownOpen((v) => !v), children: [
13816
- "Sort by: ",
13817
- sortKeyLabel(posSortKey),
13818
- " \u25BE"
13810
+ /* @__PURE__ */ jsxRuntime.jsxs(ContentScroll, { children: [
13811
+ activeTab === "positions" && showPositionsTab && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13812
+ positions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No positions yet. Subscribe to an offering or buy on the secondary market." }),
13813
+ positions.length > 0 && compactPositions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13814
+ /* @__PURE__ */ jsxRuntime.jsxs(CToolbar, { children: [
13815
+ /* @__PURE__ */ jsxRuntime.jsxs(CSortWrap, { children: [
13816
+ /* @__PURE__ */ jsxRuntime.jsxs(CSortBtn, { onClick: () => setSortDropdownOpen((v) => !v), children: [
13817
+ "Sort by: ",
13818
+ sortKeyLabel(posSortKey),
13819
+ " \u25BE"
13820
+ ] }),
13821
+ sortDropdownOpen && /* @__PURE__ */ jsxRuntime.jsx(CSortDropdown, { children: sortKeys.map((k) => /* @__PURE__ */ jsxRuntime.jsx(CSortOption, { $active: posSortKey === k, onClick: () => {
13822
+ setPosSortKey(k);
13823
+ setPosSortAsc(true);
13824
+ setSortDropdownOpen(false);
13825
+ }, children: sortKeyLabel(k) }, k)) })
13819
13826
  ] }),
13820
- sortDropdownOpen && /* @__PURE__ */ jsxRuntime.jsx(CSortDropdown, { children: sortKeys.map((k) => /* @__PURE__ */ jsxRuntime.jsx(CSortOption, { $active: posSortKey === k, onClick: () => {
13821
- setPosSortKey(k);
13822
- setPosSortAsc(true);
13823
- setSortDropdownOpen(false);
13824
- }, children: sortKeyLabel(k) }, k)) })
13827
+ /* @__PURE__ */ jsxRuntime.jsxs(CToolbarActions, { children: [
13828
+ /* @__PURE__ */ jsxRuntime.jsx(CToolbarLink, { onClick: toggleExpandAll, children: allExpanded ? "Collapse All" : "Expand All" }),
13829
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(CToolbarLink, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
13830
+ ] })
13825
13831
  ] }),
13826
- /* @__PURE__ */ jsxRuntime.jsxs(CToolbarActions, { children: [
13827
- /* @__PURE__ */ jsxRuntime.jsx(CToolbarLink, { onClick: toggleExpandAll, children: allExpanded ? "Collapse All" : "Expand All" }),
13828
- onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(CToolbarLink, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
13829
- ] })
13830
- ] }),
13831
- pageSlice(sortedPositions).map((pos) => {
13832
- const currentValue = pos.quantity * pos.marketPrice;
13833
- const costBasis = pos.quantity * pos.averageEntryPrice;
13834
- const pnl = pos.propertyPnl ?? currentValue - costBasis;
13835
- const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13836
- const isPositive = pnl >= 0;
13837
- const posExpanded = expandedPositions.has(pos.tokenName) || allExpanded;
13838
- const ticker = pos.tokenName.toUpperCase().slice(0, 7);
13839
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13840
- /* @__PURE__ */ jsxRuntime.jsxs(CRow, { $expanded: posExpanded, onClick: () => togglePosition(pos.tokenName), children: [
13841
- /* @__PURE__ */ jsxRuntime.jsxs(CAssetCell, { onClick: (e) => {
13842
- e.stopPropagation();
13843
- onPositionClick?.(pos.tokenName, pos.isIpoAllocation);
13844
- }, children: [
13845
- /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "Asset" }),
13846
- /* @__PURE__ */ jsxRuntime.jsxs(CAssetName, { children: [
13847
- pos.imageUrl && /* @__PURE__ */ jsxRuntime.jsx(CAssetLogo, { src: pos.imageUrl, alt: "" }),
13848
- pos.tokenName
13849
- ] })
13832
+ pageSlice(sortedPositions).map((pos) => {
13833
+ const currentValue = pos.quantity * pos.marketPrice;
13834
+ const costBasis = pos.quantity * pos.averageEntryPrice;
13835
+ const pnl = pos.propertyPnl ?? currentValue - costBasis;
13836
+ const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13837
+ const isPositive = pnl >= 0;
13838
+ const posExpanded = expandedPositions.has(pos.tokenName) || allExpanded;
13839
+ const ticker = pos.tokenName.toUpperCase().slice(0, 7);
13840
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13841
+ /* @__PURE__ */ jsxRuntime.jsxs(CRow, { $expanded: posExpanded, onClick: () => togglePosition(pos.tokenName), children: [
13842
+ /* @__PURE__ */ jsxRuntime.jsxs(CAssetCell, { onClick: (e) => {
13843
+ e.stopPropagation();
13844
+ onPositionClick?.(pos.tokenName, pos.isIpoAllocation);
13845
+ }, children: [
13846
+ /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "Asset" }),
13847
+ /* @__PURE__ */ jsxRuntime.jsxs(CAssetName, { children: [
13848
+ pos.imageUrl && /* @__PURE__ */ jsxRuntime.jsx(CAssetLogo, { src: pos.imageUrl, alt: "" }),
13849
+ pos.tokenName
13850
+ ] })
13851
+ ] }),
13852
+ /* @__PURE__ */ jsxRuntime.jsxs(CUnitsCell, { children: [
13853
+ /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "Units" }),
13854
+ formatNumber2(pos.quantity, pos.quantity >= 100 ? 0 : 2),
13855
+ " ",
13856
+ ticker
13857
+ ] }),
13858
+ /* @__PURE__ */ jsxRuntime.jsxs(CPnlCell, { children: [
13859
+ /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "PNL (%)" }),
13860
+ /* @__PURE__ */ jsxRuntime.jsxs(CPnlValue, { $positive: isPositive, children: [
13861
+ isPositive ? "+" : "-",
13862
+ formatCurrency4(Math.abs(pnl))
13863
+ ] }),
13864
+ /* @__PURE__ */ jsxRuntime.jsxs(CPnlPct, { $positive: isPositive, children: [
13865
+ "(",
13866
+ isPositive ? "+" : "",
13867
+ pnlPercent.toFixed(1),
13868
+ "%)"
13869
+ ] })
13870
+ ] }),
13871
+ /* @__PURE__ */ jsxRuntime.jsx(CChevronWrap, { $open: posExpanded, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "rgba(255,255,255,0.5)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 9 12 15 18 9" }) }) })
13850
13872
  ] }),
13851
- /* @__PURE__ */ jsxRuntime.jsxs(CUnitsCell, { children: [
13852
- /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "Units" }),
13853
- formatNumber2(pos.quantity, pos.quantity >= 100 ? 0 : 2),
13873
+ posExpanded && /* @__PURE__ */ jsxRuntime.jsxs(CExpandedWrap, { children: [
13874
+ /* @__PURE__ */ jsxRuntime.jsxs(CDetailGrid, { children: [
13875
+ /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13876
+ /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Position Value" }),
13877
+ /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }) })
13878
+ ] }),
13879
+ /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13880
+ /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Avg Price" }),
13881
+ /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(pos.averageEntryPrice) })
13882
+ ] }),
13883
+ /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13884
+ /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Current Price" }),
13885
+ /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(pos.marketPrice) })
13886
+ ] })
13887
+ ] }),
13888
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsxs(CActionRow, { children: [
13889
+ /* @__PURE__ */ jsxRuntime.jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice), children: "Market Sell" }),
13890
+ /* @__PURE__ */ jsxRuntime.jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice), children: "Limit Sell" })
13891
+ ] })
13892
+ ] })
13893
+ ] }, pos.tokenName);
13894
+ })
13895
+ ] }),
13896
+ positions.length > 0 && !compactPositions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13897
+ /* @__PURE__ */ jsxRuntime.jsxs(PositionsHeader, { $hasClose: !!onClosePosition, children: [
13898
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "asset", onClick: () => handlePosSort("asset"), children: [
13899
+ "Asset ",
13900
+ posSortKey === "asset" && (posSortAsc ? "\u2191" : "\u2193")
13901
+ ] }),
13902
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "units", onClick: () => handlePosSort("units"), children: [
13903
+ "Units ",
13904
+ posSortKey === "units" && (posSortAsc ? "\u2191" : "\u2193")
13905
+ ] }),
13906
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "value", onClick: () => handlePosSort("value"), children: [
13907
+ "Position Value ",
13908
+ posSortKey === "value" && (posSortAsc ? "\u2191" : "\u2193")
13909
+ ] }),
13910
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "avgPrice", onClick: () => handlePosSort("avgPrice"), children: [
13911
+ "Avg Price ",
13912
+ posSortKey === "avgPrice" && (posSortAsc ? "\u2191" : "\u2193")
13913
+ ] }),
13914
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "currentPrice", onClick: () => handlePosSort("currentPrice"), children: [
13915
+ "Current Price ",
13916
+ posSortKey === "currentPrice" && (posSortAsc ? "\u2191" : "\u2193")
13917
+ ] }),
13918
+ /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "pnl", onClick: () => handlePosSort("pnl"), children: [
13919
+ "PNL (%) ",
13920
+ posSortKey === "pnl" && (posSortAsc ? "\u2191" : "\u2193")
13921
+ ] }),
13922
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
13923
+ ] }),
13924
+ pageSlice(sortedPositions).map((pos) => {
13925
+ const currentValue = pos.quantity * pos.marketPrice;
13926
+ const costBasis = pos.quantity * pos.averageEntryPrice;
13927
+ const pnl = pos.propertyPnl ?? currentValue - costBasis;
13928
+ const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13929
+ const isPositive = pnl >= 0;
13930
+ return /* @__PURE__ */ jsxRuntime.jsxs(PositionsRow, { $hasClose: !!onClosePosition, children: [
13931
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx(HoldingsPropertyLink, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: pos.tokenName }) }),
13932
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
13933
+ formatNumber2(pos.quantity),
13854
13934
  " ",
13855
- ticker
13856
- ] }),
13857
- /* @__PURE__ */ jsxRuntime.jsxs(CPnlCell, { children: [
13858
- /* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "PNL (%)" }),
13859
- /* @__PURE__ */ jsxRuntime.jsxs(CPnlValue, { $positive: isPositive, children: [
13935
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: pos.tokenName.toUpperCase() })
13936
+ ] }) }),
13937
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
13938
+ formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }),
13939
+ " ",
13940
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: "USD" })
13941
+ ] }) }),
13942
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.7)", fontSize: "0.8rem" }, children: formatCurrency4(pos.averageEntryPrice) }) }),
13943
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatCurrency4(pos.marketPrice) }) }),
13944
+ /* @__PURE__ */ jsxRuntime.jsxs(PositionsCell, { children: [
13945
+ /* @__PURE__ */ jsxRuntime.jsxs(PnLAmount, { $positive: isPositive, children: [
13860
13946
  isPositive ? "+" : "-",
13861
13947
  formatCurrency4(Math.abs(pnl))
13862
13948
  ] }),
13863
- /* @__PURE__ */ jsxRuntime.jsxs(CPnlPct, { $positive: isPositive, children: [
13864
- "(",
13949
+ /* @__PURE__ */ jsxRuntime.jsxs(PnLPercentage, { $positive: isPositive, children: [
13865
13950
  isPositive ? "+" : "",
13866
13951
  pnlPercent.toFixed(1),
13867
- "%)"
13868
- ] })
13869
- ] }),
13870
- /* @__PURE__ */ jsxRuntime.jsx(CChevronWrap, { $open: posExpanded, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "rgba(255,255,255,0.5)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "6 9 12 15 18 9" }) }) })
13871
- ] }),
13872
- posExpanded && /* @__PURE__ */ jsxRuntime.jsxs(CExpandedWrap, { children: [
13873
- /* @__PURE__ */ jsxRuntime.jsxs(CDetailGrid, { children: [
13874
- /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13875
- /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Position Value" }),
13876
- /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }) })
13877
- ] }),
13878
- /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13879
- /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Avg Price" }),
13880
- /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(pos.averageEntryPrice) })
13881
- ] }),
13882
- /* @__PURE__ */ jsxRuntime.jsxs(CDetailItem, { children: [
13883
- /* @__PURE__ */ jsxRuntime.jsx(CDLabel, { children: "Current Price" }),
13884
- /* @__PURE__ */ jsxRuntime.jsx(CDValue, { children: formatCurrency4(pos.marketPrice) })
13952
+ "%"
13885
13953
  ] })
13886
13954
  ] }),
13887
- onClosePosition && /* @__PURE__ */ jsxRuntime.jsxs(CActionRow, { children: [
13888
- /* @__PURE__ */ jsxRuntime.jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice), children: "Market Sell" }),
13889
- /* @__PURE__ */ jsxRuntime.jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice), children: "Limit Sell" })
13890
- ] })
13891
- ] })
13892
- ] }, pos.tokenName);
13893
- })
13894
- ] }),
13895
- positions.length > 0 && !compactPositions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13896
- /* @__PURE__ */ jsxRuntime.jsxs(PositionsHeader, { $hasClose: !!onClosePosition, children: [
13897
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "asset", onClick: () => handlePosSort("asset"), children: [
13898
- "Asset ",
13899
- posSortKey === "asset" && (posSortAsc ? "\u2191" : "\u2193")
13900
- ] }),
13901
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "units", onClick: () => handlePosSort("units"), children: [
13902
- "Units ",
13903
- posSortKey === "units" && (posSortAsc ? "\u2191" : "\u2193")
13955
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CloseActions, { children: [
13956
+ /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
13957
+ e.stopPropagation();
13958
+ onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice);
13959
+ }, children: "Market Sell" }),
13960
+ /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
13961
+ e.stopPropagation();
13962
+ onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice);
13963
+ }, children: "Limit Sell" })
13964
+ ] }) })
13965
+ ] }, pos.tokenName);
13966
+ })
13967
+ ] }),
13968
+ positions.length > 0 && closeAllOpen && onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(CloseAllOverlay, { onClick: () => setCloseAllOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CloseAllModal, { onClick: (e) => e.stopPropagation(), children: [
13969
+ /* @__PURE__ */ jsxRuntime.jsx(CloseAllModalX, { onClick: () => setCloseAllOpen(false), children: "\xD7" }),
13970
+ /* @__PURE__ */ jsxRuntime.jsx(CloseAllTitle, { children: "Confirm Sell All" }),
13971
+ /* @__PURE__ */ jsxRuntime.jsx(CloseAllDesc, { children: "This will sell all your positions and cancel their associated TP/SL orders." }),
13972
+ /* @__PURE__ */ jsxRuntime.jsxs(CloseAllOption, { onClick: () => setCloseAllType("market"), children: [
13973
+ /* @__PURE__ */ jsxRuntime.jsx(CloseAllRadio, { $selected: closeAllType === "market" }),
13974
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Market Sell" })
13904
13975
  ] }),
13905
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "value", onClick: () => handlePosSort("value"), children: [
13906
- "Position Value ",
13907
- posSortKey === "value" && (posSortAsc ? "\u2191" : "\u2193")
13976
+ /* @__PURE__ */ jsxRuntime.jsxs(CloseAllOption, { onClick: () => setCloseAllType("limit"), children: [
13977
+ /* @__PURE__ */ jsxRuntime.jsx(CloseAllRadio, { $selected: closeAllType === "limit" }),
13978
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Limit Sell at Mid Price" })
13908
13979
  ] }),
13909
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "avgPrice", onClick: () => handlePosSort("avgPrice"), children: [
13910
- "Avg Price ",
13911
- posSortKey === "avgPrice" && (posSortAsc ? "\u2191" : "\u2193")
13980
+ /* @__PURE__ */ jsxRuntime.jsxs(CloseAllConfirmBtn, { onClick: () => {
13981
+ positions.forEach((pos) => onClosePosition(pos.tokenName, closeAllType, pos.quantity, pos.marketPrice));
13982
+ setCloseAllOpen(false);
13983
+ }, children: [
13984
+ "Confirm ",
13985
+ closeAllType === "market" ? "Market" : "Limit",
13986
+ " Sell"
13987
+ ] })
13988
+ ] }) })
13989
+ ] }),
13990
+ activeTab === "subscriptions" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13991
+ offeringOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "IPO allocations will appear here once you subscribe." }),
13992
+ offeringOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13993
+ /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
13994
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
13995
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
13996
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
13997
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Total" }),
13998
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
13999
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
13912
14000
  ] }),
13913
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "currentPrice", onClick: () => handlePosSort("currentPrice"), children: [
13914
- "Current Price ",
13915
- posSortKey === "currentPrice" && (posSortAsc ? "\u2191" : "\u2193")
14001
+ pageSlice(offeringOrders).map((order) => {
14002
+ const meta = getOrderStatusMeta(order.status);
14003
+ return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14004
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14005
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14006
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatCurrency4(order.price) }) }),
14007
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(order.price * order.quantity) }) }),
14008
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14009
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) })
14010
+ ] }, `${order.tokenName}-${order.txHash}-${order.createdAt}`);
14011
+ })
14012
+ ] })
14013
+ ] }),
14014
+ activeTab === "open-orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14015
+ openOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
14016
+ openOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14017
+ onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(CancelAllRow, { children: /* @__PURE__ */ jsxRuntime.jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
14018
+ /* @__PURE__ */ jsxRuntime.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: [
14019
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14020
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14021
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14022
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14023
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14024
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Filled" }),
14025
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14026
+ onCancelOrder && /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, {})
13916
14027
  ] }),
13917
- /* @__PURE__ */ jsxRuntime.jsxs(SortableHeaderCell, { $active: posSortKey === "pnl", onClick: () => handlePosSort("pnl"), children: [
13918
- "PNL (%) ",
13919
- posSortKey === "pnl" && (posSortAsc ? "\u2191" : "\u2193")
14028
+ pageSlice(openOrders).map((order) => {
14029
+ const meta = getOrderStatusMeta(order.status);
14030
+ const isMarket = order.type === "MARKET";
14031
+ const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
14032
+ const isCancelling = cancellingOrderId === order.id;
14033
+ return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $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: [
14034
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14035
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
14036
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
14037
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: onAmendOrder ? /* @__PURE__ */ jsxRuntime.jsx(EditableField, { value: order.quantity, format: formatNumber2, onCommit: (v) => onAmendOrder(order.id, { quantity: v }) }) : /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14038
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: !isMarket && order.price && onAmendOrder ? /* @__PURE__ */ jsxRuntime.jsx(EditableField, { value: order.price, format: (v) => formatCurrency4(v), onCommit: (v) => onAmendOrder(order.id, { price: v }) }) : /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
14039
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $muted: true, children: [
14040
+ filledPercent,
14041
+ "%"
14042
+ ] }) }),
14043
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14044
+ onCancelOrder && /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(
14045
+ CancelButton,
14046
+ {
14047
+ type: "button",
14048
+ disabled: isCancelling || cancellingOrderId != null,
14049
+ onClick: (e) => {
14050
+ e.stopPropagation();
14051
+ setPendingCancelOrderId(order.id);
14052
+ },
14053
+ children: isCancelling ? "\u2026" : "Cancel"
14054
+ }
14055
+ ) })
14056
+ ] }, `open-${order.id}`);
14057
+ })
14058
+ ] })
14059
+ ] }),
14060
+ activeTab === "orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14061
+ orderHistory.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
14062
+ orderHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14063
+ /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14064
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14065
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14066
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14067
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14068
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14069
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Filled" }),
14070
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14071
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
13920
14072
  ] }),
13921
- onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
13922
- ] }),
13923
- pageSlice(sortedPositions).map((pos) => {
13924
- const currentValue = pos.quantity * pos.marketPrice;
13925
- const costBasis = pos.quantity * pos.averageEntryPrice;
13926
- const pnl = pos.propertyPnl ?? currentValue - costBasis;
13927
- const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13928
- const isPositive = pnl >= 0;
13929
- return /* @__PURE__ */ jsxRuntime.jsxs(PositionsRow, { $hasClose: !!onClosePosition, children: [
13930
- /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx(HoldingsPropertyLink, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: pos.tokenName }) }),
13931
- /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
13932
- formatNumber2(pos.quantity),
13933
- " ",
13934
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: pos.tokenName.toUpperCase() })
13935
- ] }) }),
13936
- /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
13937
- formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }),
13938
- " ",
13939
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: "USD" })
13940
- ] }) }),
13941
- /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.7)", fontSize: "0.8rem" }, children: formatCurrency4(pos.averageEntryPrice) }) }),
13942
- /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatCurrency4(pos.marketPrice) }) }),
13943
- /* @__PURE__ */ jsxRuntime.jsxs(PositionsCell, { children: [
13944
- /* @__PURE__ */ jsxRuntime.jsxs(PnLAmount, { $positive: isPositive, children: [
13945
- isPositive ? "+" : "-",
13946
- formatCurrency4(Math.abs(pnl))
13947
- ] }),
13948
- /* @__PURE__ */ jsxRuntime.jsxs(PnLPercentage, { $positive: isPositive, children: [
13949
- isPositive ? "+" : "",
13950
- pnlPercent.toFixed(1),
14073
+ pageSlice(orderHistory).map((order) => {
14074
+ const meta = getOrderStatusMeta(order.status);
14075
+ const isMarket = order.type === "MARKET";
14076
+ const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
14077
+ return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14078
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14079
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
14080
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
14081
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14082
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
14083
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $muted: true, children: [
14084
+ filledPercent,
13951
14085
  "%"
13952
- ] })
13953
- ] }),
13954
- onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CloseActions, { children: [
13955
- /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
13956
- e.stopPropagation();
13957
- onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice);
13958
- }, children: "Market Sell" }),
13959
- /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
13960
- e.stopPropagation();
13961
- onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice);
13962
- }, children: "Limit Sell" })
13963
- ] }) })
13964
- ] }, pos.tokenName);
13965
- })
14086
+ ] }) }),
14087
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14088
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) })
14089
+ ] }, order.id);
14090
+ })
14091
+ ] })
13966
14092
  ] }),
13967
- positions.length > 0 && closeAllOpen && onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(CloseAllOverlay, { onClick: () => setCloseAllOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CloseAllModal, { onClick: (e) => e.stopPropagation(), children: [
13968
- /* @__PURE__ */ jsxRuntime.jsx(CloseAllModalX, { onClick: () => setCloseAllOpen(false), children: "\xD7" }),
13969
- /* @__PURE__ */ jsxRuntime.jsx(CloseAllTitle, { children: "Confirm Sell All" }),
13970
- /* @__PURE__ */ jsxRuntime.jsx(CloseAllDesc, { children: "This will sell all your positions and cancel their associated TP/SL orders." }),
13971
- /* @__PURE__ */ jsxRuntime.jsxs(CloseAllOption, { onClick: () => setCloseAllType("market"), children: [
13972
- /* @__PURE__ */ jsxRuntime.jsx(CloseAllRadio, { $selected: closeAllType === "market" }),
13973
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Market Sell" })
13974
- ] }),
13975
- /* @__PURE__ */ jsxRuntime.jsxs(CloseAllOption, { onClick: () => setCloseAllType("limit"), children: [
13976
- /* @__PURE__ */ jsxRuntime.jsx(CloseAllRadio, { $selected: closeAllType === "limit" }),
13977
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Limit Sell at Mid Price" })
13978
- ] }),
13979
- /* @__PURE__ */ jsxRuntime.jsxs(CloseAllConfirmBtn, { onClick: () => {
13980
- positions.forEach((pos) => onClosePosition(pos.tokenName, closeAllType, pos.quantity, pos.marketPrice));
13981
- setCloseAllOpen(false);
13982
- }, children: [
13983
- "Confirm ",
13984
- closeAllType === "market" ? "Market" : "Limit",
13985
- " Sell"
14093
+ activeTab === "trades" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14094
+ tradeHistory.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Completed trades will appear here." }),
14095
+ tradeHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14096
+ /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14097
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14098
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14099
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14100
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14101
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Total" }),
14102
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Fee" }),
14103
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14104
+ ] }),
14105
+ pageSlice(tradeHistory).map((trade) => /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14106
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: trade.tokenName }) }),
14107
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(trade.side), children: sideLabel(trade.side) }) }),
14108
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(trade.quantity) }) }),
14109
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(trade.price) }) }),
14110
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(trade.price * trade.quantity) }) }),
14111
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatCurrency4(trade.fee) }) }),
14112
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(trade.executedAt) }) })
14113
+ ] }, trade.tradeId))
13986
14114
  ] })
13987
- ] }) })
13988
- ] }),
13989
- activeTab === "subscriptions" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13990
- offeringOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "IPO allocations will appear here once you subscribe." }),
13991
- offeringOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13992
- /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
13993
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
13994
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
13995
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
13996
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Total" }),
13997
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
13998
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
13999
- ] }),
14000
- pageSlice(offeringOrders).map((order) => {
14001
- const meta = getOrderStatusMeta(order.status);
14002
- return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14003
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14004
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14005
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatCurrency4(order.price) }) }),
14006
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(order.price * order.quantity) }) }),
14007
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14008
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) })
14009
- ] }, `${order.tokenName}-${order.txHash}-${order.createdAt}`);
14010
- })
14011
- ] })
14012
- ] }),
14013
- activeTab === "open-orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14014
- openOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
14015
- openOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14016
- onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(CancelAllRow, { children: /* @__PURE__ */ jsxRuntime.jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
14017
- /* @__PURE__ */ jsxRuntime.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: [
14018
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14019
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14020
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14021
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14022
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14023
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Filled" }),
14024
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14025
- onCancelOrder && /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, {})
14026
- ] }),
14027
- pageSlice(openOrders).map((order) => {
14028
- const meta = getOrderStatusMeta(order.status);
14029
- const isMarket = order.type === "MARKET";
14030
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
14031
- const isCancelling = cancellingOrderId === order.id;
14032
- return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $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: [
14033
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14034
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
14035
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
14036
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: onAmendOrder ? /* @__PURE__ */ jsxRuntime.jsx(EditableField, { value: order.quantity, format: formatNumber2, onCommit: (v) => onAmendOrder(order.id, { quantity: v }) }) : /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14037
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: !isMarket && order.price && onAmendOrder ? /* @__PURE__ */ jsxRuntime.jsx(EditableField, { value: order.price, format: (v) => formatCurrency4(v), onCommit: (v) => onAmendOrder(order.id, { price: v }) }) : /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
14038
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $muted: true, children: [
14039
- filledPercent,
14040
- "%"
14041
- ] }) }),
14042
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14043
- onCancelOrder && /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(
14044
- CancelButton,
14045
- {
14046
- type: "button",
14047
- disabled: isCancelling || cancellingOrderId != null,
14048
- onClick: (e) => {
14049
- e.stopPropagation();
14050
- setPendingCancelOrderId(order.id);
14051
- },
14052
- children: isCancelling ? "\u2026" : "Cancel"
14053
- }
14054
- ) })
14055
- ] }, `open-${order.id}`);
14056
- })
14057
- ] })
14058
- ] }),
14059
- activeTab === "orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14060
- orderHistory.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
14061
- orderHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14062
- /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14063
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14064
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14065
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14066
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14067
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14068
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Filled" }),
14069
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14070
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14071
- ] }),
14072
- pageSlice(orderHistory).map((order) => {
14073
- const meta = getOrderStatusMeta(order.status);
14074
- const isMarket = order.type === "MARKET";
14075
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
14076
- return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
14077
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
14078
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
14079
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
14080
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
14081
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
14082
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $muted: true, children: [
14083
- filledPercent,
14084
- "%"
14085
- ] }) }),
14086
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
14087
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) })
14088
- ] }, order.id);
14089
- })
14090
- ] })
14091
- ] }),
14092
- activeTab === "trades" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14093
- tradeHistory.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Completed trades will appear here." }),
14094
- tradeHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14095
- /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14096
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
14097
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
14098
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Qty" }),
14099
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Price" }),
14100
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Total" }),
14101
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Fee" }),
14102
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14103
- ] }),
14104
- pageSlice(tradeHistory).map((trade) => /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.8fr 1fr 1fr 0.8fr 1fr", children: [
14105
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: trade.tokenName }) }),
14106
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: sideLabel(trade.side), children: sideLabel(trade.side) }) }),
14107
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(trade.quantity) }) }),
14108
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(trade.price) }) }),
14109
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatCurrency4(trade.price * trade.quantity) }) }),
14110
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatCurrency4(trade.fee) }) }),
14111
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(trade.executedAt) }) })
14112
- ] }, trade.tradeId))
14113
- ] })
14114
- ] }),
14115
- activeTab === "transfers" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14116
- transfers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Deposits and withdrawals will appear here." }),
14117
- transfers.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14118
- /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "0.8fr 1fr 1.5fr 0.8fr 1fr", children: [
14119
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14120
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Amount" }),
14121
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Address" }),
14122
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14123
- /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14115
+ ] }),
14116
+ activeTab === "transfers" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14117
+ transfers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Deposits and withdrawals will appear here." }),
14118
+ transfers.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14119
+ /* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "0.8fr 1fr 1.5fr 0.8fr 1fr", children: [
14120
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Type" }),
14121
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Amount" }),
14122
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Address" }),
14123
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
14124
+ /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
14125
+ ] }),
14126
+ pageSlice(transfers).map((t, idx) => {
14127
+ const isDeposit = t.type === "DEPOSIT";
14128
+ const statusMeta = getOrderStatusMeta(t.status);
14129
+ return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "0.8fr 1fr 1.5fr 0.8fr 1fr", children: [
14130
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: isDeposit ? "Buy" : "Sell", children: isDeposit ? "Deposit" : "Withdraw" }) }),
14131
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $color: isDeposit ? "#0ecb81" : "#f6465d", children: [
14132
+ isDeposit ? "+" : "-",
14133
+ formatCurrency4(t.amount)
14134
+ ] }) }),
14135
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatAddress(t.address) }) }),
14136
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: statusMeta.color, $bg: statusMeta.bg, children: prettyLabel(t.status) }) }),
14137
+ /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(t.createdAt) }) })
14138
+ ] }, t.blockchainTxHash ?? `transfer-${idx}`);
14139
+ })
14140
+ ] })
14141
+ ] }),
14142
+ activityTotalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs(PaginationRow, { children: [
14143
+ /* @__PURE__ */ jsxRuntime.jsx(
14144
+ PaginationButton,
14145
+ {
14146
+ type: "button",
14147
+ onClick: () => setActivityPage((p) => p - 1),
14148
+ disabled: activityPage === 0,
14149
+ children: "\u2190 Prev"
14150
+ }
14151
+ ),
14152
+ /* @__PURE__ */ jsxRuntime.jsxs(PaginationLabel, { children: [
14153
+ activityPage + 1,
14154
+ " / ",
14155
+ activityTotalPages
14124
14156
  ] }),
14125
- pageSlice(transfers).map((t, idx) => {
14126
- const isDeposit = t.type === "DEPOSIT";
14127
- const statusMeta = getOrderStatusMeta(t.status);
14128
- return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "0.8fr 1fr 1.5fr 0.8fr 1fr", children: [
14129
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SideBadge, { $side: isDeposit ? "Buy" : "Sell", children: isDeposit ? "Deposit" : "Withdraw" }) }),
14130
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $color: isDeposit ? "#0ecb81" : "#f6465d", children: [
14131
- isDeposit ? "+" : "-",
14132
- formatCurrency4(t.amount)
14133
- ] }) }),
14134
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatAddress(t.address) }) }),
14135
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityTag, { $color: statusMeta.color, $bg: statusMeta.bg, children: prettyLabel(t.status) }) }),
14136
- /* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: formatTimestamp(t.createdAt) }) })
14137
- ] }, t.blockchainTxHash ?? `transfer-${idx}`);
14138
- })
14157
+ /* @__PURE__ */ jsxRuntime.jsx(
14158
+ PaginationButton,
14159
+ {
14160
+ type: "button",
14161
+ onClick: () => setActivityPage((p) => p + 1),
14162
+ disabled: activityPage >= activityTotalPages - 1,
14163
+ children: "Next \u2192"
14164
+ }
14165
+ )
14139
14166
  ] })
14140
14167
  ] }),
14141
- activityTotalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs(PaginationRow, { children: [
14142
- /* @__PURE__ */ jsxRuntime.jsx(
14143
- PaginationButton,
14144
- {
14145
- type: "button",
14146
- onClick: () => setActivityPage((p) => p - 1),
14147
- disabled: activityPage === 0,
14148
- children: "\u2190 Prev"
14149
- }
14150
- ),
14151
- /* @__PURE__ */ jsxRuntime.jsxs(PaginationLabel, { children: [
14152
- activityPage + 1,
14153
- " / ",
14154
- activityTotalPages
14155
- ] }),
14156
- /* @__PURE__ */ jsxRuntime.jsx(
14157
- PaginationButton,
14158
- {
14159
- type: "button",
14160
- onClick: () => setActivityPage((p) => p + 1),
14161
- disabled: activityPage >= activityTotalPages - 1,
14162
- children: "Next \u2192"
14163
- }
14164
- )
14165
- ] }),
14166
14168
  cancelAllConfirmOpen && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14167
14169
  /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
14168
14170
  /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmBody, { children: [
@@ -14217,6 +14219,14 @@ function PortfolioActivityPanel({
14217
14219
  ] });
14218
14220
  }
14219
14221
  var Container3 = styled9__default.default.div`
14222
+ display: flex;
14223
+ flex-direction: column;
14224
+ overflow: hidden;
14225
+ `;
14226
+ var ContentScroll = styled9__default.default.div`
14227
+ flex: 1;
14228
+ overflow-y: auto;
14229
+ min-height: 0;
14220
14230
  scrollbar-width: thin;
14221
14231
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
14222
14232
  &::-webkit-scrollbar { width: 4px; }
@@ -14878,7 +14888,7 @@ var CRow = styled9__default.default.button`
14878
14888
  var CCellLabel = styled9__default.default.div`
14879
14889
  font-size: 0.6rem;
14880
14890
  font-weight: 500;
14881
- color: rgba(255, 255, 255, 0.3);
14891
+ color: rgba(255, 255, 255, 0.5);
14882
14892
  margin-bottom: 1px;
14883
14893
  `;
14884
14894
  var CAssetCell = styled9__default.default.div``;
@@ -14937,7 +14947,7 @@ var CDetailGrid = styled9__default.default.div`
14937
14947
  var CDetailItem = styled9__default.default.div``;
14938
14948
  var CDLabel = styled9__default.default.div`
14939
14949
  font-size: 0.6rem;
14940
- color: rgba(255, 255, 255, 0.3);
14950
+ color: rgba(255, 255, 255, 0.5);
14941
14951
  margin-bottom: 1px;
14942
14952
  `;
14943
14953
  var CDValue = styled9__default.default.div`