@loafmarkets/ui 0.1.240 → 0.1.242
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +72 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -894,6 +894,7 @@ type PortfolioActivityPanelProps = {
|
|
|
894
894
|
tradeHistory?: readonly TradeHistoryItem[];
|
|
895
895
|
transfers?: readonly TransferHistoryItem[];
|
|
896
896
|
onCancelOrder?: (orderId: number) => Promise<void>;
|
|
897
|
+
onCancelAllOrders?: () => Promise<void>;
|
|
897
898
|
onAmendOrder?: (orderId: number, fields: {
|
|
898
899
|
quantity?: number;
|
|
899
900
|
price?: number;
|
|
@@ -905,7 +906,7 @@ type PortfolioActivityPanelProps = {
|
|
|
905
906
|
className?: string;
|
|
906
907
|
style?: React.CSSProperties;
|
|
907
908
|
};
|
|
908
|
-
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
909
|
+
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
909
910
|
|
|
910
911
|
type SelectorItem = {
|
|
911
912
|
readonly tokenName: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -894,6 +894,7 @@ type PortfolioActivityPanelProps = {
|
|
|
894
894
|
tradeHistory?: readonly TradeHistoryItem[];
|
|
895
895
|
transfers?: readonly TransferHistoryItem[];
|
|
896
896
|
onCancelOrder?: (orderId: number) => Promise<void>;
|
|
897
|
+
onCancelAllOrders?: () => Promise<void>;
|
|
897
898
|
onAmendOrder?: (orderId: number, fields: {
|
|
898
899
|
quantity?: number;
|
|
899
900
|
price?: number;
|
|
@@ -905,7 +906,7 @@ type PortfolioActivityPanelProps = {
|
|
|
905
906
|
className?: string;
|
|
906
907
|
style?: React.CSSProperties;
|
|
907
908
|
};
|
|
908
|
-
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
909
|
+
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
909
910
|
|
|
910
911
|
type SelectorItem = {
|
|
911
912
|
readonly tokenName: string;
|
package/dist/index.js
CHANGED
|
@@ -2214,23 +2214,20 @@ function DesktopOrderbookLayout({
|
|
|
2214
2214
|
))
|
|
2215
2215
|
}
|
|
2216
2216
|
),
|
|
2217
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2217
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2218
2218
|
"div",
|
|
2219
2219
|
{
|
|
2220
2220
|
ref: midRef,
|
|
2221
|
-
className: "
|
|
2222
|
-
children: [
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
midChangePercent
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
] }) }),
|
|
2232
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
2233
|
-
]
|
|
2221
|
+
className: "flex items-center gap-2 bg-[#0b1a24] px-3 py-2 flex-shrink-0",
|
|
2222
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-lg font-semibold tabular-nums whitespace-nowrap", midClass), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { width: 110, height: 20 }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2223
|
+
"$",
|
|
2224
|
+
formatNumber(midPrice, precision),
|
|
2225
|
+
midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
|
|
2226
|
+
midChangePercent >= 0 ? "+" : "",
|
|
2227
|
+
midChangePercent.toFixed(2),
|
|
2228
|
+
"%"
|
|
2229
|
+
] })
|
|
2230
|
+
] }) })
|
|
2234
2231
|
}
|
|
2235
2232
|
),
|
|
2236
2233
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13722,6 +13719,7 @@ function PortfolioActivityPanel({
|
|
|
13722
13719
|
tradeHistory = [],
|
|
13723
13720
|
transfers = [],
|
|
13724
13721
|
onCancelOrder,
|
|
13722
|
+
onCancelAllOrders,
|
|
13725
13723
|
onAmendOrder,
|
|
13726
13724
|
cancellingOrderId = null,
|
|
13727
13725
|
defaultTab,
|
|
@@ -13734,6 +13732,8 @@ function PortfolioActivityPanel({
|
|
|
13734
13732
|
const [activeTab, setActiveTab] = React5.useState(resolvedDefaultTab);
|
|
13735
13733
|
const [activityPage, setActivityPage] = React5.useState(0);
|
|
13736
13734
|
const [pendingCancelOrderId, setPendingCancelOrderId] = React5.useState(null);
|
|
13735
|
+
const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = React5.useState(false);
|
|
13736
|
+
const [cancellingAll, setCancellingAll] = React5.useState(false);
|
|
13737
13737
|
const [closeAllOpen, setCloseAllOpen] = React5.useState(false);
|
|
13738
13738
|
const [closeAllType, setCloseAllType] = React5.useState("market");
|
|
13739
13739
|
const [posSortKey, setPosSortKey] = React5.useState("asset");
|
|
@@ -13973,6 +13973,7 @@ function PortfolioActivityPanel({
|
|
|
13973
13973
|
activeTab === "open-orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13974
13974
|
openOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
|
|
13975
13975
|
openOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13976
|
+
onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(CancelAllRow, { children: /* @__PURE__ */ jsxRuntime.jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
|
|
13976
13977
|
/* @__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: [
|
|
13977
13978
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
|
|
13978
13979
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
|
|
@@ -14122,6 +14123,36 @@ function PortfolioActivityPanel({
|
|
|
14122
14123
|
}
|
|
14123
14124
|
)
|
|
14124
14125
|
] }),
|
|
14126
|
+
cancelAllConfirmOpen && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
|
|
14127
|
+
/* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
|
|
14128
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmBody, { children: [
|
|
14129
|
+
"Are you sure you want to cancel all ",
|
|
14130
|
+
openOrdersCount,
|
|
14131
|
+
" open orders? This action cannot be undone."
|
|
14132
|
+
] }),
|
|
14133
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmActions, { children: [
|
|
14134
|
+
/* @__PURE__ */ jsxRuntime.jsx(CancelConfirmDismiss, { type: "button", onClick: () => setCancelAllConfirmOpen(false), children: "Keep Orders" }),
|
|
14135
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14136
|
+
CancelConfirmProceed,
|
|
14137
|
+
{
|
|
14138
|
+
type: "button",
|
|
14139
|
+
disabled: cancellingAll,
|
|
14140
|
+
onClick: async () => {
|
|
14141
|
+
if (onCancelAllOrders) {
|
|
14142
|
+
setCancellingAll(true);
|
|
14143
|
+
try {
|
|
14144
|
+
await onCancelAllOrders();
|
|
14145
|
+
} finally {
|
|
14146
|
+
setCancellingAll(false);
|
|
14147
|
+
}
|
|
14148
|
+
}
|
|
14149
|
+
setCancelAllConfirmOpen(false);
|
|
14150
|
+
},
|
|
14151
|
+
children: cancellingAll ? "Cancelling\u2026" : "Yes, Cancel All"
|
|
14152
|
+
}
|
|
14153
|
+
)
|
|
14154
|
+
] })
|
|
14155
|
+
] }) }),
|
|
14125
14156
|
pendingCancelOrderId !== null && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setPendingCancelOrderId(null), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
|
|
14126
14157
|
/* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel Order" }),
|
|
14127
14158
|
/* @__PURE__ */ jsxRuntime.jsx(CancelConfirmBody, { children: "Are you sure you want to cancel this order? This action cannot be undone." }),
|
|
@@ -14397,6 +14428,33 @@ var CancelButton = styled9__default.default.button`
|
|
|
14397
14428
|
cursor: not-allowed;
|
|
14398
14429
|
}
|
|
14399
14430
|
`;
|
|
14431
|
+
var CancelAllRow = styled9__default.default.div`
|
|
14432
|
+
display: flex;
|
|
14433
|
+
justify-content: flex-end;
|
|
14434
|
+
margin-bottom: 0.4rem;
|
|
14435
|
+
`;
|
|
14436
|
+
var CancelAllBtn = styled9__default.default.button`
|
|
14437
|
+
background: rgba(246, 70, 93, 0.08);
|
|
14438
|
+
border: 1px solid rgba(246, 70, 93, 0.3);
|
|
14439
|
+
border-radius: 4px;
|
|
14440
|
+
padding: 0.2rem 0.7rem;
|
|
14441
|
+
font-size: 0.62rem;
|
|
14442
|
+
font-weight: 600;
|
|
14443
|
+
color: #f6465d;
|
|
14444
|
+
cursor: pointer;
|
|
14445
|
+
white-space: nowrap;
|
|
14446
|
+
transition: all 0.15s ease;
|
|
14447
|
+
|
|
14448
|
+
&:hover {
|
|
14449
|
+
background: rgba(246, 70, 93, 0.18);
|
|
14450
|
+
border-color: rgba(246, 70, 93, 0.5);
|
|
14451
|
+
}
|
|
14452
|
+
|
|
14453
|
+
&:disabled {
|
|
14454
|
+
opacity: 0.4;
|
|
14455
|
+
cursor: not-allowed;
|
|
14456
|
+
}
|
|
14457
|
+
`;
|
|
14400
14458
|
var GridHeader = styled9__default.default.div`
|
|
14401
14459
|
display: grid;
|
|
14402
14460
|
grid-template-columns: ${(p) => p.$columns};
|