@loafmarkets/ui 0.1.269 → 0.1.271
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +34 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -848,6 +848,7 @@ interface OrderHistoryItem {
|
|
|
848
848
|
readonly filledAt: number | null;
|
|
849
849
|
readonly cancelledAt: number | null;
|
|
850
850
|
readonly createdAt: number;
|
|
851
|
+
readonly isOfferingOrder?: boolean;
|
|
851
852
|
}
|
|
852
853
|
interface TradeHistoryItem {
|
|
853
854
|
readonly tradeId: number;
|
|
@@ -886,6 +887,7 @@ type ActivityTabId = 'positions' | 'subscriptions' | 'open-orders' | 'orders' |
|
|
|
886
887
|
type PortfolioActivityPanelProps = {
|
|
887
888
|
positions?: readonly PortfolioPosition[];
|
|
888
889
|
showPositionsTab?: boolean;
|
|
890
|
+
showSubscriptionsTab?: boolean;
|
|
889
891
|
onPositionClick?: (tokenName: string, isIpo: boolean) => void;
|
|
890
892
|
onClosePosition?: (tokenName: string, type: 'market' | 'limit', quantity: number, marketPrice: number) => void;
|
|
891
893
|
offeringOrders?: readonly OfferingOrder[];
|
|
@@ -907,7 +909,7 @@ type PortfolioActivityPanelProps = {
|
|
|
907
909
|
className?: string;
|
|
908
910
|
style?: React.CSSProperties;
|
|
909
911
|
};
|
|
910
|
-
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, compactPositions, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
912
|
+
declare function PortfolioActivityPanel({ positions, showPositionsTab, showSubscriptionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, compactPositions, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
911
913
|
|
|
912
914
|
type SelectorItem = {
|
|
913
915
|
readonly tokenName: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -848,6 +848,7 @@ interface OrderHistoryItem {
|
|
|
848
848
|
readonly filledAt: number | null;
|
|
849
849
|
readonly cancelledAt: number | null;
|
|
850
850
|
readonly createdAt: number;
|
|
851
|
+
readonly isOfferingOrder?: boolean;
|
|
851
852
|
}
|
|
852
853
|
interface TradeHistoryItem {
|
|
853
854
|
readonly tradeId: number;
|
|
@@ -886,6 +887,7 @@ type ActivityTabId = 'positions' | 'subscriptions' | 'open-orders' | 'orders' |
|
|
|
886
887
|
type PortfolioActivityPanelProps = {
|
|
887
888
|
positions?: readonly PortfolioPosition[];
|
|
888
889
|
showPositionsTab?: boolean;
|
|
890
|
+
showSubscriptionsTab?: boolean;
|
|
889
891
|
onPositionClick?: (tokenName: string, isIpo: boolean) => void;
|
|
890
892
|
onClosePosition?: (tokenName: string, type: 'market' | 'limit', quantity: number, marketPrice: number) => void;
|
|
891
893
|
offeringOrders?: readonly OfferingOrder[];
|
|
@@ -907,7 +909,7 @@ type PortfolioActivityPanelProps = {
|
|
|
907
909
|
className?: string;
|
|
908
910
|
style?: React.CSSProperties;
|
|
909
911
|
};
|
|
910
|
-
declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, compactPositions, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
912
|
+
declare function PortfolioActivityPanel({ positions, showPositionsTab, showSubscriptionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, compactPositions, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
|
|
911
913
|
|
|
912
914
|
type SelectorItem = {
|
|
913
915
|
readonly tokenName: string;
|
package/dist/index.js
CHANGED
|
@@ -13628,6 +13628,7 @@ function EditableField({ value, onCommit, format }) {
|
|
|
13628
13628
|
function PortfolioActivityPanel({
|
|
13629
13629
|
positions = [],
|
|
13630
13630
|
showPositionsTab = false,
|
|
13631
|
+
showSubscriptionsTab = true,
|
|
13631
13632
|
onPositionClick,
|
|
13632
13633
|
onClosePosition,
|
|
13633
13634
|
offeringOrders = [],
|
|
@@ -13646,7 +13647,7 @@ function PortfolioActivityPanel({
|
|
|
13646
13647
|
className,
|
|
13647
13648
|
style
|
|
13648
13649
|
}) {
|
|
13649
|
-
const resolvedDefaultTab = defaultTab ?? (showPositionsTab ? "positions" : "subscriptions");
|
|
13650
|
+
const resolvedDefaultTab = defaultTab ?? (showPositionsTab ? "positions" : showSubscriptionsTab ? "subscriptions" : "orders");
|
|
13650
13651
|
const [activeTab, setActiveTab] = React5.useState(resolvedDefaultTab);
|
|
13651
13652
|
const [activityPage, setActivityPage] = React5.useState(0);
|
|
13652
13653
|
const [pendingCancelOrderId, setPendingCancelOrderId] = React5.useState(null);
|
|
@@ -13729,6 +13730,28 @@ function PortfolioActivityPanel({
|
|
|
13729
13730
|
setAllExpanded(true);
|
|
13730
13731
|
}
|
|
13731
13732
|
};
|
|
13733
|
+
const mergedOrderHistory = React5.useMemo(() => {
|
|
13734
|
+
if (showSubscriptionsTab || offeringOrders.length === 0) return orderHistory;
|
|
13735
|
+
const mapped = offeringOrders.map((o, i) => ({
|
|
13736
|
+
id: o.ipoOrderId ?? -(i + 1),
|
|
13737
|
+
propertyId: 0,
|
|
13738
|
+
tokenName: o.tokenName,
|
|
13739
|
+
side: "BUY",
|
|
13740
|
+
type: "MARKET",
|
|
13741
|
+
timeInForce: "GTC",
|
|
13742
|
+
quantity: o.quantity,
|
|
13743
|
+
price: o.price,
|
|
13744
|
+
status: o.status.toUpperCase() === "ALLOCATED" ? "FILLED" : o.status.toUpperCase(),
|
|
13745
|
+
filledQuantity: o.status.toUpperCase() === "ALLOCATED" || o.status.toUpperCase() === "FILLED" || o.status.toUpperCase() === "CONFIRMED" ? o.quantity : 0,
|
|
13746
|
+
rejectionReason: null,
|
|
13747
|
+
deadline: 0,
|
|
13748
|
+
filledAt: o.status.toUpperCase() === "ALLOCATED" || o.status.toUpperCase() === "FILLED" || o.status.toUpperCase() === "CONFIRMED" ? o.createdAt : null,
|
|
13749
|
+
cancelledAt: null,
|
|
13750
|
+
createdAt: o.createdAt,
|
|
13751
|
+
isOfferingOrder: true
|
|
13752
|
+
}));
|
|
13753
|
+
return [...orderHistory, ...mapped].sort((a, b) => b.createdAt - a.createdAt);
|
|
13754
|
+
}, [showSubscriptionsTab, offeringOrders, orderHistory]);
|
|
13732
13755
|
const activeTabTotal = React5.useMemo(() => {
|
|
13733
13756
|
switch (activeTab) {
|
|
13734
13757
|
case "positions":
|
|
@@ -13738,7 +13761,7 @@ function PortfolioActivityPanel({
|
|
|
13738
13761
|
case "open-orders":
|
|
13739
13762
|
return openOrders.length;
|
|
13740
13763
|
case "orders":
|
|
13741
|
-
return
|
|
13764
|
+
return mergedOrderHistory.length;
|
|
13742
13765
|
case "trades":
|
|
13743
13766
|
return tradeHistory.length;
|
|
13744
13767
|
case "transfers":
|
|
@@ -13746,15 +13769,15 @@ function PortfolioActivityPanel({
|
|
|
13746
13769
|
default:
|
|
13747
13770
|
return 0;
|
|
13748
13771
|
}
|
|
13749
|
-
}, [activeTab, positions.length, offeringOrders.length, openOrders.length,
|
|
13772
|
+
}, [activeTab, positions.length, offeringOrders.length, openOrders.length, mergedOrderHistory.length, tradeHistory.length, transfers.length]);
|
|
13750
13773
|
const positionsCount = positions.length;
|
|
13751
13774
|
const openOrdersCount = React5.useMemo(
|
|
13752
13775
|
() => openOrders.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
|
|
13753
13776
|
[openOrders]
|
|
13754
13777
|
);
|
|
13755
13778
|
const pendingHistoryCount = React5.useMemo(
|
|
13756
|
-
() =>
|
|
13757
|
-
[
|
|
13779
|
+
() => mergedOrderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
|
|
13780
|
+
[mergedOrderHistory]
|
|
13758
13781
|
);
|
|
13759
13782
|
const pendingOfferingsCount = React5.useMemo(
|
|
13760
13783
|
() => offeringOrders.filter((o) => {
|
|
@@ -13780,7 +13803,7 @@ function PortfolioActivityPanel({
|
|
|
13780
13803
|
")"
|
|
13781
13804
|
] })
|
|
13782
13805
|
] }),
|
|
13783
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
|
|
13806
|
+
showSubscriptionsTab && /* @__PURE__ */ jsxRuntime.jsxs(Tab, { $active: activeTab === "subscriptions", onClick: () => handleTabChange("subscriptions"), children: [
|
|
13784
13807
|
"Initial Offerings",
|
|
13785
13808
|
pendingOfferingsCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(TabCount, { children: [
|
|
13786
13809
|
" (",
|
|
@@ -14058,8 +14081,8 @@ function PortfolioActivityPanel({
|
|
|
14058
14081
|
] })
|
|
14059
14082
|
] }),
|
|
14060
14083
|
activeTab === "orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14061
|
-
|
|
14062
|
-
|
|
14084
|
+
mergedOrderHistory.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
|
|
14085
|
+
mergedOrderHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14063
14086
|
/* @__PURE__ */ jsxRuntime.jsxs(GridHeader, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
|
|
14064
14087
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
|
|
14065
14088
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
|
|
@@ -14070,14 +14093,15 @@ function PortfolioActivityPanel({
|
|
|
14070
14093
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Status" }),
|
|
14071
14094
|
/* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Date" })
|
|
14072
14095
|
] }),
|
|
14073
|
-
pageSlice(
|
|
14096
|
+
pageSlice(mergedOrderHistory).map((order) => {
|
|
14074
14097
|
const meta = getOrderStatusMeta(order.status);
|
|
14075
14098
|
const isMarket = order.type === "MARKET";
|
|
14076
14099
|
const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
|
|
14100
|
+
const typeLabel = order.isOfferingOrder ? "Initial Offering" : prettyLabel(order.type);
|
|
14077
14101
|
return /* @__PURE__ */ jsxRuntime.jsxs(GridRow, { $columns: "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
|
|
14078
14102
|
/* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $primary: true, children: order.tokenName }) }),
|
|
14079
14103
|
/* @__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:
|
|
14104
|
+
/* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { $muted: true, children: typeLabel }) }),
|
|
14081
14105
|
/* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: formatNumber2(order.quantity) }) }),
|
|
14082
14106
|
/* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
|
|
14083
14107
|
/* @__PURE__ */ jsxRuntime.jsx(GridCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(CellText, { $muted: true, children: [
|