@loafmarkets/ui 0.1.411 → 0.1.412
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.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +37 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15197,6 +15197,7 @@ function PortfolioActivityPanel({
|
|
|
15197
15197
|
onSharePosition,
|
|
15198
15198
|
onAssetClick,
|
|
15199
15199
|
onClosePosition,
|
|
15200
|
+
onCloseAllPositions,
|
|
15200
15201
|
offeringOrders = [],
|
|
15201
15202
|
openOrders = [],
|
|
15202
15203
|
orderHistory = [],
|
|
@@ -15221,6 +15222,8 @@ function PortfolioActivityPanel({
|
|
|
15221
15222
|
const [cancellingAll, setCancellingAll] = useState(false);
|
|
15222
15223
|
const [closeAllOpen, setCloseAllOpen] = useState(false);
|
|
15223
15224
|
const [closeAllType, setCloseAllType] = useState("market");
|
|
15225
|
+
const [closingAll, setClosingAll] = useState(false);
|
|
15226
|
+
const hasPositionActions = !!(onClosePosition || onSharePosition || onCloseAllPositions);
|
|
15224
15227
|
const [posSortKey, setPosSortKey] = useState("asset");
|
|
15225
15228
|
const [posSortAsc, setPosSortAsc] = useState(true);
|
|
15226
15229
|
const handlePosSort = (key) => {
|
|
@@ -15399,7 +15402,6 @@ function PortfolioActivityPanel({
|
|
|
15399
15402
|
const pagedTradeHistory = sortedTradeHistory.slice(currentPage * pageSize, (currentPage + 1) * pageSize);
|
|
15400
15403
|
const pagedTransfers = sortedTransfers.slice(currentPage * pageSize, (currentPage + 1) * pageSize);
|
|
15401
15404
|
return /* @__PURE__ */ jsxs(Container2, { className, style, children: [
|
|
15402
|
-
/* @__PURE__ */ jsx(PanelTitle, { children: "Activity" }),
|
|
15403
15405
|
/* @__PURE__ */ jsxs(TabContainer, { children: [
|
|
15404
15406
|
showPositionsTab && /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "positions", onClick: () => handleTabChange("positions"), children: [
|
|
15405
15407
|
"Trading Positions",
|
|
@@ -15455,7 +15457,7 @@ function PortfolioActivityPanel({
|
|
|
15455
15457
|
] }),
|
|
15456
15458
|
/* @__PURE__ */ jsxs(CToolbarActions, { children: [
|
|
15457
15459
|
/* @__PURE__ */ jsx(CToolbarLink, { onClick: toggleExpandAll, children: allExpanded ? "Collapse All" : "Expand All" }),
|
|
15458
|
-
|
|
15460
|
+
onCloseAllPositions && /* @__PURE__ */ jsx(CToolbarLink, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
|
|
15459
15461
|
] })
|
|
15460
15462
|
] }),
|
|
15461
15463
|
sortedPositions.map((pos) => {
|
|
@@ -15531,7 +15533,7 @@ function PortfolioActivityPanel({
|
|
|
15531
15533
|
})
|
|
15532
15534
|
] }),
|
|
15533
15535
|
positions.length > 0 && !compactPositions && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15534
|
-
/* @__PURE__ */ jsxs(PositionsHeader, { $hasClose:
|
|
15536
|
+
/* @__PURE__ */ jsxs(PositionsHeader, { $hasClose: hasPositionActions, children: [
|
|
15535
15537
|
/* @__PURE__ */ jsxs(SortableHeaderCell, { $active: posSortKey === "asset", onClick: () => handlePosSort("asset"), children: [
|
|
15536
15538
|
"Asset ",
|
|
15537
15539
|
posSortKey === "asset" && (posSortAsc ? "\u2191" : "\u2193")
|
|
@@ -15556,7 +15558,7 @@ function PortfolioActivityPanel({
|
|
|
15556
15558
|
"PNL (%) ",
|
|
15557
15559
|
posSortKey === "pnl" && (posSortAsc ? "\u2191" : "\u2193")
|
|
15558
15560
|
] }),
|
|
15559
|
-
|
|
15561
|
+
onCloseAllPositions && /* @__PURE__ */ jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
|
|
15560
15562
|
] }),
|
|
15561
15563
|
sortedPositions.map((pos) => {
|
|
15562
15564
|
const currentValue = pos.totalQuantity * pos.marketPrice;
|
|
@@ -15564,7 +15566,7 @@ function PortfolioActivityPanel({
|
|
|
15564
15566
|
const pnl = pos.propertyPnl ?? currentValue - costBasis;
|
|
15565
15567
|
const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
|
|
15566
15568
|
const isPositive = pnl >= 0;
|
|
15567
|
-
return /* @__PURE__ */ jsxs(PositionsRow, { $hasClose:
|
|
15569
|
+
return /* @__PURE__ */ jsxs(PositionsRow, { $hasClose: hasPositionActions, children: [
|
|
15568
15570
|
/* @__PURE__ */ jsx(PositionsCell, { children: /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
15569
15571
|
/* @__PURE__ */ jsx(HoldingsPropertyLink, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: pos.tokenName }),
|
|
15570
15572
|
pos.settling && /* @__PURE__ */ jsx(SettlingTip, { children: /* @__PURE__ */ jsx(SettlingSpinner, {}) })
|
|
@@ -15611,11 +15613,15 @@ function PortfolioActivityPanel({
|
|
|
15611
15613
|
] }, pos.tokenName);
|
|
15612
15614
|
})
|
|
15613
15615
|
] }),
|
|
15614
|
-
positions.length > 0 && closeAllOpen &&
|
|
15615
|
-
/* @__PURE__ */ jsx(CloseAllOverlay, { onClick: () =>
|
|
15616
|
-
|
|
15616
|
+
positions.length > 0 && closeAllOpen && onCloseAllPositions && typeof document !== "undefined" && createPortal(
|
|
15617
|
+
/* @__PURE__ */ jsx(CloseAllOverlay, { onClick: () => {
|
|
15618
|
+
if (!closingAll) setCloseAllOpen(false);
|
|
15619
|
+
}, children: /* @__PURE__ */ jsxs(CloseAllModal, { onClick: (e) => e.stopPropagation(), children: [
|
|
15620
|
+
/* @__PURE__ */ jsx(CloseAllModalX, { onClick: () => {
|
|
15621
|
+
if (!closingAll) setCloseAllOpen(false);
|
|
15622
|
+
}, children: "\xD7" }),
|
|
15617
15623
|
/* @__PURE__ */ jsx(CloseAllTitle, { children: "Confirm Sell All" }),
|
|
15618
|
-
/* @__PURE__ */ jsx(CloseAllDesc, { children: "This
|
|
15624
|
+
/* @__PURE__ */ jsx(CloseAllDesc, { children: "This places a sell order for every position you hold, one at a time." }),
|
|
15619
15625
|
/* @__PURE__ */ jsxs(CloseAllOption, { onClick: () => setCloseAllType("market"), children: [
|
|
15620
15626
|
/* @__PURE__ */ jsx(CloseAllRadio, { $selected: closeAllType === "market" }),
|
|
15621
15627
|
/* @__PURE__ */ jsx("span", { children: "Market Sell" })
|
|
@@ -15624,14 +15630,22 @@ function PortfolioActivityPanel({
|
|
|
15624
15630
|
/* @__PURE__ */ jsx(CloseAllRadio, { $selected: closeAllType === "limit" }),
|
|
15625
15631
|
/* @__PURE__ */ jsx("span", { children: "Limit Sell at Mid Price" })
|
|
15626
15632
|
] }),
|
|
15627
|
-
/* @__PURE__ */
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15633
|
+
/* @__PURE__ */ jsx(
|
|
15634
|
+
CloseAllConfirmBtn,
|
|
15635
|
+
{
|
|
15636
|
+
disabled: closingAll,
|
|
15637
|
+
onClick: async () => {
|
|
15638
|
+
setClosingAll(true);
|
|
15639
|
+
try {
|
|
15640
|
+
await onCloseAllPositions(closeAllType);
|
|
15641
|
+
} finally {
|
|
15642
|
+
setClosingAll(false);
|
|
15643
|
+
setCloseAllOpen(false);
|
|
15644
|
+
}
|
|
15645
|
+
},
|
|
15646
|
+
children: closingAll ? "Selling\u2026" : `Confirm ${closeAllType === "market" ? "Market" : "Limit"} Sell`
|
|
15647
|
+
}
|
|
15648
|
+
)
|
|
15635
15649
|
] }) }),
|
|
15636
15650
|
document.body
|
|
15637
15651
|
)
|
|
@@ -16190,17 +16204,6 @@ var ContentScroll = styled10.div`
|
|
|
16190
16204
|
&::-webkit-scrollbar-track { background: transparent; }
|
|
16191
16205
|
&::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
|
|
16192
16206
|
`;
|
|
16193
|
-
var PanelTitle = styled10.h3`
|
|
16194
|
-
font-size: 1rem;
|
|
16195
|
-
font-weight: 600;
|
|
16196
|
-
color: var(--color-text, #fff);
|
|
16197
|
-
margin: 0 0 0.75rem;
|
|
16198
|
-
padding-left: 1rem;
|
|
16199
|
-
/* Redundant on mobile — the tab row already says what this is. Reclaim the space. */
|
|
16200
|
-
@media (max-width: 768px) {
|
|
16201
|
-
display: none;
|
|
16202
|
-
}
|
|
16203
|
-
`;
|
|
16204
16207
|
var TabContainer = styled10.div`
|
|
16205
16208
|
display: flex;
|
|
16206
16209
|
gap: 0;
|
|
@@ -16653,9 +16656,14 @@ var CloseAllConfirmBtn = styled10.button`
|
|
|
16653
16656
|
cursor: pointer;
|
|
16654
16657
|
transition: all 0.15s ease;
|
|
16655
16658
|
|
|
16656
|
-
&:hover {
|
|
16659
|
+
&:hover:not(:disabled) {
|
|
16657
16660
|
background: rgba(246, 70, 93, 0.25);
|
|
16658
16661
|
}
|
|
16662
|
+
|
|
16663
|
+
&:disabled {
|
|
16664
|
+
opacity: 0.5;
|
|
16665
|
+
cursor: not-allowed;
|
|
16666
|
+
}
|
|
16659
16667
|
`;
|
|
16660
16668
|
var CToolbar = styled10.div`
|
|
16661
16669
|
display: flex;
|