@agg-build/ui 2.7.3 → 3.0.0
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/{chunk-EDQ64EKO.mjs → chunk-JTSLZARU.mjs} +6 -5
- package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
- package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
- package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
- package/dist/{chunk-MZBYIXYA.mjs → chunk-R362GNI2.mjs} +1310 -500
- package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
- package/dist/{chunk-O27JUYCF.mjs → chunk-XIDQ2A6W.mjs} +645 -346
- package/dist/events.js +168 -91
- package/dist/events.mjs +3 -3
- package/dist/index.js +2784 -1606
- package/dist/index.mjs +9 -7
- package/dist/modals.js +98 -29
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +2510 -1333
- package/dist/pages.mjs +8 -6
- package/dist/primitives.js +94 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1739 -1143
- package/dist/trading.mjs +4 -4
- package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
- package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -1
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +8 -0
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +8 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -0
- package/dist/types/pages/user-profile/index.d.ts +1 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +8 -0
- package/dist/types/primitives/select/select.types.d.ts +8 -0
- package/dist/types/profile/profile-modal.constants.d.mts +1 -1
- package/dist/types/profile/profile-modal.constants.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +3 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +3 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +10 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +10 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +17 -5
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +17 -5
- package/package.json +3 -3
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MKU5Q6PN.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
@@ -18,10 +18,12 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XIDQ2A6W.mjs";
|
|
22
22
|
import {
|
|
23
|
-
getDisplayOutcomePrice
|
|
24
|
-
|
|
23
|
+
getDisplayOutcomePrice,
|
|
24
|
+
resolveHeaderOutcomeItems,
|
|
25
|
+
resolveMarketFromVenueMarkets
|
|
26
|
+
} from "./chunk-VR5ZRDQT.mjs";
|
|
25
27
|
import {
|
|
26
28
|
AggErrorBoundary,
|
|
27
29
|
Button,
|
|
@@ -48,13 +50,14 @@ import {
|
|
|
48
50
|
__spreadValues,
|
|
49
51
|
cn,
|
|
50
52
|
filterOpenEvents,
|
|
53
|
+
formatUsd,
|
|
51
54
|
normalizeVenueMarketCluster,
|
|
52
55
|
resolveTabVenus,
|
|
53
56
|
shortenAddress,
|
|
54
57
|
skeletonViews,
|
|
55
58
|
sortCategoriesForNavigation,
|
|
56
59
|
useOptionalToast
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-KO6VTRV6.mjs";
|
|
58
61
|
|
|
59
62
|
// src/pages/home/index.tsx
|
|
60
63
|
import {
|
|
@@ -1294,7 +1297,7 @@ function SportsLineRail({
|
|
|
1294
1297
|
const didInit = React.useRef(false);
|
|
1295
1298
|
const programmatic = React.useRef(false);
|
|
1296
1299
|
const progTimer = React.useRef(void 0);
|
|
1297
|
-
const
|
|
1300
|
+
const skipCenterForIndex = React.useRef(null);
|
|
1298
1301
|
const pendingScrollIndex = React.useRef(null);
|
|
1299
1302
|
const scrollSettleTimer = React.useRef(void 0);
|
|
1300
1303
|
const stopCount = stops.length;
|
|
@@ -1334,9 +1337,15 @@ function SportsLineRail({
|
|
|
1334
1337
|
if (!w) return;
|
|
1335
1338
|
const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
|
|
1336
1339
|
const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
|
|
1337
|
-
|
|
1340
|
+
const nextPad = {
|
|
1338
1341
|
left: Math.max(0, w / 2 - firstW / 2),
|
|
1339
1342
|
right: Math.max(0, w / 2 - lastW / 2)
|
|
1343
|
+
};
|
|
1344
|
+
setPad((currentPad) => {
|
|
1345
|
+
if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
|
|
1346
|
+
return currentPad;
|
|
1347
|
+
}
|
|
1348
|
+
return nextPad;
|
|
1340
1349
|
});
|
|
1341
1350
|
updateMask();
|
|
1342
1351
|
};
|
|
@@ -1349,7 +1358,7 @@ function SportsLineRail({
|
|
|
1349
1358
|
scrollSettleTimer.current = setTimeout(() => {
|
|
1350
1359
|
const nextIndex = pendingScrollIndex.current;
|
|
1351
1360
|
if (nextIndex == null || nextIndex === selectedIndex) return;
|
|
1352
|
-
|
|
1361
|
+
skipCenterForIndex.current = nextIndex;
|
|
1353
1362
|
onSelect(nextIndex);
|
|
1354
1363
|
}, 120);
|
|
1355
1364
|
}
|
|
@@ -1373,11 +1382,12 @@ function SportsLineRail({
|
|
|
1373
1382
|
const c = scrollRef.current;
|
|
1374
1383
|
const el = itemRefs.current[selectedIndex];
|
|
1375
1384
|
if (!c || !el || !c.clientWidth) return;
|
|
1376
|
-
if (
|
|
1377
|
-
|
|
1385
|
+
if (skipCenterForIndex.current === selectedIndex) {
|
|
1386
|
+
skipCenterForIndex.current = null;
|
|
1378
1387
|
updateMask();
|
|
1379
1388
|
return;
|
|
1380
1389
|
}
|
|
1390
|
+
skipCenterForIndex.current = null;
|
|
1381
1391
|
const max = c.scrollWidth - c.clientWidth;
|
|
1382
1392
|
const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
|
|
1383
1393
|
programmatic.current = true;
|
|
@@ -1392,11 +1402,18 @@ function SportsLineRail({
|
|
|
1392
1402
|
}, 500);
|
|
1393
1403
|
updateMask();
|
|
1394
1404
|
}, [selectedIndex, stopCount, pad, updateMask]);
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1405
|
+
const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
|
|
1406
|
+
const handleStopClick = (index) => {
|
|
1407
|
+
const next = clampStopIndex(index);
|
|
1408
|
+
if (next !== selectedIndex) {
|
|
1409
|
+
skipCenterForIndex.current = next;
|
|
1410
|
+
}
|
|
1411
|
+
onSelect(next);
|
|
1412
|
+
};
|
|
1413
|
+
const handleStep = (delta) => {
|
|
1414
|
+
const next = clampStopIndex(selectedIndex + delta);
|
|
1397
1415
|
if (next !== selectedIndex) onSelect(next);
|
|
1398
1416
|
};
|
|
1399
|
-
const step = (delta) => select(selectedIndex + delta);
|
|
1400
1417
|
if (stopCount === 0) return null;
|
|
1401
1418
|
return /* @__PURE__ */ jsxs2(
|
|
1402
1419
|
"div",
|
|
@@ -1408,7 +1425,7 @@ function SportsLineRail({
|
|
|
1408
1425
|
"button",
|
|
1409
1426
|
{
|
|
1410
1427
|
type: "button",
|
|
1411
|
-
onClick: () =>
|
|
1428
|
+
onClick: () => handleStep(-1),
|
|
1412
1429
|
disabled: selectedIndex === 0,
|
|
1413
1430
|
"aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
|
|
1414
1431
|
className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
|
|
@@ -1431,7 +1448,7 @@ function SportsLineRail({
|
|
|
1431
1448
|
ref: (el) => {
|
|
1432
1449
|
itemRefs.current[index] = el;
|
|
1433
1450
|
},
|
|
1434
|
-
onClick: () =>
|
|
1451
|
+
onClick: () => handleStopClick(index),
|
|
1435
1452
|
disabled: stop.disabled,
|
|
1436
1453
|
"aria-pressed": active,
|
|
1437
1454
|
className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
|
|
@@ -1477,7 +1494,7 @@ function SportsLineRail({
|
|
|
1477
1494
|
"button",
|
|
1478
1495
|
{
|
|
1479
1496
|
type: "button",
|
|
1480
|
-
onClick: () =>
|
|
1497
|
+
onClick: () => handleStep(1),
|
|
1481
1498
|
disabled: selectedIndex === stopCount - 1,
|
|
1482
1499
|
"aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
|
|
1483
1500
|
className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
|
|
@@ -1491,15 +1508,81 @@ function SportsLineRail({
|
|
|
1491
1508
|
|
|
1492
1509
|
// src/pages/event-market/sports-market-card.tsx
|
|
1493
1510
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1494
|
-
var
|
|
1511
|
+
var resolveSpreadHeaderOutcomeItems = ({
|
|
1512
|
+
market,
|
|
1513
|
+
groupMarkets,
|
|
1514
|
+
midpointsResult
|
|
1515
|
+
}) => {
|
|
1495
1516
|
var _a;
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1517
|
+
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
1518
|
+
const lineValue = market.lineValue;
|
|
1519
|
+
if (outcomes.length < 2 || lineValue == null) return void 0;
|
|
1520
|
+
const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
|
|
1521
|
+
if (!favored && !dog) return void 0;
|
|
1522
|
+
const magnitude = Math.abs(lineValue);
|
|
1523
|
+
const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
|
|
1524
|
+
return [
|
|
1525
|
+
{ index: 0, name: favored, signedLine: -magnitude },
|
|
1526
|
+
{ index: 1, name: dog, signedLine: magnitude }
|
|
1527
|
+
].flatMap(({ index, name, signedLine }) => {
|
|
1528
|
+
var _a2;
|
|
1529
|
+
const outcome = outcomes[index];
|
|
1530
|
+
if (!outcome) return [];
|
|
1531
|
+
const label = name != null ? name : outcome.label.trim();
|
|
1532
|
+
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
1533
|
+
outcomeId: outcome.id,
|
|
1534
|
+
outcomeLabel: outcome.label,
|
|
1535
|
+
bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
|
|
1536
|
+
});
|
|
1537
|
+
return [
|
|
1538
|
+
{
|
|
1539
|
+
id: outcome.id,
|
|
1540
|
+
label,
|
|
1541
|
+
title: label,
|
|
1542
|
+
lineLabel: formatLine(signedLine),
|
|
1543
|
+
probability,
|
|
1544
|
+
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
1545
|
+
tone: index === 0 ? "positive" : "negative",
|
|
1546
|
+
variant: "line",
|
|
1547
|
+
venue: market.venue
|
|
1548
|
+
}
|
|
1549
|
+
];
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
var resolveDisplayedOutcomes = ({
|
|
1553
|
+
market,
|
|
1554
|
+
venueMarkets,
|
|
1555
|
+
groupMarkets,
|
|
1556
|
+
useSpreadOverride
|
|
1557
|
+
}) => {
|
|
1558
|
+
var _a;
|
|
1559
|
+
const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
|
|
1560
|
+
const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
|
|
1561
|
+
const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
|
|
1562
|
+
(_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
|
|
1563
|
+
market,
|
|
1564
|
+
resolveSportsMarketCardVariant(market)
|
|
1565
|
+
);
|
|
1566
|
+
return headerOutcomeItems.flatMap((item) => {
|
|
1567
|
+
const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
|
|
1568
|
+
return outcome ? [outcome] : [];
|
|
1569
|
+
});
|
|
1570
|
+
};
|
|
1571
|
+
var resolveSelectedOutcomeSide = ({
|
|
1572
|
+
displayedOutcomes,
|
|
1573
|
+
selectedOutcomeId
|
|
1574
|
+
}) => {
|
|
1575
|
+
const selectedOutcomeIndex = displayedOutcomes.findIndex(
|
|
1576
|
+
(outcome) => outcome.id === selectedOutcomeId
|
|
1577
|
+
);
|
|
1578
|
+
if (selectedOutcomeIndex === 0) return "left";
|
|
1579
|
+
if (selectedOutcomeIndex === 1) return "right";
|
|
1501
1580
|
return null;
|
|
1502
1581
|
};
|
|
1582
|
+
var resolveOutcomeBySide = (displayedOutcomes, side) => {
|
|
1583
|
+
var _a;
|
|
1584
|
+
return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
|
|
1585
|
+
};
|
|
1503
1586
|
var SportsMarketCard = ({
|
|
1504
1587
|
group,
|
|
1505
1588
|
venueMarkets,
|
|
@@ -1617,69 +1700,46 @@ var SportsMarketCard = ({
|
|
|
1617
1700
|
});
|
|
1618
1701
|
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
|
|
1619
1702
|
const spreadHeaderOutcomeItems = useMemo(() => {
|
|
1620
|
-
var _a2;
|
|
1621
1703
|
if (slide.kind !== "spread" || !activeMarket) return void 0;
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
if (!favored && !dog) return void 0;
|
|
1627
|
-
const magnitude = Math.abs(lineValue);
|
|
1628
|
-
const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
|
|
1629
|
-
return [
|
|
1630
|
-
{ index: 0, name: favored, signedLine: -magnitude },
|
|
1631
|
-
{ index: 1, name: dog, signedLine: magnitude }
|
|
1632
|
-
].flatMap(({ index, name, signedLine }) => {
|
|
1633
|
-
var _a3;
|
|
1634
|
-
const outcome = outcomes[index];
|
|
1635
|
-
if (!outcome) return [];
|
|
1636
|
-
const label = name != null ? name : outcome.label.trim();
|
|
1637
|
-
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
1638
|
-
outcomeId: outcome.id,
|
|
1639
|
-
outcomeLabel: outcome.label,
|
|
1640
|
-
bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
|
|
1641
|
-
});
|
|
1642
|
-
return [
|
|
1643
|
-
{
|
|
1644
|
-
id: outcome.id,
|
|
1645
|
-
label,
|
|
1646
|
-
title: label,
|
|
1647
|
-
lineLabel: formatLine(signedLine),
|
|
1648
|
-
probability,
|
|
1649
|
-
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
1650
|
-
tone: index === 0 ? "positive" : "negative",
|
|
1651
|
-
variant: "line",
|
|
1652
|
-
venue: activeMarket.venue
|
|
1653
|
-
}
|
|
1654
|
-
];
|
|
1704
|
+
return resolveSpreadHeaderOutcomeItems({
|
|
1705
|
+
market: activeMarket,
|
|
1706
|
+
groupMarkets: group.markets,
|
|
1707
|
+
midpointsResult
|
|
1655
1708
|
});
|
|
1656
1709
|
}, [slide.kind, activeMarket, group.markets, midpointsResult]);
|
|
1657
1710
|
const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
|
|
1658
1711
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1659
1712
|
const handleLineSelect = (index) => {
|
|
1660
|
-
var _a2, _b2;
|
|
1661
|
-
const
|
|
1713
|
+
var _a2, _b2, _c2;
|
|
1714
|
+
const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
|
|
1715
|
+
if (!targetMarket) return;
|
|
1716
|
+
const selectedMarket = (_c2 = (_b2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b2 : venueMarkets.find((market) => market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId))) != null ? _c2 : null;
|
|
1717
|
+
const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
|
|
1718
|
+
const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
|
|
1719
|
+
displayedOutcomes: resolveDisplayedOutcomes({
|
|
1720
|
+
market: selectedMarket,
|
|
1721
|
+
venueMarkets,
|
|
1722
|
+
groupMarkets: group.markets,
|
|
1723
|
+
useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
|
|
1724
|
+
}),
|
|
1725
|
+
selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
|
|
1726
|
+
}) : null;
|
|
1727
|
+
const targetDisplayedOutcomes = resolveDisplayedOutcomes({
|
|
1728
|
+
market: targetMarket,
|
|
1729
|
+
venueMarkets,
|
|
1730
|
+
groupMarkets: group.markets,
|
|
1731
|
+
useSpreadOverride: slide.kind === "spread"
|
|
1732
|
+
});
|
|
1733
|
+
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
1662
1734
|
setSelectedLineIndex(index);
|
|
1663
|
-
const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
|
|
1664
|
-
if (!market) return;
|
|
1665
|
-
const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
|
|
1666
|
-
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
1667
|
-
) : -1;
|
|
1668
|
-
const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
|
|
1669
|
-
const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
|
|
1670
|
-
const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
|
|
1671
|
-
(outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
|
|
1672
|
-
) : [];
|
|
1673
|
-
const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
|
|
1674
|
-
const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
|
|
1675
1735
|
if (nextOutcome) {
|
|
1676
|
-
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(
|
|
1736
|
+
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
|
1677
1737
|
onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
|
|
1678
|
-
marketId:
|
|
1738
|
+
marketId: targetMarket.id,
|
|
1679
1739
|
outcomeId: nextOutcome.id
|
|
1680
1740
|
});
|
|
1681
1741
|
} else {
|
|
1682
|
-
tradingContext == null ? void 0 : tradingContext.selectMarket(
|
|
1742
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
|
|
1683
1743
|
}
|
|
1684
1744
|
};
|
|
1685
1745
|
return /* @__PURE__ */ jsx3(
|
|
@@ -3122,19 +3182,19 @@ import {
|
|
|
3122
3182
|
getWalletAddressFromUserProfile,
|
|
3123
3183
|
useAppConfig as useAppConfig2,
|
|
3124
3184
|
useAggAuthState,
|
|
3125
|
-
useAggBalance,
|
|
3185
|
+
useAggBalance as useAggBalance2,
|
|
3126
3186
|
useAggClient,
|
|
3127
3187
|
useCancelManagedOrder,
|
|
3128
3188
|
useExecutionOrders,
|
|
3129
3189
|
useExecutionPositions,
|
|
3130
3190
|
useGeoBlock,
|
|
3131
|
-
useLabels as
|
|
3191
|
+
useLabels as useLabels12,
|
|
3132
3192
|
useSdkUiConfig as useSdkUiConfig5,
|
|
3133
3193
|
useUserActivity
|
|
3134
3194
|
} from "@agg-build/hooks";
|
|
3135
|
-
import { Venue as
|
|
3195
|
+
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
3136
3196
|
import dayjs from "dayjs";
|
|
3137
|
-
import { useCallback as
|
|
3197
|
+
import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
|
|
3138
3198
|
|
|
3139
3199
|
// src/pages/user-profile/chain-display.ts
|
|
3140
3200
|
var CHAIN_ID_TO_LABEL = {
|
|
@@ -3211,7 +3271,9 @@ var AvailableBalanceCard = ({
|
|
|
3211
3271
|
reservedValueLabel,
|
|
3212
3272
|
chains,
|
|
3213
3273
|
isLoading = false,
|
|
3214
|
-
className
|
|
3274
|
+
className,
|
|
3275
|
+
onManage,
|
|
3276
|
+
manageButtonRef
|
|
3215
3277
|
}) => {
|
|
3216
3278
|
const labels = useLabels5();
|
|
3217
3279
|
const balanceLabels = labels.userProfile.balance;
|
|
@@ -3226,28 +3288,23 @@ var AvailableBalanceCard = ({
|
|
|
3226
3288
|
className
|
|
3227
3289
|
),
|
|
3228
3290
|
children: [
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
"
|
|
3291
|
+
/* @__PURE__ */ jsxs7("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: [
|
|
3292
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
3293
|
+
/* @__PURE__ */ jsx8(Icon, { name: "wallet", size: "small", className: "size-4 text-agg-muted-foreground" }),
|
|
3294
|
+
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
|
|
3295
|
+
] }),
|
|
3296
|
+
onManage ? /* @__PURE__ */ jsx8(
|
|
3297
|
+
"button",
|
|
3232
3298
|
{
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
focusable: "false",
|
|
3240
|
-
children: /* @__PURE__ */ jsx8(
|
|
3241
|
-
"path",
|
|
3242
|
-
{
|
|
3243
|
-
d: "M14 4.00065H3.33333C2.76067 4.00065 2.21867 3.75265 1.84333 3.33465C2.21 2.92532 2.74267 2.66732 3.33333 2.66732H15.3333C15.702 2.66732 16 2.36865 16 2.00065C16 1.63265 15.702 1.33398 15.3333 1.33398H3.33333C1.49267 1.33398 0 2.82665 0 4.66732V11.334C0 13.1747 1.49267 14.6673 3.33333 14.6673H14C15.1047 14.6673 16 13.772 16 12.6673V6.00065C16 4.89598 15.1047 4.00065 14 4.00065ZM14.6667 12.6673C14.6667 13.0347 14.368 13.334 14 13.334H3.33333C2.23067 13.334 1.33333 12.4367 1.33333 11.334V4.66598C1.90267 5.09198 2.60267 5.33398 3.33333 5.33398H14C14.368 5.33398 14.6667 5.63332 14.6667 6.00065V12.6673ZM13.3333 9.33399C13.3333 9.70199 13.0347 10.0007 12.6667 10.0007C12.2987 10.0007 12 9.70199 12 9.33399C12 8.96599 12.2987 8.66732 12.6667 8.66732C13.0347 8.66732 13.3333 8.96599 13.3333 9.33399Z",
|
|
3244
|
-
fill: "#9D9FAF"
|
|
3245
|
-
}
|
|
3246
|
-
)
|
|
3299
|
+
ref: manageButtonRef,
|
|
3300
|
+
type: "button",
|
|
3301
|
+
"aria-haspopup": "dialog",
|
|
3302
|
+
className: "cursor-pointer rounded-agg-sm font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover",
|
|
3303
|
+
onClick: onManage,
|
|
3304
|
+
children: balanceLabels.manage
|
|
3247
3305
|
}
|
|
3248
|
-
)
|
|
3249
|
-
|
|
3250
|
-
] }) }),
|
|
3306
|
+
) : null
|
|
3307
|
+
] }),
|
|
3251
3308
|
/* @__PURE__ */ jsxs7("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
3252
3309
|
/* @__PURE__ */ jsx8("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
|
|
3253
3310
|
/* @__PURE__ */ jsx8(
|
|
@@ -3500,9 +3557,720 @@ var ClaimActivityBreakdownModal = ({
|
|
|
3500
3557
|
);
|
|
3501
3558
|
};
|
|
3502
3559
|
|
|
3560
|
+
// src/pages/user-profile/components/manage-balances-modal.tsx
|
|
3561
|
+
import {
|
|
3562
|
+
useAggBalance,
|
|
3563
|
+
useBalanceRefillPolicies,
|
|
3564
|
+
useDepositAddresses,
|
|
3565
|
+
useLabels as useLabels7
|
|
3566
|
+
} from "@agg-build/hooks";
|
|
3567
|
+
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
3568
|
+
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
3569
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3570
|
+
import { z } from "zod";
|
|
3571
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3572
|
+
var USDC_DECIMALS = 6;
|
|
3573
|
+
var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
|
|
3574
|
+
var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
|
|
3575
|
+
var NETWORK_PRESENTATION = {
|
|
3576
|
+
137: { name: "Polygon", order: 0, venues: [Venue2.polymarket] },
|
|
3577
|
+
56: { name: "BNB", order: 1, venues: [Venue2.limitless, Venue2.myriad] },
|
|
3578
|
+
792703809: { name: "Solana", order: 2, venues: [Venue2.kalshi] },
|
|
3579
|
+
1337: { name: "Hyperliquid", order: 3, venues: [Venue2.hyperliquid] },
|
|
3580
|
+
42161: { name: "Arbitrum", order: 4, venues: [] },
|
|
3581
|
+
8453: { name: "Base", order: 5, venues: [] },
|
|
3582
|
+
1: { name: "Ethereum", order: 6, venues: [] }
|
|
3583
|
+
};
|
|
3584
|
+
var VENUE_LABELS = {
|
|
3585
|
+
[Venue2.kalshi]: "Kalshi",
|
|
3586
|
+
[Venue2.limitless]: "Limitless",
|
|
3587
|
+
[Venue2.opinion]: "Opinion",
|
|
3588
|
+
[Venue2.polymarket]: "Polymarket",
|
|
3589
|
+
[Venue2.predict]: "Predict",
|
|
3590
|
+
[Venue2.probable]: "Probable",
|
|
3591
|
+
[Venue2.myriad]: "Myriad",
|
|
3592
|
+
[Venue2.hyperliquid]: "Hyperliquid"
|
|
3593
|
+
};
|
|
3594
|
+
var amountSchema = z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
3595
|
+
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
3596
|
+
const parsed = amountSchema.safeParse(value.trim());
|
|
3597
|
+
if (!parsed.success) return null;
|
|
3598
|
+
const [whole = "0", fraction = ""] = parsed.data.split(".");
|
|
3599
|
+
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
3600
|
+
const normalizedWhole = whole.replace(/^0+(?=\d)/, "") || "0";
|
|
3601
|
+
return BigInt(`${normalizedWhole}${paddedFraction}`).toString();
|
|
3602
|
+
};
|
|
3603
|
+
var rawToDecimal = (rawValue, decimals = USDC_DECIMALS) => {
|
|
3604
|
+
const normalizedRaw = rawValue.replace(/^0+(?=\d)/, "") || "0";
|
|
3605
|
+
const paddedRaw = normalizedRaw.padStart(decimals + 1, "0");
|
|
3606
|
+
const whole = paddedRaw.slice(0, -decimals);
|
|
3607
|
+
const fraction = paddedRaw.slice(-decimals).replace(/0+$/, "");
|
|
3608
|
+
return fraction ? `${whole}.${fraction}` : whole;
|
|
3609
|
+
};
|
|
3610
|
+
var getInitialDraft = (policy) => {
|
|
3611
|
+
if ((policy == null ? void 0 : policy.status) !== "enabled") return { minimum: "0", refillTo: "0" };
|
|
3612
|
+
return {
|
|
3613
|
+
minimum: rawToDecimal(policy.minimumRaw),
|
|
3614
|
+
refillTo: rawToDecimal(policy.refillAmountRaw)
|
|
3615
|
+
};
|
|
3616
|
+
};
|
|
3617
|
+
var areDraftsEqual = (current, initial) => {
|
|
3618
|
+
const currentMinimumRaw = decimalToRaw(current.minimum);
|
|
3619
|
+
const currentRefillToRaw = decimalToRaw(current.refillTo);
|
|
3620
|
+
const initialMinimumRaw = decimalToRaw(initial.minimum);
|
|
3621
|
+
const initialRefillToRaw = decimalToRaw(initial.refillTo);
|
|
3622
|
+
return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
|
|
3623
|
+
};
|
|
3624
|
+
var getPolicyMaximumRaw = (policy) => {
|
|
3625
|
+
if (!(policy == null ? void 0 : policy.dailyCapRaw) || !policy.maxFeeRaw) return null;
|
|
3626
|
+
const dailyCapRaw = BigInt(policy.dailyCapRaw);
|
|
3627
|
+
const maximumFeeRaw = BigInt(policy.maxFeeRaw);
|
|
3628
|
+
if (dailyCapRaw <= maximumFeeRaw) return "0";
|
|
3629
|
+
return (dailyCapRaw - maximumFeeRaw).toString();
|
|
3630
|
+
};
|
|
3631
|
+
var getApiFieldErrors = (error) => {
|
|
3632
|
+
var _a;
|
|
3633
|
+
if (!(error instanceof Error)) return [];
|
|
3634
|
+
return (_a = error.errors) != null ? _a : [];
|
|
3635
|
+
};
|
|
3636
|
+
var getApiErrorMessage = (error, fallback) => {
|
|
3637
|
+
if (!(error instanceof Error) || !error.message.trim()) return fallback;
|
|
3638
|
+
return error.message;
|
|
3639
|
+
};
|
|
3640
|
+
var ManageBalancesModal = ({
|
|
3641
|
+
open,
|
|
3642
|
+
onOpenChange
|
|
3643
|
+
}) => {
|
|
3644
|
+
const labels = useLabels7();
|
|
3645
|
+
const refillLabels = labels.balanceRefill;
|
|
3646
|
+
const balanceState = useAggBalance();
|
|
3647
|
+
const depositAddressesQuery = useDepositAddresses({ enabled: open });
|
|
3648
|
+
const policiesQuery = useBalanceRefillPolicies({ enabled: open });
|
|
3649
|
+
const toastContext = useOptionalToast();
|
|
3650
|
+
const descriptionId = useId();
|
|
3651
|
+
const savingRef = useRef8(false);
|
|
3652
|
+
const [expandedChainIds, setExpandedChainIds] = useState10(/* @__PURE__ */ new Set());
|
|
3653
|
+
const [resetChainIds, setResetChainIds] = useState10(/* @__PURE__ */ new Set());
|
|
3654
|
+
const [drafts, setDrafts] = useState10({});
|
|
3655
|
+
const [initialDrafts, setInitialDrafts] = useState10({});
|
|
3656
|
+
const [submissionErrors, setSubmissionErrors] = useState10({});
|
|
3657
|
+
const [isInitialized, setIsInitialized] = useState10(false);
|
|
3658
|
+
const [isSaving, setIsSaving] = useState10(false);
|
|
3659
|
+
const networks = useMemo6(() => {
|
|
3660
|
+
var _a, _b, _c;
|
|
3661
|
+
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
3662
|
+
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
3663
|
+
return supportedChains.flatMap((chain) => {
|
|
3664
|
+
var _a2, _b2;
|
|
3665
|
+
const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
|
|
3666
|
+
if (!usdcToken) return [];
|
|
3667
|
+
const presentation = NETWORK_PRESENTATION[chain.chainId];
|
|
3668
|
+
const chainBalance = availableBalanceBreakdown.find(
|
|
3669
|
+
(balance) => balance.key === String(chain.chainId)
|
|
3670
|
+
);
|
|
3671
|
+
return [
|
|
3672
|
+
{
|
|
3673
|
+
chainId: chain.chainId,
|
|
3674
|
+
name: (_a2 = presentation == null ? void 0 : presentation.name) != null ? _a2 : chain.name,
|
|
3675
|
+
balance: chainBalance == null ? void 0 : chainBalance.balance,
|
|
3676
|
+
policy: policiesQuery.policies.find(
|
|
3677
|
+
(policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
|
|
3678
|
+
),
|
|
3679
|
+
venues: (_b2 = presentation == null ? void 0 : presentation.venues) != null ? _b2 : []
|
|
3680
|
+
}
|
|
3681
|
+
];
|
|
3682
|
+
}).sort((left, right) => {
|
|
3683
|
+
var _a2, _b2, _c2, _d;
|
|
3684
|
+
const leftOrder = (_b2 = (_a2 = NETWORK_PRESENTATION[left.chainId]) == null ? void 0 : _a2.order) != null ? _b2 : Number.MAX_SAFE_INTEGER;
|
|
3685
|
+
const rightOrder = (_d = (_c2 = NETWORK_PRESENTATION[right.chainId]) == null ? void 0 : _c2.order) != null ? _d : Number.MAX_SAFE_INTEGER;
|
|
3686
|
+
if (leftOrder !== rightOrder) return leftOrder - rightOrder;
|
|
3687
|
+
return left.name.localeCompare(right.name);
|
|
3688
|
+
});
|
|
3689
|
+
}, [
|
|
3690
|
+
balanceState.availableBalanceBreakdown,
|
|
3691
|
+
balanceState.balanceBreakdown,
|
|
3692
|
+
depositAddressesQuery.supportedChains,
|
|
3693
|
+
policiesQuery.policies
|
|
3694
|
+
]);
|
|
3695
|
+
const isLoading = depositAddressesQuery.isLoading || policiesQuery.isLoading || balanceState.isLoading || open && !depositAddressesQuery.isReady && !depositAddressesQuery.isError && !depositAddressesQuery.isTimedOut;
|
|
3696
|
+
const hasDepositAddressesLoadError = !depositAddressesQuery.isReady && (depositAddressesQuery.isError || depositAddressesQuery.isTimedOut);
|
|
3697
|
+
const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
|
|
3698
|
+
const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
|
|
3699
|
+
const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
|
|
3700
|
+
useEffect9(() => {
|
|
3701
|
+
if (open) return;
|
|
3702
|
+
setExpandedChainIds(/* @__PURE__ */ new Set());
|
|
3703
|
+
setResetChainIds(/* @__PURE__ */ new Set());
|
|
3704
|
+
setDrafts({});
|
|
3705
|
+
setInitialDrafts({});
|
|
3706
|
+
setSubmissionErrors({});
|
|
3707
|
+
setIsInitialized(false);
|
|
3708
|
+
setIsSaving(false);
|
|
3709
|
+
savingRef.current = false;
|
|
3710
|
+
}, [open]);
|
|
3711
|
+
useEffect9(() => {
|
|
3712
|
+
if (!open || isLoading || hasLoadError || isInitialized) return;
|
|
3713
|
+
const nextDrafts = Object.fromEntries(
|
|
3714
|
+
networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
|
|
3715
|
+
);
|
|
3716
|
+
setDrafts(nextDrafts);
|
|
3717
|
+
setInitialDrafts(nextDrafts);
|
|
3718
|
+
setIsInitialized(true);
|
|
3719
|
+
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
3720
|
+
const validateDraft = useCallback5(
|
|
3721
|
+
(network, draft) => {
|
|
3722
|
+
const errors = {};
|
|
3723
|
+
const minimum = draft.minimum.trim();
|
|
3724
|
+
const refillTo = draft.refillTo.trim();
|
|
3725
|
+
if (!minimum) {
|
|
3726
|
+
errors.minimum = refillLabels.requiredError;
|
|
3727
|
+
} else if (!FINAL_AMOUNT_PATTERN.test(minimum)) {
|
|
3728
|
+
errors.minimum = refillLabels.precisionError;
|
|
3729
|
+
}
|
|
3730
|
+
if (!refillTo) {
|
|
3731
|
+
errors.refillTo = refillLabels.requiredError;
|
|
3732
|
+
} else if (!FINAL_AMOUNT_PATTERN.test(refillTo)) {
|
|
3733
|
+
errors.refillTo = refillLabels.precisionError;
|
|
3734
|
+
}
|
|
3735
|
+
const minimumRaw = decimalToRaw(minimum);
|
|
3736
|
+
const refillToRaw = decimalToRaw(refillTo);
|
|
3737
|
+
if (minimumRaw === "0") errors.minimum = refillLabels.positiveError;
|
|
3738
|
+
if (refillToRaw === "0") errors.refillTo = refillLabels.positiveError;
|
|
3739
|
+
if (minimumRaw !== null && refillToRaw !== null && BigInt(refillToRaw) < BigInt(minimumRaw)) {
|
|
3740
|
+
errors.refillTo = refillLabels.relationshipError;
|
|
3741
|
+
}
|
|
3742
|
+
const maximumRaw = getPolicyMaximumRaw(network.policy);
|
|
3743
|
+
if (maximumRaw !== null) {
|
|
3744
|
+
const maximumLabel = rawToDecimal(maximumRaw);
|
|
3745
|
+
if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
|
|
3746
|
+
errors.minimum = refillLabels.maximumError(maximumLabel);
|
|
3747
|
+
}
|
|
3748
|
+
if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
|
|
3749
|
+
errors.refillTo = refillLabels.maximumError(maximumLabel);
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
return errors;
|
|
3753
|
+
},
|
|
3754
|
+
[refillLabels]
|
|
3755
|
+
);
|
|
3756
|
+
const dirtyNetworks = useMemo6(
|
|
3757
|
+
() => networks.filter((network) => {
|
|
3758
|
+
if (network.venues.length === 0) return false;
|
|
3759
|
+
if (resetChainIds.has(network.chainId)) return true;
|
|
3760
|
+
const draft = drafts[network.chainId];
|
|
3761
|
+
const initialDraft = initialDrafts[network.chainId];
|
|
3762
|
+
if (!draft || !initialDraft) return false;
|
|
3763
|
+
return !areDraftsEqual(draft, initialDraft);
|
|
3764
|
+
}),
|
|
3765
|
+
[drafts, initialDrafts, networks, resetChainIds]
|
|
3766
|
+
);
|
|
3767
|
+
const validationErrors = useMemo6(
|
|
3768
|
+
() => Object.fromEntries(
|
|
3769
|
+
dirtyNetworks.map((network) => {
|
|
3770
|
+
var _a;
|
|
3771
|
+
return [
|
|
3772
|
+
network.chainId,
|
|
3773
|
+
resetChainIds.has(network.chainId) ? {} : validateDraft(network, (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy))
|
|
3774
|
+
];
|
|
3775
|
+
})
|
|
3776
|
+
),
|
|
3777
|
+
[dirtyNetworks, drafts, resetChainIds, validateDraft]
|
|
3778
|
+
);
|
|
3779
|
+
const hasValidationErrors = Object.values(validationErrors).some(
|
|
3780
|
+
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
3781
|
+
);
|
|
3782
|
+
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
3783
|
+
const handleOpenChange = useCallback5(
|
|
3784
|
+
(nextOpen) => {
|
|
3785
|
+
if (isSaving && !nextOpen) return;
|
|
3786
|
+
onOpenChange(nextOpen);
|
|
3787
|
+
},
|
|
3788
|
+
[isSaving, onOpenChange]
|
|
3789
|
+
);
|
|
3790
|
+
const handleToggleNetwork = useCallback5((chainId, canManageBalance) => {
|
|
3791
|
+
if (!canManageBalance) return;
|
|
3792
|
+
setExpandedChainIds((current) => {
|
|
3793
|
+
const next = new Set(current);
|
|
3794
|
+
if (next.has(chainId)) next.delete(chainId);
|
|
3795
|
+
else next.add(chainId);
|
|
3796
|
+
return next;
|
|
3797
|
+
});
|
|
3798
|
+
}, []);
|
|
3799
|
+
const handleDraftChange = useCallback5(
|
|
3800
|
+
(chainId, field, value) => {
|
|
3801
|
+
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
3802
|
+
setDrafts((current) => {
|
|
3803
|
+
var _a;
|
|
3804
|
+
const currentDraft = (_a = current[chainId]) != null ? _a : { minimum: "0", refillTo: "0" };
|
|
3805
|
+
const nextDraft = __spreadProps(__spreadValues({}, currentDraft), { [field]: value });
|
|
3806
|
+
if (field === "minimum") {
|
|
3807
|
+
const minimumRaw = decimalToRaw(value);
|
|
3808
|
+
const refillToRaw = decimalToRaw(currentDraft.refillTo);
|
|
3809
|
+
if (minimumRaw !== null && refillToRaw !== null && BigInt(minimumRaw) > BigInt(refillToRaw)) {
|
|
3810
|
+
nextDraft.refillTo = value;
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
return __spreadProps(__spreadValues({}, current), { [chainId]: nextDraft });
|
|
3814
|
+
});
|
|
3815
|
+
setResetChainIds((current) => {
|
|
3816
|
+
if (!current.has(chainId)) return current;
|
|
3817
|
+
const next = new Set(current);
|
|
3818
|
+
next.delete(chainId);
|
|
3819
|
+
return next;
|
|
3820
|
+
});
|
|
3821
|
+
setSubmissionErrors((current) => {
|
|
3822
|
+
if (!current[chainId]) return current;
|
|
3823
|
+
return __spreadProps(__spreadValues({}, current), { [chainId]: {} });
|
|
3824
|
+
});
|
|
3825
|
+
},
|
|
3826
|
+
[]
|
|
3827
|
+
);
|
|
3828
|
+
const handleResetNetwork = useCallback5((network) => {
|
|
3829
|
+
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
3830
|
+
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
3831
|
+
}));
|
|
3832
|
+
setResetChainIds((current) => {
|
|
3833
|
+
var _a;
|
|
3834
|
+
const next = new Set(current);
|
|
3835
|
+
if (((_a = network.policy) == null ? void 0 : _a.status) === "enabled") next.add(network.chainId);
|
|
3836
|
+
else next.delete(network.chainId);
|
|
3837
|
+
return next;
|
|
3838
|
+
});
|
|
3839
|
+
setSubmissionErrors((current) => {
|
|
3840
|
+
if (!current[network.chainId]) return current;
|
|
3841
|
+
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
3842
|
+
});
|
|
3843
|
+
}, []);
|
|
3844
|
+
const handleAmountBlur = useCallback5((chainId, field) => {
|
|
3845
|
+
setDrafts((current) => {
|
|
3846
|
+
const currentDraft = current[chainId];
|
|
3847
|
+
if (!currentDraft) return current;
|
|
3848
|
+
const rawValue = decimalToRaw(currentDraft[field]);
|
|
3849
|
+
if (rawValue === null) return current;
|
|
3850
|
+
return __spreadProps(__spreadValues({}, current), {
|
|
3851
|
+
[chainId]: __spreadProps(__spreadValues({}, currentDraft), { [field]: rawToDecimal(rawValue) })
|
|
3852
|
+
});
|
|
3853
|
+
});
|
|
3854
|
+
}, []);
|
|
3855
|
+
const handleRetry = useCallback5(() => {
|
|
3856
|
+
void depositAddressesQuery.refetch();
|
|
3857
|
+
void policiesQuery.refetch();
|
|
3858
|
+
balanceState.refetch();
|
|
3859
|
+
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
3860
|
+
const handleSave = useCallback5(() => __async(null, null, function* () {
|
|
3861
|
+
if (savingRef.current || isSaveDisabled) return;
|
|
3862
|
+
savingRef.current = true;
|
|
3863
|
+
setIsSaving(true);
|
|
3864
|
+
setSubmissionErrors({});
|
|
3865
|
+
const nextInitialDrafts = __spreadValues({}, initialDrafts);
|
|
3866
|
+
const nextResetChainIds = new Set(resetChainIds);
|
|
3867
|
+
let failureCount = 0;
|
|
3868
|
+
yield Promise.all(
|
|
3869
|
+
dirtyNetworks.map((network) => __async(null, null, function* () {
|
|
3870
|
+
const draft = drafts[network.chainId];
|
|
3871
|
+
if (!draft) return;
|
|
3872
|
+
try {
|
|
3873
|
+
const isResetting = resetChainIds.has(network.chainId);
|
|
3874
|
+
const minimumRaw = decimalToRaw(draft.minimum);
|
|
3875
|
+
const refillAmountRaw = decimalToRaw(draft.refillTo);
|
|
3876
|
+
let savedPolicy;
|
|
3877
|
+
if (isResetting) {
|
|
3878
|
+
if (!network.policy) return;
|
|
3879
|
+
savedPolicy = yield policiesQuery.updatePolicy.mutateAsync({
|
|
3880
|
+
policyId: network.policy.id,
|
|
3881
|
+
params: { status: "paused" }
|
|
3882
|
+
});
|
|
3883
|
+
} else {
|
|
3884
|
+
if (minimumRaw === null || refillAmountRaw === null) return;
|
|
3885
|
+
savedPolicy = network.policy ? yield policiesQuery.updatePolicy.mutateAsync({
|
|
3886
|
+
policyId: network.policy.id,
|
|
3887
|
+
params: { minimumRaw, refillAmountRaw, status: "enabled" }
|
|
3888
|
+
}) : yield policiesQuery.createPolicy.mutateAsync({
|
|
3889
|
+
targetChainId: network.chainId,
|
|
3890
|
+
targetTokenSymbol: "USDC",
|
|
3891
|
+
minimumRaw,
|
|
3892
|
+
refillAmountRaw
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
nextInitialDrafts[network.chainId] = getInitialDraft(savedPolicy);
|
|
3896
|
+
nextResetChainIds.delete(network.chainId);
|
|
3897
|
+
} catch (error) {
|
|
3898
|
+
failureCount += 1;
|
|
3899
|
+
const fieldErrors = getApiFieldErrors(error);
|
|
3900
|
+
const nextErrors = {};
|
|
3901
|
+
fieldErrors.forEach((fieldError) => {
|
|
3902
|
+
if (!fieldError.message) return;
|
|
3903
|
+
if (fieldError.field === "minimumRaw") nextErrors.minimum = fieldError.message;
|
|
3904
|
+
else if (fieldError.field === "refillAmountRaw") {
|
|
3905
|
+
nextErrors.refillTo = fieldError.message;
|
|
3906
|
+
} else nextErrors.general = fieldError.message;
|
|
3907
|
+
});
|
|
3908
|
+
if (!nextErrors.minimum && !nextErrors.refillTo && !nextErrors.general) {
|
|
3909
|
+
nextErrors.general = getApiErrorMessage(error, refillLabels.saveError);
|
|
3910
|
+
}
|
|
3911
|
+
setSubmissionErrors((current) => __spreadProps(__spreadValues({}, current), {
|
|
3912
|
+
[network.chainId]: nextErrors
|
|
3913
|
+
}));
|
|
3914
|
+
}
|
|
3915
|
+
}))
|
|
3916
|
+
);
|
|
3917
|
+
setInitialDrafts(nextInitialDrafts);
|
|
3918
|
+
setResetChainIds(nextResetChainIds);
|
|
3919
|
+
if (failureCount === 0) {
|
|
3920
|
+
yield policiesQuery.refetch();
|
|
3921
|
+
toastContext == null ? void 0 : toastContext.toast(refillLabels.saved, { tone: "success" });
|
|
3922
|
+
} else {
|
|
3923
|
+
toastContext == null ? void 0 : toastContext.toast(refillLabels.saveError, { tone: "error" });
|
|
3924
|
+
}
|
|
3925
|
+
savingRef.current = false;
|
|
3926
|
+
setIsSaving(false);
|
|
3927
|
+
}), [
|
|
3928
|
+
dirtyNetworks,
|
|
3929
|
+
drafts,
|
|
3930
|
+
initialDrafts,
|
|
3931
|
+
isSaveDisabled,
|
|
3932
|
+
policiesQuery,
|
|
3933
|
+
refillLabels,
|
|
3934
|
+
resetChainIds,
|
|
3935
|
+
toastContext
|
|
3936
|
+
]);
|
|
3937
|
+
return /* @__PURE__ */ jsx10(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs9(
|
|
3938
|
+
Modal.Container,
|
|
3939
|
+
{
|
|
3940
|
+
maxWidth: "600px",
|
|
3941
|
+
"aria-label": refillLabels.manageTitle,
|
|
3942
|
+
classNames: {
|
|
3943
|
+
container: "max-h-[calc(100%-2rem)] border-0 ring-1 ring-inset ring-agg-separator md:max-h-[calc(100%-2rem)]"
|
|
3944
|
+
},
|
|
3945
|
+
children: [
|
|
3946
|
+
/* @__PURE__ */ jsx10(
|
|
3947
|
+
Modal.Header,
|
|
3948
|
+
{
|
|
3949
|
+
title: refillLabels.manageTitle,
|
|
3950
|
+
subtitle: refillLabels.manageDescription,
|
|
3951
|
+
hideBorder: true,
|
|
3952
|
+
classNames: {
|
|
3953
|
+
root: "static min-h-0 shrink-0",
|
|
3954
|
+
container: "relative items-start! px-8! pt-7! pb-0!",
|
|
3955
|
+
title: "text-agg-2xl leading-agg-8",
|
|
3956
|
+
titleContainer: "flex max-w-none! flex-col gap-2",
|
|
3957
|
+
subtitle: "text-agg-sm! leading-agg-5! text-agg-foreground!",
|
|
3958
|
+
close: "absolute top-7 right-8"
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
),
|
|
3962
|
+
/* @__PURE__ */ jsx10(Dialog2.Description, { className: "sr-only", children: refillLabels.manageDescription }),
|
|
3963
|
+
/* @__PURE__ */ jsx10(Modal.Body, { classNames: { root: "min-h-0 px-8! pt-6! pb-0!" }, children: isLoading ? /* @__PURE__ */ jsx10("div", { role: "status", "aria-label": refillLabels.modalLoading, className: "h-[448px]", children: Array.from({ length: 7 }, (_, index) => /* @__PURE__ */ jsxs9(
|
|
3964
|
+
"div",
|
|
3965
|
+
{
|
|
3966
|
+
className: "flex h-16 items-center gap-3 border-b border-agg-separator last:border-b-0",
|
|
3967
|
+
children: [
|
|
3968
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "size-4 shrink-0 rounded-[4px]" }),
|
|
3969
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-5 w-20 rounded-agg-sm" }),
|
|
3970
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-6 w-20 rounded-agg-full" }),
|
|
3971
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "ml-auto h-4 w-20 rounded-agg-sm" }),
|
|
3972
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-5 w-12 rounded-agg-sm" }),
|
|
3973
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "size-4 rounded-agg-sm" })
|
|
3974
|
+
]
|
|
3975
|
+
},
|
|
3976
|
+
index
|
|
3977
|
+
)) }) : hasLoadError ? /* @__PURE__ */ jsx10(
|
|
3978
|
+
StateMessage,
|
|
3979
|
+
{
|
|
3980
|
+
icon: /* @__PURE__ */ jsx10(Icon, { name: "error-filled" }),
|
|
3981
|
+
title: refillLabels.modalLoadError,
|
|
3982
|
+
description: getApiErrorMessage(loadError, refillLabels.modalLoadError),
|
|
3983
|
+
onAction: handleRetry,
|
|
3984
|
+
classNames: { root: "h-[448px] min-h-[448px]" }
|
|
3985
|
+
}
|
|
3986
|
+
) : networks.length === 0 ? /* @__PURE__ */ jsx10(
|
|
3987
|
+
StateMessage,
|
|
3988
|
+
{
|
|
3989
|
+
icon: /* @__PURE__ */ jsx10(Icon, { name: "search-empty" }),
|
|
3990
|
+
title: refillLabels.modalEmptyTitle,
|
|
3991
|
+
description: refillLabels.modalEmptyDescription,
|
|
3992
|
+
classNames: { root: "h-[448px] min-h-[448px]" }
|
|
3993
|
+
}
|
|
3994
|
+
) : /* @__PURE__ */ jsx10("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
|
|
3995
|
+
var _a, _b, _c, _d, _e;
|
|
3996
|
+
const canManageBalance = network.venues.length > 0;
|
|
3997
|
+
const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
|
|
3998
|
+
const isLastNetwork = networkIndex === networks.length - 1;
|
|
3999
|
+
const isPendingReset = resetChainIds.has(network.chainId);
|
|
4000
|
+
const draft = (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy);
|
|
4001
|
+
const initialDraft = (_b = initialDrafts[network.chainId]) != null ? _b : getInitialDraft(network.policy);
|
|
4002
|
+
const isDirty = isPendingReset || !areDraftsEqual(draft, initialDraft);
|
|
4003
|
+
const rowValidationErrors = isDirty ? (_c = validationErrors[network.chainId]) != null ? _c : {} : {};
|
|
4004
|
+
const rowSubmissionErrors = (_d = submissionErrors[network.chainId]) != null ? _d : {};
|
|
4005
|
+
const rowErrors = __spreadValues(__spreadValues({}, rowValidationErrors), rowSubmissionErrors);
|
|
4006
|
+
const isDraftValid = !rowValidationErrors.minimum && !rowValidationErrors.refillTo && !rowValidationErrors.general;
|
|
4007
|
+
const hasConfiguredAutoRefill = ((_e = network.policy) == null ? void 0 : _e.status) === "enabled" && !areDraftsEqual(initialDraft, { minimum: "0", refillTo: "0" });
|
|
4008
|
+
const hasDraftAutoRefill = isDirty && !isPendingReset && isDraftValid;
|
|
4009
|
+
const hasAutoRefill = !isPendingReset && (hasConfiguredAutoRefill || hasDraftAutoRefill);
|
|
4010
|
+
const minimumInputId = `${descriptionId}-${network.chainId}-minimum`;
|
|
4011
|
+
const refillToInputId = `${descriptionId}-${network.chainId}-refill-to`;
|
|
4012
|
+
const minimumErrorId = `${minimumInputId}-error`;
|
|
4013
|
+
const refillToErrorId = `${refillToInputId}-error`;
|
|
4014
|
+
const formattedBalance = network.balance === void 0 ? "$\u2014" : formatUsd(network.balance);
|
|
4015
|
+
return /* @__PURE__ */ jsxs9(
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
role: "listitem",
|
|
4019
|
+
className: cn(
|
|
4020
|
+
networkIndex > 0 && "pt-5",
|
|
4021
|
+
!isLastNetwork && "border-b border-agg-separator pb-5"
|
|
4022
|
+
),
|
|
4023
|
+
children: [
|
|
4024
|
+
/* @__PURE__ */ jsxs9(
|
|
4025
|
+
"button",
|
|
4026
|
+
{
|
|
4027
|
+
type: "button",
|
|
4028
|
+
"aria-expanded": isExpanded,
|
|
4029
|
+
"aria-controls": `${descriptionId}-${network.chainId}-settings`,
|
|
4030
|
+
"aria-label": isExpanded ? refillLabels.collapseNetwork(network.name) : refillLabels.expandNetwork(network.name),
|
|
4031
|
+
disabled: isSaving || !canManageBalance,
|
|
4032
|
+
className: cn(
|
|
4033
|
+
"group flex w-full cursor-pointer items-center gap-3 rounded-agg-sm text-left outline-none disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-agg-primary-hover",
|
|
4034
|
+
canManageBalance ? "h-6" : "h-5"
|
|
4035
|
+
),
|
|
4036
|
+
onClick: () => handleToggleNetwork(network.chainId, canManageBalance),
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4039
|
+
chainIconUrl(network.name, String(network.chainId)) ? /* @__PURE__ */ jsx10(
|
|
4040
|
+
"img",
|
|
4041
|
+
{
|
|
4042
|
+
src: chainIconUrl(network.name, String(network.chainId)),
|
|
4043
|
+
alt: "",
|
|
4044
|
+
"aria-hidden": "true",
|
|
4045
|
+
className: "size-4 shrink-0 rounded-[4px] object-contain"
|
|
4046
|
+
}
|
|
4047
|
+
) : /* @__PURE__ */ jsx10("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[8px] text-agg-muted-foreground", children: network.name.slice(0, 2).toUpperCase() }),
|
|
4048
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: network.name })
|
|
4049
|
+
] }),
|
|
4050
|
+
network.venues.length > 0 ? /* @__PURE__ */ jsx10("span", { className: "hidden min-w-0 items-center gap-2 min-[440px]:flex", children: network.venues.map((venue) => /* @__PURE__ */ jsxs9(
|
|
4051
|
+
"span",
|
|
4052
|
+
{
|
|
4053
|
+
className: "flex h-6 shrink-0 items-center gap-1 rounded-agg-full bg-agg-secondary-hover px-3 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
4054
|
+
children: [
|
|
4055
|
+
/* @__PURE__ */ jsx10(VenueLogo, { venue, size: "small", className: "size-3" }),
|
|
4056
|
+
VENUE_LABELS[venue]
|
|
4057
|
+
]
|
|
4058
|
+
},
|
|
4059
|
+
venue
|
|
4060
|
+
)) }) : null,
|
|
4061
|
+
/* @__PURE__ */ jsxs9("span", { className: "ml-auto flex shrink-0 items-center gap-4", children: [
|
|
4062
|
+
canManageBalance ? /* @__PURE__ */ jsxs9(
|
|
4063
|
+
"span",
|
|
4064
|
+
{
|
|
4065
|
+
className: cn(
|
|
4066
|
+
"hidden shrink-0 items-center gap-1.5 text-agg-xs leading-agg-4 min-[520px]:flex",
|
|
4067
|
+
hasAutoRefill ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
4068
|
+
),
|
|
4069
|
+
children: [
|
|
4070
|
+
hasAutoRefill ? /* @__PURE__ */ jsx10(
|
|
4071
|
+
Icon,
|
|
4072
|
+
{
|
|
4073
|
+
name: "success-check",
|
|
4074
|
+
size: "small",
|
|
4075
|
+
className: "size-2! text-agg-foreground"
|
|
4076
|
+
}
|
|
4077
|
+
) : null,
|
|
4078
|
+
hasAutoRefill ? refillLabels.autoRefill : refillLabels.noAutoRefill
|
|
4079
|
+
]
|
|
4080
|
+
}
|
|
4081
|
+
) : null,
|
|
4082
|
+
/* @__PURE__ */ jsx10(
|
|
4083
|
+
"span",
|
|
4084
|
+
{
|
|
4085
|
+
title: formattedBalance,
|
|
4086
|
+
className: "w-[60px] shrink-0 truncate text-right text-agg-sm leading-agg-5 font-agg-bold tabular-nums text-agg-foreground",
|
|
4087
|
+
children: formattedBalance
|
|
4088
|
+
}
|
|
4089
|
+
),
|
|
4090
|
+
/* @__PURE__ */ jsx10(
|
|
4091
|
+
Icon,
|
|
4092
|
+
{
|
|
4093
|
+
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
4094
|
+
size: "small",
|
|
4095
|
+
className: cn(
|
|
4096
|
+
"size-4 shrink-0 text-agg-muted-foreground",
|
|
4097
|
+
canManageBalance ? "group-hover:text-agg-foreground" : "opacity-50"
|
|
4098
|
+
)
|
|
4099
|
+
}
|
|
4100
|
+
)
|
|
4101
|
+
] })
|
|
4102
|
+
]
|
|
4103
|
+
}
|
|
4104
|
+
),
|
|
4105
|
+
isExpanded ? /* @__PURE__ */ jsxs9("div", { id: `${descriptionId}-${network.chainId}-settings`, className: "mt-4", children: [
|
|
4106
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2", children: [
|
|
4107
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex w-[174px] shrink-0 items-start gap-2", children: [
|
|
4108
|
+
/* @__PURE__ */ jsx10(
|
|
4109
|
+
"label",
|
|
4110
|
+
{
|
|
4111
|
+
htmlFor: minimumInputId,
|
|
4112
|
+
className: "flex h-8 w-[26px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
|
|
4113
|
+
children: refillLabels.minimumShortLabel
|
|
4114
|
+
}
|
|
4115
|
+
),
|
|
4116
|
+
/* @__PURE__ */ jsxs9("div", { className: "w-[140px]", children: [
|
|
4117
|
+
/* @__PURE__ */ jsxs9(
|
|
4118
|
+
"div",
|
|
4119
|
+
{
|
|
4120
|
+
className: cn(
|
|
4121
|
+
"flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
|
|
4122
|
+
rowErrors.minimum ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
|
|
4123
|
+
),
|
|
4124
|
+
children: [
|
|
4125
|
+
/* @__PURE__ */ jsx10(
|
|
4126
|
+
"input",
|
|
4127
|
+
{
|
|
4128
|
+
id: minimumInputId,
|
|
4129
|
+
type: "text",
|
|
4130
|
+
inputMode: "decimal",
|
|
4131
|
+
autoComplete: "off",
|
|
4132
|
+
value: draft.minimum,
|
|
4133
|
+
disabled: isSaving,
|
|
4134
|
+
"aria-invalid": Boolean(rowErrors.minimum),
|
|
4135
|
+
"aria-describedby": rowErrors.minimum ? minimumErrorId : void 0,
|
|
4136
|
+
className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
|
|
4137
|
+
onChange: (event) => handleDraftChange(
|
|
4138
|
+
network.chainId,
|
|
4139
|
+
"minimum",
|
|
4140
|
+
event.target.value
|
|
4141
|
+
),
|
|
4142
|
+
onBlur: () => handleAmountBlur(network.chainId, "minimum")
|
|
4143
|
+
}
|
|
4144
|
+
),
|
|
4145
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
|
|
4146
|
+
]
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
rowErrors.minimum ? /* @__PURE__ */ jsx10(
|
|
4150
|
+
"p",
|
|
4151
|
+
{
|
|
4152
|
+
id: minimumErrorId,
|
|
4153
|
+
role: "alert",
|
|
4154
|
+
className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
|
|
4155
|
+
children: rowErrors.minimum
|
|
4156
|
+
}
|
|
4157
|
+
) : null
|
|
4158
|
+
] })
|
|
4159
|
+
] }),
|
|
4160
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex w-[200px] shrink-0 items-start gap-2", children: [
|
|
4161
|
+
/* @__PURE__ */ jsx10(
|
|
4162
|
+
"label",
|
|
4163
|
+
{
|
|
4164
|
+
htmlFor: refillToInputId,
|
|
4165
|
+
className: "flex h-8 w-[52px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
|
|
4166
|
+
children: refillLabels.refillToLabel
|
|
4167
|
+
}
|
|
4168
|
+
),
|
|
4169
|
+
/* @__PURE__ */ jsxs9("div", { className: "w-[140px]", children: [
|
|
4170
|
+
/* @__PURE__ */ jsxs9(
|
|
4171
|
+
"div",
|
|
4172
|
+
{
|
|
4173
|
+
className: cn(
|
|
4174
|
+
"flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
|
|
4175
|
+
rowErrors.refillTo ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
|
|
4176
|
+
),
|
|
4177
|
+
children: [
|
|
4178
|
+
/* @__PURE__ */ jsx10(
|
|
4179
|
+
"input",
|
|
4180
|
+
{
|
|
4181
|
+
id: refillToInputId,
|
|
4182
|
+
type: "text",
|
|
4183
|
+
inputMode: "decimal",
|
|
4184
|
+
autoComplete: "off",
|
|
4185
|
+
value: draft.refillTo,
|
|
4186
|
+
disabled: isSaving,
|
|
4187
|
+
"aria-invalid": Boolean(rowErrors.refillTo),
|
|
4188
|
+
"aria-describedby": rowErrors.refillTo ? refillToErrorId : void 0,
|
|
4189
|
+
className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
|
|
4190
|
+
onChange: (event) => handleDraftChange(
|
|
4191
|
+
network.chainId,
|
|
4192
|
+
"refillTo",
|
|
4193
|
+
event.target.value
|
|
4194
|
+
),
|
|
4195
|
+
onBlur: () => handleAmountBlur(network.chainId, "refillTo")
|
|
4196
|
+
}
|
|
4197
|
+
),
|
|
4198
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
|
|
4199
|
+
]
|
|
4200
|
+
}
|
|
4201
|
+
),
|
|
4202
|
+
rowErrors.refillTo ? /* @__PURE__ */ jsx10(
|
|
4203
|
+
"p",
|
|
4204
|
+
{
|
|
4205
|
+
id: refillToErrorId,
|
|
4206
|
+
role: "alert",
|
|
4207
|
+
className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
|
|
4208
|
+
children: rowErrors.refillTo
|
|
4209
|
+
}
|
|
4210
|
+
) : null
|
|
4211
|
+
] })
|
|
4212
|
+
] }),
|
|
4213
|
+
hasAutoRefill ? /* @__PURE__ */ jsx10(
|
|
4214
|
+
"button",
|
|
4215
|
+
{
|
|
4216
|
+
type: "button",
|
|
4217
|
+
disabled: isSaving,
|
|
4218
|
+
className: "shrink-0 mt-1.5 cursor-pointer text-agg-sm leading-agg-5 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
4219
|
+
onClick: () => handleResetNetwork(network),
|
|
4220
|
+
children: refillLabels.resetAction
|
|
4221
|
+
}
|
|
4222
|
+
) : null
|
|
4223
|
+
] }),
|
|
4224
|
+
rowErrors.general ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "mt-2 text-agg-xs leading-agg-4 text-agg-error", children: rowErrors.general }) : null
|
|
4225
|
+
] }) : null
|
|
4226
|
+
]
|
|
4227
|
+
},
|
|
4228
|
+
network.chainId
|
|
4229
|
+
);
|
|
4230
|
+
}) }) }),
|
|
4231
|
+
/* @__PURE__ */ jsxs9(
|
|
4232
|
+
Modal.Footer,
|
|
4233
|
+
{
|
|
4234
|
+
hideBorder: true,
|
|
4235
|
+
classNames: {
|
|
4236
|
+
root: "h-[92px]! shrink-0 items-start! gap-3 px-8! pt-6! pb-7!"
|
|
4237
|
+
},
|
|
4238
|
+
children: [
|
|
4239
|
+
/* @__PURE__ */ jsx10(
|
|
4240
|
+
Button,
|
|
4241
|
+
{
|
|
4242
|
+
variant: "secondary",
|
|
4243
|
+
size: "large",
|
|
4244
|
+
className: "min-w-0 flex-1 md:w-[120px] md:flex-none",
|
|
4245
|
+
disabled: isSaving,
|
|
4246
|
+
onClick: () => handleOpenChange(false),
|
|
4247
|
+
children: refillLabels.cancelAction
|
|
4248
|
+
}
|
|
4249
|
+
),
|
|
4250
|
+
/* @__PURE__ */ jsx10(
|
|
4251
|
+
Button,
|
|
4252
|
+
{
|
|
4253
|
+
size: "large",
|
|
4254
|
+
className: "min-w-0 flex-1 md:w-[158px] md:flex-none",
|
|
4255
|
+
isLoading: isSaving,
|
|
4256
|
+
disabled: isSaveDisabled,
|
|
4257
|
+
"aria-label": refillLabels.saveChangesAction,
|
|
4258
|
+
onClick: () => void handleSave(),
|
|
4259
|
+
children: refillLabels.saveChangesAction
|
|
4260
|
+
}
|
|
4261
|
+
)
|
|
4262
|
+
]
|
|
4263
|
+
}
|
|
4264
|
+
)
|
|
4265
|
+
]
|
|
4266
|
+
}
|
|
4267
|
+
) });
|
|
4268
|
+
};
|
|
4269
|
+
ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
4270
|
+
|
|
3503
4271
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
3504
|
-
import { optimizedImageUrl as optimizedImageUrl3, useLabels as
|
|
3505
|
-
import { Fragment as Fragment4, useEffect as
|
|
4272
|
+
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
4273
|
+
import { Fragment as Fragment4, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
|
|
3506
4274
|
|
|
3507
4275
|
// src/pages/user-profile/user-profile.constants.ts
|
|
3508
4276
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -3551,17 +4319,19 @@ var parsePercentLabel = (label) => {
|
|
|
3551
4319
|
const parsed = Number(match[1].replace(/,/g, ""));
|
|
3552
4320
|
return Number.isFinite(parsed) ? parsed : null;
|
|
3553
4321
|
};
|
|
3554
|
-
var formatCurrency = (value) => {
|
|
4322
|
+
var formatCurrency = (value, formatCurrencyOverride) => {
|
|
3555
4323
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
4324
|
+
if (formatCurrencyOverride) return formatCurrencyOverride(value);
|
|
3556
4325
|
return usdFormatter.format(value);
|
|
3557
4326
|
};
|
|
3558
|
-
var formatSignedCurrency = (value) => {
|
|
4327
|
+
var formatSignedCurrency = (value, formatCurrencyOverride) => {
|
|
3559
4328
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
3560
|
-
if (value === 0) return
|
|
3561
|
-
return `${value > 0 ? "+" : "-"}${
|
|
4329
|
+
if (value === 0) return formatCurrency(0, formatCurrencyOverride);
|
|
4330
|
+
return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
|
|
3562
4331
|
};
|
|
3563
|
-
var formatPriceCents = (value) => {
|
|
4332
|
+
var formatPriceCents = (value, formatPrice) => {
|
|
3564
4333
|
if (!isFiniteNumber(value)) return missingLabel;
|
|
4334
|
+
if (formatPrice) return formatPrice(value);
|
|
3565
4335
|
return `${Math.round(value * 100)}\xA2`;
|
|
3566
4336
|
};
|
|
3567
4337
|
var formatSignedPercent = (value) => {
|
|
@@ -3656,7 +4426,8 @@ var getPositionTone = (value) => {
|
|
|
3656
4426
|
if (!isFiniteNumber(value) || value === 0) return "neutral";
|
|
3657
4427
|
return value > 0 ? "positive" : "negative";
|
|
3658
4428
|
};
|
|
3659
|
-
var toPositionRowViewModel = (position, labels = defaultLabels) => {
|
|
4429
|
+
var toPositionRowViewModel = (position, labels = defaultLabels, formatters = {}) => {
|
|
4430
|
+
const { formatCurrency: currency, formatPrice: price } = formatters;
|
|
3660
4431
|
const positionStatus = resolvePositionStatus(position);
|
|
3661
4432
|
const currentValue = getCurrentValue(position);
|
|
3662
4433
|
const currentPnl = getPnlValue(position, currentValue);
|
|
@@ -3674,20 +4445,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels) => {
|
|
|
3674
4445
|
resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
|
|
3675
4446
|
venueShareBreakdown: position.venueShareBreakdown,
|
|
3676
4447
|
totalTraded: {
|
|
3677
|
-
primaryLabel: formatCurrency(getTotalTradedValue(position)),
|
|
3678
|
-
averageLabel: `${labels.avgPrefix} ${formatPriceCents(getAveragePrice(position))}`
|
|
4448
|
+
primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
|
|
4449
|
+
averageLabel: `${labels.avgPrefix} ${formatPriceCents(getAveragePrice(position), price)}`
|
|
3679
4450
|
},
|
|
3680
4451
|
currentValue: {
|
|
3681
|
-
primaryLabel: formatCurrency(currentValue),
|
|
3682
|
-
deltaLabel: formatSignedCurrency(currentPnl),
|
|
3683
|
-
priceLabel: `${labels.nowPrefix} ${formatPriceCents(getCurrentPrice(position))}`,
|
|
4452
|
+
primaryLabel: formatCurrency(currentValue, currency),
|
|
4453
|
+
deltaLabel: formatSignedCurrency(currentPnl, currency),
|
|
4454
|
+
priceLabel: `${labels.nowPrefix} ${formatPriceCents(getCurrentPrice(position), price)}`,
|
|
3684
4455
|
percentLabel: formatSignedPercent(currentPercent),
|
|
3685
4456
|
tone: getPositionTone(currentPnl)
|
|
3686
4457
|
},
|
|
3687
4458
|
payout: {
|
|
3688
|
-
primaryLabel: formatCurrency(finalPayout),
|
|
3689
|
-
deltaLabel: formatSignedCurrency(payoutPnl),
|
|
3690
|
-
priceLabel: `${labels.finalPrefix} ${formatPriceCents(getFinalPrice(position))}`,
|
|
4459
|
+
primaryLabel: formatCurrency(finalPayout, currency),
|
|
4460
|
+
deltaLabel: formatSignedCurrency(payoutPnl, currency),
|
|
4461
|
+
priceLabel: `${labels.finalPrefix} ${formatPriceCents(getFinalPrice(position), price)}`,
|
|
3691
4462
|
percentLabel: formatSignedPercent(payoutPercent),
|
|
3692
4463
|
tone: getPositionTone(payoutPnl)
|
|
3693
4464
|
},
|
|
@@ -3699,7 +4470,7 @@ var toPositionRowViewModel = (position, labels = defaultLabels) => {
|
|
|
3699
4470
|
};
|
|
3700
4471
|
|
|
3701
4472
|
// src/pages/user-profile/components/activity-row.tsx
|
|
3702
|
-
import { Fragment as Fragment2, jsx as
|
|
4473
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3703
4474
|
var shouldOpenInNewTab = (activity) => {
|
|
3704
4475
|
return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
|
|
3705
4476
|
};
|
|
@@ -3716,7 +4487,7 @@ var RowWrapper = ({
|
|
|
3716
4487
|
}) => {
|
|
3717
4488
|
if (href) {
|
|
3718
4489
|
const opensInNewTab = target === "_blank";
|
|
3719
|
-
return /* @__PURE__ */
|
|
4490
|
+
return /* @__PURE__ */ jsx11(
|
|
3720
4491
|
"a",
|
|
3721
4492
|
{
|
|
3722
4493
|
href,
|
|
@@ -3732,7 +4503,7 @@ var RowWrapper = ({
|
|
|
3732
4503
|
}
|
|
3733
4504
|
);
|
|
3734
4505
|
}
|
|
3735
|
-
return /* @__PURE__ */
|
|
4506
|
+
return /* @__PURE__ */ jsx11("button", { type: "button", className, onClick, children });
|
|
3736
4507
|
};
|
|
3737
4508
|
var TRANSFER_ICON = {
|
|
3738
4509
|
withdrawal: "upload",
|
|
@@ -3767,7 +4538,7 @@ var AmountTimeStack = ({
|
|
|
3767
4538
|
timeLabel,
|
|
3768
4539
|
tone,
|
|
3769
4540
|
mobile
|
|
3770
|
-
}) => /* @__PURE__ */
|
|
4541
|
+
}) => /* @__PURE__ */ jsxs10(
|
|
3771
4542
|
"div",
|
|
3772
4543
|
{
|
|
3773
4544
|
className: cn(
|
|
@@ -3775,7 +4546,7 @@ var AmountTimeStack = ({
|
|
|
3775
4546
|
mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
|
|
3776
4547
|
),
|
|
3777
4548
|
children: [
|
|
3778
|
-
/* @__PURE__ */
|
|
4549
|
+
/* @__PURE__ */ jsx11(
|
|
3779
4550
|
"p",
|
|
3780
4551
|
{
|
|
3781
4552
|
className: cn(
|
|
@@ -3786,7 +4557,7 @@ var AmountTimeStack = ({
|
|
|
3786
4557
|
children: amountLabel
|
|
3787
4558
|
}
|
|
3788
4559
|
),
|
|
3789
|
-
/* @__PURE__ */
|
|
4560
|
+
/* @__PURE__ */ jsx11(
|
|
3790
4561
|
"p",
|
|
3791
4562
|
{
|
|
3792
4563
|
className: cn(
|
|
@@ -3803,9 +4574,9 @@ var AmountTimeStack = ({
|
|
|
3803
4574
|
var TradeTypeCell = ({
|
|
3804
4575
|
activity,
|
|
3805
4576
|
tone
|
|
3806
|
-
}) => /* @__PURE__ */
|
|
3807
|
-
/* @__PURE__ */
|
|
3808
|
-
/* @__PURE__ */
|
|
4577
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4578
|
+
/* @__PURE__ */ jsx11(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
|
|
4579
|
+
/* @__PURE__ */ jsx11(
|
|
3809
4580
|
"p",
|
|
3810
4581
|
{
|
|
3811
4582
|
className: cn(
|
|
@@ -3820,8 +4591,8 @@ var TradeTypeCell = ({
|
|
|
3820
4591
|
var TransferTypeCell = ({
|
|
3821
4592
|
activity,
|
|
3822
4593
|
tone
|
|
3823
|
-
}) => /* @__PURE__ */
|
|
3824
|
-
/* @__PURE__ */
|
|
4594
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4595
|
+
/* @__PURE__ */ jsx11(
|
|
3825
4596
|
Icon,
|
|
3826
4597
|
{
|
|
3827
4598
|
name: TRANSFER_ICON[activity.kind],
|
|
@@ -3832,7 +4603,7 @@ var TransferTypeCell = ({
|
|
|
3832
4603
|
)
|
|
3833
4604
|
}
|
|
3834
4605
|
),
|
|
3835
|
-
/* @__PURE__ */
|
|
4606
|
+
/* @__PURE__ */ jsx11(
|
|
3836
4607
|
"p",
|
|
3837
4608
|
{
|
|
3838
4609
|
className: cn(
|
|
@@ -3847,8 +4618,8 @@ var TransferTypeCell = ({
|
|
|
3847
4618
|
var RedeemTypeCell = ({
|
|
3848
4619
|
activity,
|
|
3849
4620
|
tone
|
|
3850
|
-
}) => /* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
4621
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4622
|
+
/* @__PURE__ */ jsx11(
|
|
3852
4623
|
Icon,
|
|
3853
4624
|
{
|
|
3854
4625
|
name: "gift-bonus",
|
|
@@ -3859,7 +4630,7 @@ var RedeemTypeCell = ({
|
|
|
3859
4630
|
)
|
|
3860
4631
|
}
|
|
3861
4632
|
),
|
|
3862
|
-
/* @__PURE__ */
|
|
4633
|
+
/* @__PURE__ */ jsx11(
|
|
3863
4634
|
"p",
|
|
3864
4635
|
{
|
|
3865
4636
|
className: cn(
|
|
@@ -3876,7 +4647,7 @@ var OutcomeBadge = ({
|
|
|
3876
4647
|
tone
|
|
3877
4648
|
}) => {
|
|
3878
4649
|
if (!label) return null;
|
|
3879
|
-
return /* @__PURE__ */
|
|
4650
|
+
return /* @__PURE__ */ jsx11("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx11(
|
|
3880
4651
|
"span",
|
|
3881
4652
|
{
|
|
3882
4653
|
className: cn(
|
|
@@ -3890,9 +4661,9 @@ var OutcomeBadge = ({
|
|
|
3890
4661
|
var TradeOutcomeShares = ({
|
|
3891
4662
|
activity,
|
|
3892
4663
|
tone
|
|
3893
|
-
}) => /* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
4664
|
+
}) => /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
4665
|
+
/* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone }),
|
|
4666
|
+
/* @__PURE__ */ jsx11(
|
|
3896
4667
|
"span",
|
|
3897
4668
|
{
|
|
3898
4669
|
className: cn(
|
|
@@ -3913,7 +4684,7 @@ var RedeemRow = ({
|
|
|
3913
4684
|
const statusVisual = getStatusVisual(activity);
|
|
3914
4685
|
const activityStatus = resolveActivityStatus(activity);
|
|
3915
4686
|
const shouldShowInlineStatus = activityStatus === "pending";
|
|
3916
|
-
return /* @__PURE__ */
|
|
4687
|
+
return /* @__PURE__ */ jsx11(
|
|
3917
4688
|
RowWrapper,
|
|
3918
4689
|
{
|
|
3919
4690
|
className,
|
|
@@ -3921,7 +4692,7 @@ var RedeemRow = ({
|
|
|
3921
4692
|
target: href ? "_blank" : void 0,
|
|
3922
4693
|
rel: href ? "noopener noreferrer" : void 0,
|
|
3923
4694
|
onClick,
|
|
3924
|
-
children: /* @__PURE__ */
|
|
4695
|
+
children: /* @__PURE__ */ jsxs10(
|
|
3925
4696
|
"div",
|
|
3926
4697
|
{
|
|
3927
4698
|
className: cn(
|
|
@@ -3930,10 +4701,10 @@ var RedeemRow = ({
|
|
|
3930
4701
|
),
|
|
3931
4702
|
"data-status": activityStatus,
|
|
3932
4703
|
children: [
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ jsx11(RedeemTypeCell, { activity, tone }),
|
|
4705
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
4706
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4707
|
+
/* @__PURE__ */ jsx11(
|
|
3937
4708
|
Icon,
|
|
3938
4709
|
{
|
|
3939
4710
|
name: "gift-bonus",
|
|
@@ -3944,7 +4715,7 @@ var RedeemRow = ({
|
|
|
3944
4715
|
)
|
|
3945
4716
|
}
|
|
3946
4717
|
),
|
|
3947
|
-
/* @__PURE__ */
|
|
4718
|
+
/* @__PURE__ */ jsx11(
|
|
3948
4719
|
"p",
|
|
3949
4720
|
{
|
|
3950
4721
|
className: cn(
|
|
@@ -3956,11 +4727,11 @@ var RedeemRow = ({
|
|
|
3956
4727
|
}
|
|
3957
4728
|
)
|
|
3958
4729
|
] }),
|
|
3959
|
-
/* @__PURE__ */
|
|
4730
|
+
/* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone })
|
|
3960
4731
|
] }),
|
|
3961
|
-
/* @__PURE__ */
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
4732
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4733
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4734
|
+
/* @__PURE__ */ jsx11("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx11(
|
|
3964
4735
|
RemoteImage,
|
|
3965
4736
|
{
|
|
3966
4737
|
src: activity.thumbnailSrc,
|
|
@@ -3969,9 +4740,9 @@ var RedeemRow = ({
|
|
|
3969
4740
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
3970
4741
|
}
|
|
3971
4742
|
) }),
|
|
3972
|
-
/* @__PURE__ */
|
|
3973
|
-
/* @__PURE__ */
|
|
3974
|
-
/* @__PURE__ */
|
|
4743
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
|
|
4744
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4745
|
+
/* @__PURE__ */ jsx11(
|
|
3975
4746
|
"p",
|
|
3976
4747
|
{
|
|
3977
4748
|
className: cn(
|
|
@@ -3981,13 +4752,13 @@ var RedeemRow = ({
|
|
|
3981
4752
|
children: activity.title
|
|
3982
4753
|
}
|
|
3983
4754
|
),
|
|
3984
|
-
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */
|
|
4755
|
+
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx11(
|
|
3985
4756
|
LoadingIcon,
|
|
3986
4757
|
{
|
|
3987
4758
|
size: "small",
|
|
3988
4759
|
className: cn("shrink-0", statusVisual.iconClassName)
|
|
3989
4760
|
}
|
|
3990
|
-
) : /* @__PURE__ */
|
|
4761
|
+
) : /* @__PURE__ */ jsx11(
|
|
3991
4762
|
Icon,
|
|
3992
4763
|
{
|
|
3993
4764
|
name: statusVisual.icon,
|
|
@@ -3996,9 +4767,9 @@ var RedeemRow = ({
|
|
|
3996
4767
|
}
|
|
3997
4768
|
) : null
|
|
3998
4769
|
] }),
|
|
3999
|
-
/* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4001
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
|
|
4771
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
|
|
4772
|
+
/* @__PURE__ */ jsx11(
|
|
4002
4773
|
"p",
|
|
4003
4774
|
{
|
|
4004
4775
|
className: cn(
|
|
@@ -4011,7 +4782,7 @@ var RedeemRow = ({
|
|
|
4011
4782
|
] })
|
|
4012
4783
|
] })
|
|
4013
4784
|
] }),
|
|
4014
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx11(
|
|
4015
4786
|
AmountTimeStack,
|
|
4016
4787
|
{
|
|
4017
4788
|
amountLabel: activity.amountLabel,
|
|
@@ -4021,7 +4792,7 @@ var RedeemRow = ({
|
|
|
4021
4792
|
}
|
|
4022
4793
|
)
|
|
4023
4794
|
] }),
|
|
4024
|
-
/* @__PURE__ */
|
|
4795
|
+
/* @__PURE__ */ jsx11(
|
|
4025
4796
|
AmountTimeStack,
|
|
4026
4797
|
{
|
|
4027
4798
|
amountLabel: activity.amountLabel,
|
|
@@ -4042,7 +4813,7 @@ var TradeRow = ({
|
|
|
4042
4813
|
onClick
|
|
4043
4814
|
}) => {
|
|
4044
4815
|
const tone = resolveToneClasses(activity);
|
|
4045
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ jsx11(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsxs10(
|
|
4046
4817
|
"div",
|
|
4047
4818
|
{
|
|
4048
4819
|
className: cn(
|
|
@@ -4050,10 +4821,10 @@ var TradeRow = ({
|
|
|
4050
4821
|
"relative z-10"
|
|
4051
4822
|
),
|
|
4052
4823
|
children: [
|
|
4053
|
-
/* @__PURE__ */
|
|
4054
|
-
/* @__PURE__ */
|
|
4055
|
-
/* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
4824
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
4825
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4826
|
+
/* @__PURE__ */ jsx11(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
|
|
4827
|
+
/* @__PURE__ */ jsx11(
|
|
4057
4828
|
"p",
|
|
4058
4829
|
{
|
|
4059
4830
|
className: cn(
|
|
@@ -4065,12 +4836,12 @@ var TradeRow = ({
|
|
|
4065
4836
|
}
|
|
4066
4837
|
)
|
|
4067
4838
|
] }),
|
|
4068
|
-
/* @__PURE__ */
|
|
4839
|
+
/* @__PURE__ */ jsx11("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx11(TradeOutcomeShares, { activity, tone }) })
|
|
4069
4840
|
] }),
|
|
4070
|
-
/* @__PURE__ */
|
|
4071
|
-
/* @__PURE__ */
|
|
4072
|
-
/* @__PURE__ */
|
|
4073
|
-
/* @__PURE__ */
|
|
4841
|
+
/* @__PURE__ */ jsx11(TradeTypeCell, { activity, tone }),
|
|
4842
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4843
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4844
|
+
/* @__PURE__ */ jsx11("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx11(
|
|
4074
4845
|
RemoteImage,
|
|
4075
4846
|
{
|
|
4076
4847
|
src: activity.thumbnailSrc,
|
|
@@ -4079,8 +4850,8 @@ var TradeRow = ({
|
|
|
4079
4850
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
4080
4851
|
}
|
|
4081
4852
|
) }),
|
|
4082
|
-
/* @__PURE__ */
|
|
4083
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
4854
|
+
/* @__PURE__ */ jsx11(
|
|
4084
4855
|
"p",
|
|
4085
4856
|
{
|
|
4086
4857
|
className: cn(
|
|
@@ -4090,10 +4861,10 @@ var TradeRow = ({
|
|
|
4090
4861
|
children: activity.title
|
|
4091
4862
|
}
|
|
4092
4863
|
),
|
|
4093
|
-
/* @__PURE__ */
|
|
4864
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx11(TradeOutcomeShares, { activity, tone }) })
|
|
4094
4865
|
] })
|
|
4095
4866
|
] }),
|
|
4096
|
-
/* @__PURE__ */
|
|
4867
|
+
/* @__PURE__ */ jsx11(
|
|
4097
4868
|
AmountTimeStack,
|
|
4098
4869
|
{
|
|
4099
4870
|
amountLabel: activity.amountLabel,
|
|
@@ -4103,7 +4874,7 @@ var TradeRow = ({
|
|
|
4103
4874
|
}
|
|
4104
4875
|
)
|
|
4105
4876
|
] }),
|
|
4106
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsx11(
|
|
4107
4878
|
AmountTimeStack,
|
|
4108
4879
|
{
|
|
4109
4880
|
amountLabel: activity.amountLabel,
|
|
@@ -4125,7 +4896,7 @@ var TransferRow = ({
|
|
|
4125
4896
|
const transferStatus = resolveActivityStatus(activity);
|
|
4126
4897
|
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
4127
4898
|
const statusVisual = getStatusVisual(activity);
|
|
4128
|
-
return /* @__PURE__ */
|
|
4899
|
+
return /* @__PURE__ */ jsx11(
|
|
4129
4900
|
RowWrapper,
|
|
4130
4901
|
{
|
|
4131
4902
|
className,
|
|
@@ -4133,7 +4904,7 @@ var TransferRow = ({
|
|
|
4133
4904
|
target: href ? "_blank" : void 0,
|
|
4134
4905
|
rel: href ? "noopener noreferrer" : void 0,
|
|
4135
4906
|
onClick,
|
|
4136
|
-
children: /* @__PURE__ */
|
|
4907
|
+
children: /* @__PURE__ */ jsxs10(
|
|
4137
4908
|
"div",
|
|
4138
4909
|
{
|
|
4139
4910
|
className: cn(
|
|
@@ -4141,9 +4912,9 @@ var TransferRow = ({
|
|
|
4141
4912
|
"relative z-10"
|
|
4142
4913
|
),
|
|
4143
4914
|
children: [
|
|
4144
|
-
/* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4915
|
+
/* @__PURE__ */ jsx11(TransferTypeCell, { activity, tone }),
|
|
4916
|
+
/* @__PURE__ */ jsx11("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4917
|
+
/* @__PURE__ */ jsx11(
|
|
4147
4918
|
Icon,
|
|
4148
4919
|
{
|
|
4149
4920
|
name: transferIconName,
|
|
@@ -4154,7 +4925,7 @@ var TransferRow = ({
|
|
|
4154
4925
|
)
|
|
4155
4926
|
}
|
|
4156
4927
|
),
|
|
4157
|
-
/* @__PURE__ */
|
|
4928
|
+
/* @__PURE__ */ jsx11(
|
|
4158
4929
|
"p",
|
|
4159
4930
|
{
|
|
4160
4931
|
className: cn(
|
|
@@ -4166,14 +4937,14 @@ var TransferRow = ({
|
|
|
4166
4937
|
}
|
|
4167
4938
|
)
|
|
4168
4939
|
] }) }),
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
/* @__PURE__ */
|
|
4171
|
-
/* @__PURE__ */
|
|
4940
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4941
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4942
|
+
/* @__PURE__ */ jsx11(
|
|
4172
4943
|
"div",
|
|
4173
4944
|
{
|
|
4174
4945
|
className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
|
|
4175
4946
|
"data-status": transferStatus,
|
|
4176
|
-
children: statusVisual.spin ? /* @__PURE__ */
|
|
4947
|
+
children: statusVisual.spin ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx11(
|
|
4177
4948
|
Icon,
|
|
4178
4949
|
{
|
|
4179
4950
|
name: statusVisual.icon,
|
|
@@ -4183,8 +4954,8 @@ var TransferRow = ({
|
|
|
4183
4954
|
)
|
|
4184
4955
|
}
|
|
4185
4956
|
),
|
|
4186
|
-
/* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4957
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
4958
|
+
/* @__PURE__ */ jsx11(
|
|
4188
4959
|
"p",
|
|
4189
4960
|
{
|
|
4190
4961
|
className: cn(
|
|
@@ -4194,7 +4965,7 @@ var TransferRow = ({
|
|
|
4194
4965
|
children: activity.title
|
|
4195
4966
|
}
|
|
4196
4967
|
),
|
|
4197
|
-
/* @__PURE__ */
|
|
4968
|
+
/* @__PURE__ */ jsx11(
|
|
4198
4969
|
"p",
|
|
4199
4970
|
{
|
|
4200
4971
|
className: cn(
|
|
@@ -4206,7 +4977,7 @@ var TransferRow = ({
|
|
|
4206
4977
|
)
|
|
4207
4978
|
] })
|
|
4208
4979
|
] }),
|
|
4209
|
-
/* @__PURE__ */
|
|
4980
|
+
/* @__PURE__ */ jsx11(
|
|
4210
4981
|
AmountTimeStack,
|
|
4211
4982
|
{
|
|
4212
4983
|
amountLabel: activity.amountLabel,
|
|
@@ -4216,7 +4987,7 @@ var TransferRow = ({
|
|
|
4216
4987
|
}
|
|
4217
4988
|
)
|
|
4218
4989
|
] }),
|
|
4219
|
-
/* @__PURE__ */
|
|
4990
|
+
/* @__PURE__ */ jsx11(
|
|
4220
4991
|
AmountTimeStack,
|
|
4221
4992
|
{
|
|
4222
4993
|
amountLabel: activity.amountLabel,
|
|
@@ -4242,10 +5013,10 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4242
5013
|
"before:bg-agg-secondary-hover before:rounded-agg-xl"
|
|
4243
5014
|
);
|
|
4244
5015
|
if (activity.kind === "trade") {
|
|
4245
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsx11(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
|
|
4246
5017
|
}
|
|
4247
5018
|
if (activity.kind === "redeem") {
|
|
4248
|
-
return /* @__PURE__ */
|
|
5019
|
+
return /* @__PURE__ */ jsx11(
|
|
4249
5020
|
RedeemRow,
|
|
4250
5021
|
{
|
|
4251
5022
|
activity,
|
|
@@ -4255,7 +5026,7 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4255
5026
|
}
|
|
4256
5027
|
);
|
|
4257
5028
|
}
|
|
4258
|
-
return /* @__PURE__ */
|
|
5029
|
+
return /* @__PURE__ */ jsx11(
|
|
4259
5030
|
TransferRow,
|
|
4260
5031
|
{
|
|
4261
5032
|
activity,
|
|
@@ -4268,19 +5039,19 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4268
5039
|
ActivityRow.displayName = "ActivityRow";
|
|
4269
5040
|
|
|
4270
5041
|
// src/pages/user-profile/components/empty-state.tsx
|
|
4271
|
-
import { jsx as
|
|
5042
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4272
5043
|
var EmptyState = ({ title, description, className }) => {
|
|
4273
|
-
return /* @__PURE__ */
|
|
5044
|
+
return /* @__PURE__ */ jsx12(
|
|
4274
5045
|
"div",
|
|
4275
5046
|
{
|
|
4276
5047
|
className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
|
|
4277
5048
|
role: "status",
|
|
4278
5049
|
"aria-live": "polite",
|
|
4279
|
-
children: /* @__PURE__ */
|
|
4280
|
-
/* @__PURE__ */
|
|
4281
|
-
/* @__PURE__ */
|
|
4282
|
-
/* @__PURE__ */
|
|
4283
|
-
description ? /* @__PURE__ */
|
|
5050
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-5", children: [
|
|
5051
|
+
/* @__PURE__ */ jsx12(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
|
|
5052
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
|
|
5053
|
+
/* @__PURE__ */ jsx12("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
|
|
5054
|
+
description ? /* @__PURE__ */ jsx12("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
|
|
4284
5055
|
] })
|
|
4285
5056
|
] })
|
|
4286
5057
|
}
|
|
@@ -4289,11 +5060,24 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
4289
5060
|
EmptyState.displayName = "EmptyState";
|
|
4290
5061
|
|
|
4291
5062
|
// src/pages/user-profile/components/open-order-row.tsx
|
|
4292
|
-
import { optimizedImageUrl, useLabels as
|
|
4293
|
-
import { jsx as
|
|
5063
|
+
import { optimizedImageUrl, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
5064
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4294
5065
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
4295
5066
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4296
5067
|
};
|
|
5068
|
+
var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
5069
|
+
"submitted",
|
|
5070
|
+
"open",
|
|
5071
|
+
"partially_filled_open",
|
|
5072
|
+
"cancel_pending"
|
|
5073
|
+
]);
|
|
5074
|
+
var canCancelOpenOrder = (order) => {
|
|
5075
|
+
const status = order.status.trim().toLowerCase();
|
|
5076
|
+
if (status === "pending" && !order.dagRunId) return true;
|
|
5077
|
+
const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
|
|
5078
|
+
if (!isLimitOrder) return false;
|
|
5079
|
+
return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
|
|
5080
|
+
};
|
|
4297
5081
|
var OpenOrderRow = ({
|
|
4298
5082
|
order,
|
|
4299
5083
|
href,
|
|
@@ -4308,7 +5092,7 @@ var OpenOrderRow = ({
|
|
|
4308
5092
|
expirationHeader
|
|
4309
5093
|
}) => {
|
|
4310
5094
|
var _a, _b, _c, _d;
|
|
4311
|
-
const labels =
|
|
5095
|
+
const labels = useLabels8().userProfile.openOrders;
|
|
4312
5096
|
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
4313
5097
|
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
4314
5098
|
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
@@ -4329,9 +5113,7 @@ var OpenOrderRow = ({
|
|
|
4329
5113
|
event.stopPropagation();
|
|
4330
5114
|
onCancel == null ? void 0 : onCancel(order);
|
|
4331
5115
|
};
|
|
4332
|
-
const
|
|
4333
|
-
const isLimitOrder = order.orderType === "limit";
|
|
4334
|
-
const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
|
|
5116
|
+
const canCancel = canCancelOpenOrder(order);
|
|
4335
5117
|
const Wrapper = href ? "a" : "div";
|
|
4336
5118
|
const wrapperProps = href ? {
|
|
4337
5119
|
href,
|
|
@@ -4347,7 +5129,7 @@ var OpenOrderRow = ({
|
|
|
4347
5129
|
handleDivClick();
|
|
4348
5130
|
}
|
|
4349
5131
|
};
|
|
4350
|
-
return /* @__PURE__ */
|
|
5132
|
+
return /* @__PURE__ */ jsx13(
|
|
4351
5133
|
Wrapper,
|
|
4352
5134
|
__spreadProps(__spreadValues({
|
|
4353
5135
|
"aria-label": order.title,
|
|
@@ -4358,9 +5140,9 @@ var OpenOrderRow = ({
|
|
|
4358
5140
|
"hover:before:opacity-100 focus-visible:before:opacity-100"
|
|
4359
5141
|
)
|
|
4360
5142
|
}, wrapperProps), {
|
|
4361
|
-
children: /* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
5143
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "agg-open-order-row-content relative z-10 flex w-full flex-col gap-3 rounded-agg-xl px-3 py-2.5 text-left lg:flex-row lg:items-center lg:gap-6 lg:px-0 lg:py-0", children: [
|
|
5144
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 items-center gap-3 lg:gap-4", children: [
|
|
5145
|
+
/* @__PURE__ */ jsx13("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ jsx13(
|
|
4364
5146
|
RemoteImage,
|
|
4365
5147
|
{
|
|
4366
5148
|
src: optimizedImageUrl(order.thumbnailSrc, 60),
|
|
@@ -4368,35 +5150,35 @@ var OpenOrderRow = ({
|
|
|
4368
5150
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4369
5151
|
}
|
|
4370
5152
|
) }),
|
|
4371
|
-
/* @__PURE__ */
|
|
4372
|
-
/* @__PURE__ */
|
|
4373
|
-
/* @__PURE__ */
|
|
5153
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
5154
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
|
|
5155
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) })
|
|
4374
5156
|
] })
|
|
4375
5157
|
] }),
|
|
4376
|
-
/* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
5158
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
5159
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) }),
|
|
4378
5160
|
[
|
|
4379
5161
|
{ label: resolvedLimitPriceHeader, value: (_a = order.limitPriceLabel) != null ? _a : "\u2014" },
|
|
4380
5162
|
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
4381
5163
|
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
4382
5164
|
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
4383
|
-
].map(({ label, value }) => /* @__PURE__ */
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
5165
|
+
].map(({ label, value }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
5166
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
5167
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label })
|
|
4386
5168
|
] }, label))
|
|
4387
5169
|
] }),
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */
|
|
4390
|
-
/* @__PURE__ */
|
|
4391
|
-
/* @__PURE__ */
|
|
4392
|
-
/* @__PURE__ */
|
|
5170
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
5171
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
5172
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
5173
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
|
|
5174
|
+
/* @__PURE__ */ jsx13(
|
|
4393
5175
|
"div",
|
|
4394
5176
|
{
|
|
4395
5177
|
className: cn(
|
|
4396
5178
|
"shrink-0 justify-end",
|
|
4397
5179
|
canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
|
|
4398
5180
|
),
|
|
4399
|
-
children: canCancel ? /* @__PURE__ */
|
|
5181
|
+
children: canCancel ? /* @__PURE__ */ jsx13(
|
|
4400
5182
|
Button,
|
|
4401
5183
|
{
|
|
4402
5184
|
variant: "secondary",
|
|
@@ -4418,8 +5200,8 @@ var OpenOrderRow = ({
|
|
|
4418
5200
|
OpenOrderRow.displayName = "OpenOrderRow";
|
|
4419
5201
|
|
|
4420
5202
|
// src/pages/user-profile/components/position-row.tsx
|
|
4421
|
-
import { optimizedImageUrl as optimizedImageUrl2, useLabels as
|
|
4422
|
-
import { Fragment as Fragment3, jsx as
|
|
5203
|
+
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels9 } from "@agg-build/hooks";
|
|
5204
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4423
5205
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
4424
5206
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4425
5207
|
};
|
|
@@ -4428,21 +5210,21 @@ var toneTextClassName = (tone) => {
|
|
|
4428
5210
|
if (tone === "negative") return "text-agg-error";
|
|
4429
5211
|
return "text-agg-muted-foreground";
|
|
4430
5212
|
};
|
|
4431
|
-
var OutcomePill = ({ label }) => /* @__PURE__ */
|
|
4432
|
-
var ResolutionPill = ({ label }) => /* @__PURE__ */
|
|
5213
|
+
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx14("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx14("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
|
|
5214
|
+
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx14("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx14("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
4433
5215
|
var VenueShares = ({
|
|
4434
5216
|
model,
|
|
4435
5217
|
className,
|
|
4436
5218
|
keyPrefix
|
|
4437
5219
|
}) => {
|
|
4438
5220
|
if (model.venueShareBreakdown.length === 0) return null;
|
|
4439
|
-
return /* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs13(
|
|
4440
5222
|
"div",
|
|
4441
5223
|
{
|
|
4442
5224
|
className: "flex min-w-0 max-w-full items-center gap-1",
|
|
4443
5225
|
children: [
|
|
4444
|
-
/* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
5226
|
+
/* @__PURE__ */ jsx14(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
|
|
5227
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
|
|
4446
5228
|
]
|
|
4447
5229
|
},
|
|
4448
5230
|
`${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
|
|
@@ -4454,7 +5236,7 @@ var StatusBadge = ({
|
|
|
4454
5236
|
}) => {
|
|
4455
5237
|
if (status === "lost" || status === "won_claimed") return null;
|
|
4456
5238
|
const isWon = status === "won_unclaimed";
|
|
4457
|
-
return /* @__PURE__ */
|
|
5239
|
+
return /* @__PURE__ */ jsxs13(
|
|
4458
5240
|
"span",
|
|
4459
5241
|
{
|
|
4460
5242
|
className: cn(
|
|
@@ -4463,7 +5245,7 @@ var StatusBadge = ({
|
|
|
4463
5245
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
4464
5246
|
),
|
|
4465
5247
|
children: [
|
|
4466
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsx14(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
4467
5249
|
isWon ? labels.won : labels.open
|
|
4468
5250
|
]
|
|
4469
5251
|
}
|
|
@@ -4476,7 +5258,7 @@ var ResultBadge = ({
|
|
|
4476
5258
|
if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
|
|
4477
5259
|
const isWon = status === "won_claimed";
|
|
4478
5260
|
const isSold = status === "sold";
|
|
4479
|
-
return /* @__PURE__ */
|
|
5261
|
+
return /* @__PURE__ */ jsxs13(
|
|
4480
5262
|
"span",
|
|
4481
5263
|
{
|
|
4482
5264
|
className: cn(
|
|
@@ -4485,7 +5267,7 @@ var ResultBadge = ({
|
|
|
4485
5267
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : isSold ? "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-muted-foreground" : "border-agg-error/50 bg-agg-error/10 text-agg-error"
|
|
4486
5268
|
),
|
|
4487
5269
|
children: [
|
|
4488
|
-
/* @__PURE__ */
|
|
5270
|
+
/* @__PURE__ */ jsx14(
|
|
4489
5271
|
Icon,
|
|
4490
5272
|
{
|
|
4491
5273
|
name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
|
|
@@ -4501,27 +5283,27 @@ var ResultBadge = ({
|
|
|
4501
5283
|
var TotalTradedCell = ({
|
|
4502
5284
|
model,
|
|
4503
5285
|
className
|
|
4504
|
-
}) => /* @__PURE__ */
|
|
5286
|
+
}) => /* @__PURE__ */ jsxs13(
|
|
4505
5287
|
"div",
|
|
4506
5288
|
{
|
|
4507
5289
|
className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4508
5290
|
children: [
|
|
4509
|
-
/* @__PURE__ */
|
|
4510
|
-
/* @__PURE__ */
|
|
5291
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
5292
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
4511
5293
|
]
|
|
4512
5294
|
}
|
|
4513
5295
|
);
|
|
4514
5296
|
var PositionValueCell = ({
|
|
4515
5297
|
value,
|
|
4516
5298
|
className
|
|
4517
|
-
}) => /* @__PURE__ */
|
|
5299
|
+
}) => /* @__PURE__ */ jsxs13(
|
|
4518
5300
|
"div",
|
|
4519
5301
|
{
|
|
4520
5302
|
className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4521
5303
|
children: [
|
|
4522
|
-
/* @__PURE__ */
|
|
4523
|
-
/* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-baseline gap-1.5", children: [
|
|
5305
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
|
|
5306
|
+
/* @__PURE__ */ jsx14(
|
|
4525
5307
|
"p",
|
|
4526
5308
|
{
|
|
4527
5309
|
className: cn(
|
|
@@ -4532,9 +5314,9 @@ var PositionValueCell = ({
|
|
|
4532
5314
|
}
|
|
4533
5315
|
)
|
|
4534
5316
|
] }),
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
5317
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-baseline gap-1.5", children: [
|
|
5318
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
|
|
5319
|
+
/* @__PURE__ */ jsx14(
|
|
4538
5320
|
"p",
|
|
4539
5321
|
{
|
|
4540
5322
|
className: cn(
|
|
@@ -4556,12 +5338,17 @@ var PositionRow = ({
|
|
|
4556
5338
|
onClaim,
|
|
4557
5339
|
isClaiming = false
|
|
4558
5340
|
}) => {
|
|
4559
|
-
const labels =
|
|
4560
|
-
const
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
5341
|
+
const labels = useLabels9().userProfile.positions;
|
|
5342
|
+
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
|
|
5343
|
+
const model = toPositionRowViewModel(
|
|
5344
|
+
position,
|
|
5345
|
+
{
|
|
5346
|
+
avgPrefix: labels.avgPrefix,
|
|
5347
|
+
nowPrefix: labels.nowPrefix,
|
|
5348
|
+
finalPrefix: labels.finalPrefix
|
|
5349
|
+
},
|
|
5350
|
+
{ formatCurrency: formatCurrency2, formatPrice }
|
|
5351
|
+
);
|
|
4565
5352
|
const isClosed = (variant != null ? variant : model.bucket) === "closed";
|
|
4566
5353
|
const handleClaim = (event) => {
|
|
4567
5354
|
event.preventDefault();
|
|
@@ -4597,7 +5384,7 @@ var PositionRow = ({
|
|
|
4597
5384
|
handleDivClick();
|
|
4598
5385
|
}
|
|
4599
5386
|
};
|
|
4600
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ jsx14(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs13(
|
|
4601
5388
|
"div",
|
|
4602
5389
|
{
|
|
4603
5390
|
className: cn(
|
|
@@ -4605,9 +5392,9 @@ var PositionRow = ({
|
|
|
4605
5392
|
isClosed ? "md:gap-8" : "md:gap-6"
|
|
4606
5393
|
),
|
|
4607
5394
|
children: [
|
|
4608
|
-
/* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4610
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
|
|
5396
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
|
|
5397
|
+
/* @__PURE__ */ jsx14("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx14(
|
|
4611
5398
|
RemoteImage,
|
|
4612
5399
|
{
|
|
4613
5400
|
src: optimizedImageUrl2(model.thumbnailSrc, 60),
|
|
@@ -4615,11 +5402,11 @@ var PositionRow = ({
|
|
|
4615
5402
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4616
5403
|
}
|
|
4617
5404
|
) }),
|
|
4618
|
-
/* @__PURE__ */
|
|
4619
|
-
/* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
/* @__PURE__ */
|
|
5405
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
5406
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
|
|
5407
|
+
/* @__PURE__ */ jsxs13("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
|
|
5408
|
+
/* @__PURE__ */ jsx14(OutcomePill, { label: model.selectedOutcomeLabel }),
|
|
5409
|
+
/* @__PURE__ */ jsx14(
|
|
4623
5410
|
VenueShares,
|
|
4624
5411
|
{
|
|
4625
5412
|
model,
|
|
@@ -4630,10 +5417,10 @@ var PositionRow = ({
|
|
|
4630
5417
|
] })
|
|
4631
5418
|
] })
|
|
4632
5419
|
] }),
|
|
4633
|
-
/* @__PURE__ */
|
|
5420
|
+
/* @__PURE__ */ jsx14("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx14(OutcomePill, { label: model.selectedOutcomeLabel }) })
|
|
4634
5421
|
] }),
|
|
4635
|
-
isClosed ? /* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
5422
|
+
isClosed ? /* @__PURE__ */ jsx14("div", { className: "md:hidden", children: /* @__PURE__ */ jsx14(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
|
|
5423
|
+
/* @__PURE__ */ jsx14(
|
|
4637
5424
|
VenueShares,
|
|
4638
5425
|
{
|
|
4639
5426
|
model,
|
|
@@ -4641,14 +5428,14 @@ var PositionRow = ({
|
|
|
4641
5428
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
4642
5429
|
}
|
|
4643
5430
|
),
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
/* @__PURE__ */
|
|
4646
|
-
/* @__PURE__ */
|
|
4647
|
-
/* @__PURE__ */
|
|
5431
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
|
|
5432
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-5", children: [
|
|
5433
|
+
/* @__PURE__ */ jsx14(TotalTradedCell, { model }),
|
|
5434
|
+
/* @__PURE__ */ jsx14(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
|
|
4648
5435
|
] }),
|
|
4649
|
-
isClosed ? /* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
model.canClaim ? /* @__PURE__ */
|
|
5436
|
+
isClosed ? /* @__PURE__ */ jsx14(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
|
|
5437
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status: model.positionStatus, labels }),
|
|
5438
|
+
model.canClaim ? /* @__PURE__ */ jsxs13(
|
|
4652
5439
|
"button",
|
|
4653
5440
|
{
|
|
4654
5441
|
type: "button",
|
|
@@ -4657,48 +5444,48 @@ var PositionRow = ({
|
|
|
4657
5444
|
disabled: isClaiming,
|
|
4658
5445
|
"aria-busy": isClaiming || void 0,
|
|
4659
5446
|
children: [
|
|
4660
|
-
isClaiming ? /* @__PURE__ */
|
|
5447
|
+
isClaiming ? /* @__PURE__ */ jsx14(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4661
5448
|
labels.claim
|
|
4662
5449
|
]
|
|
4663
5450
|
}
|
|
4664
5451
|
) : null
|
|
4665
5452
|
] })
|
|
4666
5453
|
] }),
|
|
4667
|
-
isClosed ? /* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
5454
|
+
isClosed ? /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
5455
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx14(ResolutionPill, { label: model.resolutionLabel }) }),
|
|
5456
|
+
/* @__PURE__ */ jsx14(
|
|
4670
5457
|
TotalTradedCell,
|
|
4671
5458
|
{
|
|
4672
5459
|
model,
|
|
4673
5460
|
className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
|
|
4674
5461
|
}
|
|
4675
5462
|
),
|
|
4676
|
-
/* @__PURE__ */
|
|
5463
|
+
/* @__PURE__ */ jsx14(
|
|
4677
5464
|
PositionValueCell,
|
|
4678
5465
|
{
|
|
4679
5466
|
value: model.payout,
|
|
4680
5467
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4681
5468
|
}
|
|
4682
5469
|
),
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
] }) : /* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
5470
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx14(ResultBadge, { status: model.positionStatus, labels }) })
|
|
5471
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
5472
|
+
/* @__PURE__ */ jsx14(
|
|
4686
5473
|
TotalTradedCell,
|
|
4687
5474
|
{
|
|
4688
5475
|
model,
|
|
4689
5476
|
className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
|
|
4690
5477
|
}
|
|
4691
5478
|
),
|
|
4692
|
-
/* @__PURE__ */
|
|
5479
|
+
/* @__PURE__ */ jsx14(
|
|
4693
5480
|
PositionValueCell,
|
|
4694
5481
|
{
|
|
4695
5482
|
value: model.currentValue,
|
|
4696
5483
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4697
5484
|
}
|
|
4698
5485
|
),
|
|
4699
|
-
/* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
model.canClaim ? /* @__PURE__ */
|
|
5486
|
+
/* @__PURE__ */ jsxs13("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
5487
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status: model.positionStatus, labels }),
|
|
5488
|
+
model.canClaim ? /* @__PURE__ */ jsxs13(
|
|
4702
5489
|
"button",
|
|
4703
5490
|
{
|
|
4704
5491
|
type: "button",
|
|
@@ -4707,14 +5494,14 @@ var PositionRow = ({
|
|
|
4707
5494
|
disabled: isClaiming,
|
|
4708
5495
|
"aria-busy": isClaiming || void 0,
|
|
4709
5496
|
children: [
|
|
4710
|
-
isClaiming ? /* @__PURE__ */
|
|
5497
|
+
isClaiming ? /* @__PURE__ */ jsx14(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4711
5498
|
labels.claim
|
|
4712
5499
|
]
|
|
4713
5500
|
}
|
|
4714
5501
|
) : null
|
|
4715
5502
|
] })
|
|
4716
5503
|
] }),
|
|
4717
|
-
/* @__PURE__ */
|
|
5504
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx14(
|
|
4718
5505
|
Icon,
|
|
4719
5506
|
{
|
|
4720
5507
|
name: "chevron-right",
|
|
@@ -4729,15 +5516,15 @@ var PositionRow = ({
|
|
|
4729
5516
|
PositionRow.displayName = "PositionRow";
|
|
4730
5517
|
|
|
4731
5518
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
4732
|
-
import { Fragment as Fragment5, jsx as
|
|
5519
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4733
5520
|
var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
4734
5521
|
{ value: USER_PROFILE_TAB_POSITIONS, label: tabsLabels.positions },
|
|
4735
5522
|
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
4736
5523
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
4737
5524
|
];
|
|
4738
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
index < acc.length - 1 ? /* @__PURE__ */
|
|
5525
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx15("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5526
|
+
/* @__PURE__ */ jsx15("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
5527
|
+
index < acc.length - 1 ? /* @__PURE__ */ jsx15("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
4741
5528
|
] }, index)) });
|
|
4742
5529
|
var PositionsActivity = ({
|
|
4743
5530
|
activePositions = [],
|
|
@@ -4779,15 +5566,16 @@ var PositionsActivity = ({
|
|
|
4779
5566
|
initialPositionFilter = "active",
|
|
4780
5567
|
className
|
|
4781
5568
|
}) => {
|
|
4782
|
-
const userProfileLabels =
|
|
5569
|
+
const userProfileLabels = useLabels10().userProfile;
|
|
4783
5570
|
const positionsLabels = userProfileLabels.positions;
|
|
4784
5571
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
4785
|
-
const
|
|
5572
|
+
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
|
|
5573
|
+
const tabItems = useMemo7(
|
|
4786
5574
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
4787
5575
|
[showOpenOrders, userProfileLabels.tabs]
|
|
4788
5576
|
);
|
|
4789
5577
|
const isTabControlled = tab !== void 0;
|
|
4790
|
-
const [internalActiveTab, setInternalActiveTab] =
|
|
5578
|
+
const [internalActiveTab, setInternalActiveTab] = useState11(
|
|
4791
5579
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
4792
5580
|
);
|
|
4793
5581
|
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -4797,21 +5585,21 @@ var PositionsActivity = ({
|
|
|
4797
5585
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
4798
5586
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
4799
5587
|
};
|
|
4800
|
-
const [positionFilter, setPositionFilter] =
|
|
4801
|
-
const [searchValue, setSearchValue] =
|
|
4802
|
-
const [isSearchFocused, setIsSearchFocused] =
|
|
4803
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] =
|
|
5588
|
+
const [positionFilter, setPositionFilter] = useState11(initialPositionFilter);
|
|
5589
|
+
const [searchValue, setSearchValue] = useState11("");
|
|
5590
|
+
const [isSearchFocused, setIsSearchFocused] = useState11(false);
|
|
5591
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState11(
|
|
4804
5592
|
() => /* @__PURE__ */ new Set()
|
|
4805
5593
|
);
|
|
4806
|
-
const positionsLoadMoreRef =
|
|
4807
|
-
const openOrdersLoadMoreRef =
|
|
4808
|
-
const activitiesLoadMoreRef =
|
|
4809
|
-
const rowsScrollRef =
|
|
5594
|
+
const positionsLoadMoreRef = useRef9(null);
|
|
5595
|
+
const openOrdersLoadMoreRef = useRef9(null);
|
|
5596
|
+
const activitiesLoadMoreRef = useRef9(null);
|
|
5597
|
+
const rowsScrollRef = useRef9(null);
|
|
4810
5598
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
4811
5599
|
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
4812
5600
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
4813
5601
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
4814
|
-
const positionsForCurrentFilter =
|
|
5602
|
+
const positionsForCurrentFilter = useMemo7(() => {
|
|
4815
5603
|
if (positionFilter === "active") {
|
|
4816
5604
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
4817
5605
|
}
|
|
@@ -4828,7 +5616,7 @@ var PositionsActivity = ({
|
|
|
4828
5616
|
}
|
|
4829
5617
|
return Array.from(byId.values());
|
|
4830
5618
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
4831
|
-
const filteredPositions =
|
|
5619
|
+
const filteredPositions = useMemo7(() => {
|
|
4832
5620
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
4833
5621
|
const q = searchValue.toLowerCase();
|
|
4834
5622
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -4853,29 +5641,40 @@ var PositionsActivity = ({
|
|
|
4853
5641
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
4854
5642
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
4855
5643
|
const filteredActivities = activities;
|
|
4856
|
-
const searchResults =
|
|
5644
|
+
const searchResults = useMemo7(() => {
|
|
4857
5645
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
4858
5646
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
4859
5647
|
id: position.id,
|
|
4860
5648
|
title: position.title,
|
|
4861
5649
|
thumbnailSrc: position.thumbnailSrc,
|
|
4862
5650
|
metaPrimary: position.outcomeLabel,
|
|
4863
|
-
metaSecondary: toPositionRowViewModel(
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
5651
|
+
metaSecondary: toPositionRowViewModel(
|
|
5652
|
+
position,
|
|
5653
|
+
{
|
|
5654
|
+
avgPrefix: positionsLabels.avgPrefix,
|
|
5655
|
+
nowPrefix: positionsLabels.nowPrefix,
|
|
5656
|
+
finalPrefix: positionsLabels.finalPrefix
|
|
5657
|
+
},
|
|
5658
|
+
{ formatCurrency: formatCurrency2, formatPrice }
|
|
5659
|
+
).currentValue.primaryLabel,
|
|
4868
5660
|
raw: position
|
|
4869
5661
|
}));
|
|
4870
|
-
}, [
|
|
5662
|
+
}, [
|
|
5663
|
+
filteredPositions,
|
|
5664
|
+
formatCurrency2,
|
|
5665
|
+
formatPrice,
|
|
5666
|
+
isPositionsTab,
|
|
5667
|
+
positionsLabels,
|
|
5668
|
+
searchValue
|
|
5669
|
+
]);
|
|
4871
5670
|
const handleSearchChange = (event) => {
|
|
4872
5671
|
setSearchValue(event.target.value);
|
|
4873
5672
|
};
|
|
4874
|
-
|
|
5673
|
+
useEffect10(() => {
|
|
4875
5674
|
if (isPositionsTab) return;
|
|
4876
5675
|
setIsSearchFocused(false);
|
|
4877
5676
|
}, [isPositionsTab]);
|
|
4878
|
-
|
|
5677
|
+
useEffect10(() => {
|
|
4879
5678
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
4880
5679
|
const target = positionsLoadMoreRef.current;
|
|
4881
5680
|
if (!target || !loadMorePositions) return;
|
|
@@ -4897,7 +5696,7 @@ var PositionsActivity = ({
|
|
|
4897
5696
|
isPositionsTab,
|
|
4898
5697
|
loadMorePositions
|
|
4899
5698
|
]);
|
|
4900
|
-
|
|
5699
|
+
useEffect10(() => {
|
|
4901
5700
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
4902
5701
|
const target = activitiesLoadMoreRef.current;
|
|
4903
5702
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -4919,7 +5718,7 @@ var PositionsActivity = ({
|
|
|
4919
5718
|
isLoadingMoreActivities,
|
|
4920
5719
|
onLoadMoreActivities
|
|
4921
5720
|
]);
|
|
4922
|
-
|
|
5721
|
+
useEffect10(() => {
|
|
4923
5722
|
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
4924
5723
|
const target = openOrdersLoadMoreRef.current;
|
|
4925
5724
|
if (!target || !onLoadMoreOpenOrders) return;
|
|
@@ -4941,7 +5740,7 @@ var PositionsActivity = ({
|
|
|
4941
5740
|
isOpenOrdersTab,
|
|
4942
5741
|
onLoadMoreOpenOrders
|
|
4943
5742
|
]);
|
|
4944
|
-
return /* @__PURE__ */
|
|
5743
|
+
return /* @__PURE__ */ jsxs14(
|
|
4945
5744
|
"div",
|
|
4946
5745
|
{
|
|
4947
5746
|
className: cn(
|
|
@@ -4950,7 +5749,7 @@ var PositionsActivity = ({
|
|
|
4950
5749
|
className
|
|
4951
5750
|
),
|
|
4952
5751
|
children: [
|
|
4953
|
-
/* @__PURE__ */
|
|
5752
|
+
/* @__PURE__ */ jsx15(
|
|
4954
5753
|
Tabs,
|
|
4955
5754
|
{
|
|
4956
5755
|
items: tabItems,
|
|
@@ -4964,7 +5763,7 @@ var PositionsActivity = ({
|
|
|
4964
5763
|
}
|
|
4965
5764
|
}
|
|
4966
5765
|
),
|
|
4967
|
-
/* @__PURE__ */
|
|
5766
|
+
/* @__PURE__ */ jsxs14(
|
|
4968
5767
|
"div",
|
|
4969
5768
|
{
|
|
4970
5769
|
className: cn(
|
|
@@ -4972,12 +5771,12 @@ var PositionsActivity = ({
|
|
|
4972
5771
|
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
4973
5772
|
),
|
|
4974
5773
|
children: [
|
|
4975
|
-
isPositionsTab ? /* @__PURE__ */
|
|
4976
|
-
/* @__PURE__ */
|
|
5774
|
+
isPositionsTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
|
|
5775
|
+
/* @__PURE__ */ jsx15("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
|
|
4977
5776
|
const isActive = filter.value === positionFilter;
|
|
4978
|
-
return /* @__PURE__ */
|
|
4979
|
-
idx > 0 ? /* @__PURE__ */
|
|
4980
|
-
/* @__PURE__ */
|
|
5777
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-1 items-stretch", children: [
|
|
5778
|
+
idx > 0 ? /* @__PURE__ */ jsx15("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
5779
|
+
/* @__PURE__ */ jsx15(
|
|
4981
5780
|
"button",
|
|
4982
5781
|
{
|
|
4983
5782
|
type: "button",
|
|
@@ -4992,7 +5791,7 @@ var PositionsActivity = ({
|
|
|
4992
5791
|
)
|
|
4993
5792
|
] }, filter.value);
|
|
4994
5793
|
}) }),
|
|
4995
|
-
/* @__PURE__ */
|
|
5794
|
+
/* @__PURE__ */ jsxs14(
|
|
4996
5795
|
"div",
|
|
4997
5796
|
{
|
|
4998
5797
|
className: "agg-position-search relative flex w-full min-w-0 flex-1",
|
|
@@ -5003,9 +5802,9 @@ var PositionsActivity = ({
|
|
|
5003
5802
|
setIsSearchFocused(false);
|
|
5004
5803
|
},
|
|
5005
5804
|
children: [
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5805
|
+
/* @__PURE__ */ jsx15("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs14("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
|
|
5806
|
+
/* @__PURE__ */ jsx15(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
|
|
5807
|
+
/* @__PURE__ */ jsx15(
|
|
5009
5808
|
"input",
|
|
5010
5809
|
{
|
|
5011
5810
|
value: searchValue,
|
|
@@ -5020,7 +5819,7 @@ var PositionsActivity = ({
|
|
|
5020
5819
|
}
|
|
5021
5820
|
)
|
|
5022
5821
|
] }) }),
|
|
5023
|
-
isSearchFocused && searchValue.trim() ? /* @__PURE__ */
|
|
5822
|
+
isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx15("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ jsx15(
|
|
5024
5823
|
"ul",
|
|
5025
5824
|
{
|
|
5026
5825
|
className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
|
|
@@ -5033,9 +5832,9 @@ var PositionsActivity = ({
|
|
|
5033
5832
|
setIsSearchFocused(false);
|
|
5034
5833
|
onPositionClick == null ? void 0 : onPositionClick(item.raw);
|
|
5035
5834
|
};
|
|
5036
|
-
const innerContent = /* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5835
|
+
const innerContent = /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
5836
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
5837
|
+
/* @__PURE__ */ jsx15(
|
|
5039
5838
|
"img",
|
|
5040
5839
|
{
|
|
5041
5840
|
src: optimizedImageUrl3(item.thumbnailSrc, 48),
|
|
@@ -5043,16 +5842,16 @@ var PositionsActivity = ({
|
|
|
5043
5842
|
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
5044
5843
|
}
|
|
5045
5844
|
),
|
|
5046
|
-
/* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5845
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
5846
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
|
|
5847
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
|
|
5848
|
+
/* @__PURE__ */ jsx15("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
|
|
5849
|
+
/* @__PURE__ */ jsx15("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
|
|
5850
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
|
|
5052
5851
|
] })
|
|
5053
5852
|
] })
|
|
5054
5853
|
] }),
|
|
5055
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ jsx15(
|
|
5056
5855
|
Icon,
|
|
5057
5856
|
{
|
|
5058
5857
|
name: "chevron-right",
|
|
@@ -5061,7 +5860,7 @@ var PositionsActivity = ({
|
|
|
5061
5860
|
}
|
|
5062
5861
|
)
|
|
5063
5862
|
] });
|
|
5064
|
-
return /* @__PURE__ */
|
|
5863
|
+
return /* @__PURE__ */ jsx15(
|
|
5065
5864
|
"li",
|
|
5066
5865
|
{
|
|
5067
5866
|
role: "presentation",
|
|
@@ -5069,7 +5868,7 @@ var PositionsActivity = ({
|
|
|
5069
5868
|
"agg-position-search-result-item",
|
|
5070
5869
|
index > 0 && "border-t border-agg-separator"
|
|
5071
5870
|
),
|
|
5072
|
-
children: itemHref ? /* @__PURE__ */
|
|
5871
|
+
children: itemHref ? /* @__PURE__ */ jsx15(
|
|
5073
5872
|
"a",
|
|
5074
5873
|
{
|
|
5075
5874
|
href: itemHref,
|
|
@@ -5084,7 +5883,7 @@ var PositionsActivity = ({
|
|
|
5084
5883
|
},
|
|
5085
5884
|
children: innerContent
|
|
5086
5885
|
}
|
|
5087
|
-
) : /* @__PURE__ */
|
|
5886
|
+
) : /* @__PURE__ */ jsx15(
|
|
5088
5887
|
"button",
|
|
5089
5888
|
{
|
|
5090
5889
|
type: "button",
|
|
@@ -5098,42 +5897,42 @@ var PositionsActivity = ({
|
|
|
5098
5897
|
);
|
|
5099
5898
|
})
|
|
5100
5899
|
}
|
|
5101
|
-
) : /* @__PURE__ */
|
|
5900
|
+
) : /* @__PURE__ */ jsx15("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
|
|
5102
5901
|
]
|
|
5103
5902
|
}
|
|
5104
5903
|
)
|
|
5105
5904
|
] }) : null,
|
|
5106
|
-
/* @__PURE__ */
|
|
5107
|
-
/* @__PURE__ */
|
|
5108
|
-
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */
|
|
5109
|
-
/* @__PURE__ */
|
|
5110
|
-
/* @__PURE__ */
|
|
5111
|
-
/* @__PURE__ */
|
|
5112
|
-
/* @__PURE__ */
|
|
5113
|
-
/* @__PURE__ */
|
|
5114
|
-
/* @__PURE__ */
|
|
5115
|
-
] }) : /* @__PURE__ */
|
|
5116
|
-
/* @__PURE__ */
|
|
5117
|
-
/* @__PURE__ */
|
|
5118
|
-
/* @__PURE__ */
|
|
5119
|
-
/* @__PURE__ */
|
|
5120
|
-
/* @__PURE__ */
|
|
5905
|
+
/* @__PURE__ */ jsxs14("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
|
|
5906
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-full px-4 sm:px-6", children: [
|
|
5907
|
+
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
|
|
5908
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
5909
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
|
|
5910
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
|
|
5911
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
|
|
5912
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
|
|
5913
|
+
/* @__PURE__ */ jsx15("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
5914
|
+
] }) : /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
5915
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
5916
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
|
|
5917
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
|
|
5918
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
|
|
5919
|
+
/* @__PURE__ */ jsx15("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
5121
5920
|
] }) : null,
|
|
5122
|
-
isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5127
|
-
/* @__PURE__ */
|
|
5128
|
-
/* @__PURE__ */
|
|
5921
|
+
isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 lg:flex", children: [
|
|
5922
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: openOrdersLabels.marketHeader }),
|
|
5923
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.limitPriceHeader }),
|
|
5924
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.filledHeader }),
|
|
5925
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.totalHeader }),
|
|
5926
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[140px] shrink-0", children: openOrdersLabels.expirationHeader }),
|
|
5927
|
+
/* @__PURE__ */ jsx15("span", { className: "w-[80px] shrink-0", "aria-hidden": true })
|
|
5129
5928
|
] }) : null,
|
|
5130
|
-
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */
|
|
5131
|
-
/* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5929
|
+
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
5930
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
|
|
5931
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
5932
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
|
|
5134
5933
|
] }) : null
|
|
5135
5934
|
] }),
|
|
5136
|
-
/* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ jsx15(
|
|
5137
5936
|
"div",
|
|
5138
5937
|
{
|
|
5139
5938
|
ref: rowsScrollRef,
|
|
@@ -5145,8 +5944,8 @@ var PositionsActivity = ({
|
|
|
5145
5944
|
"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
|
|
5146
5945
|
"[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
|
|
5147
5946
|
),
|
|
5148
|
-
children: isPositionsTab ? /* @__PURE__ */
|
|
5149
|
-
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */
|
|
5947
|
+
children: isPositionsTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
|
|
5948
|
+
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5150
5949
|
EmptyState,
|
|
5151
5950
|
{
|
|
5152
5951
|
title: "Unable to load positions",
|
|
@@ -5154,15 +5953,15 @@ var PositionsActivity = ({
|
|
|
5154
5953
|
}
|
|
5155
5954
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
5156
5955
|
var _a;
|
|
5157
|
-
return /* @__PURE__ */
|
|
5158
|
-
index > 0 ? /* @__PURE__ */
|
|
5956
|
+
return /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5957
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5159
5958
|
"div",
|
|
5160
5959
|
{
|
|
5161
5960
|
className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5162
5961
|
"aria-hidden": true
|
|
5163
5962
|
}
|
|
5164
5963
|
) : null,
|
|
5165
|
-
/* @__PURE__ */
|
|
5964
|
+
/* @__PURE__ */ jsx15(
|
|
5166
5965
|
PositionRow,
|
|
5167
5966
|
{
|
|
5168
5967
|
position,
|
|
@@ -5176,15 +5975,15 @@ var PositionsActivity = ({
|
|
|
5176
5975
|
}
|
|
5177
5976
|
)
|
|
5178
5977
|
] }, position.id);
|
|
5179
|
-
}) : /* @__PURE__ */
|
|
5978
|
+
}) : /* @__PURE__ */ jsx15(
|
|
5180
5979
|
EmptyState,
|
|
5181
5980
|
{
|
|
5182
5981
|
title: "No positions yet",
|
|
5183
5982
|
description: "Your open trades will appear here once you place an order."
|
|
5184
5983
|
}
|
|
5185
5984
|
),
|
|
5186
|
-
isLoadingMorePositions ? /* @__PURE__ */
|
|
5187
|
-
hasMorePositions ? /* @__PURE__ */
|
|
5985
|
+
isLoadingMorePositions ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
|
|
5986
|
+
hasMorePositions ? /* @__PURE__ */ jsx15(
|
|
5188
5987
|
"div",
|
|
5189
5988
|
{
|
|
5190
5989
|
ref: positionsLoadMoreRef,
|
|
@@ -5192,22 +5991,22 @@ var PositionsActivity = ({
|
|
|
5192
5991
|
"aria-hidden": true
|
|
5193
5992
|
}
|
|
5194
5993
|
) : null
|
|
5195
|
-
] }) : isOpenOrdersTab ? /* @__PURE__ */
|
|
5196
|
-
isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */
|
|
5994
|
+
] }) : isOpenOrdersTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-open-orders-list flex flex-col gap-5", children: [
|
|
5995
|
+
isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loading }) : openOrdersError && openOrders.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5197
5996
|
EmptyState,
|
|
5198
5997
|
{
|
|
5199
5998
|
title: openOrdersLabels.errorTitle,
|
|
5200
5999
|
description: openOrdersLabels.errorDescription
|
|
5201
6000
|
}
|
|
5202
|
-
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */
|
|
5203
|
-
index > 0 ? /* @__PURE__ */
|
|
6001
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
6002
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5204
6003
|
"div",
|
|
5205
6004
|
{
|
|
5206
6005
|
className: "agg-open-order-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5207
6006
|
"aria-hidden": true
|
|
5208
6007
|
}
|
|
5209
6008
|
) : null,
|
|
5210
|
-
/* @__PURE__ */
|
|
6009
|
+
/* @__PURE__ */ jsx15(
|
|
5211
6010
|
OpenOrderRow,
|
|
5212
6011
|
{
|
|
5213
6012
|
order,
|
|
@@ -5223,15 +6022,15 @@ var PositionsActivity = ({
|
|
|
5223
6022
|
expirationHeader: openOrdersLabels.expirationHeader
|
|
5224
6023
|
}
|
|
5225
6024
|
)
|
|
5226
|
-
] }, order.id)) : /* @__PURE__ */
|
|
6025
|
+
] }, order.id)) : /* @__PURE__ */ jsx15(
|
|
5227
6026
|
EmptyState,
|
|
5228
6027
|
{
|
|
5229
6028
|
title: openOrdersLabels.emptyTitle,
|
|
5230
6029
|
description: openOrdersLabels.emptyDescription
|
|
5231
6030
|
}
|
|
5232
6031
|
),
|
|
5233
|
-
isLoadingMoreOpenOrders ? /* @__PURE__ */
|
|
5234
|
-
hasMoreOpenOrders ? /* @__PURE__ */
|
|
6032
|
+
isLoadingMoreOpenOrders ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loadingMore }) : null,
|
|
6033
|
+
hasMoreOpenOrders ? /* @__PURE__ */ jsx15(
|
|
5235
6034
|
"div",
|
|
5236
6035
|
{
|
|
5237
6036
|
ref: openOrdersLoadMoreRef,
|
|
@@ -5239,22 +6038,22 @@ var PositionsActivity = ({
|
|
|
5239
6038
|
"aria-hidden": true
|
|
5240
6039
|
}
|
|
5241
6040
|
) : null
|
|
5242
|
-
] }) : /* @__PURE__ */
|
|
5243
|
-
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */
|
|
6041
|
+
] }) : /* @__PURE__ */ jsxs14("div", { className: "agg-activity-list flex flex-col gap-5", children: [
|
|
6042
|
+
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5244
6043
|
EmptyState,
|
|
5245
6044
|
{
|
|
5246
6045
|
title: "Unable to load activity",
|
|
5247
6046
|
description: "Please try again in a moment."
|
|
5248
6047
|
}
|
|
5249
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */
|
|
5250
|
-
index > 0 ? /* @__PURE__ */
|
|
6048
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
6049
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5251
6050
|
"div",
|
|
5252
6051
|
{
|
|
5253
6052
|
className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5254
6053
|
"aria-hidden": true
|
|
5255
6054
|
}
|
|
5256
6055
|
) : null,
|
|
5257
|
-
/* @__PURE__ */
|
|
6056
|
+
/* @__PURE__ */ jsx15(
|
|
5258
6057
|
ActivityRow,
|
|
5259
6058
|
{
|
|
5260
6059
|
activity,
|
|
@@ -5262,15 +6061,15 @@ var PositionsActivity = ({
|
|
|
5262
6061
|
onClick: onActivityClick
|
|
5263
6062
|
}
|
|
5264
6063
|
)
|
|
5265
|
-
] }, activity.id)) : /* @__PURE__ */
|
|
6064
|
+
] }, activity.id)) : /* @__PURE__ */ jsx15(
|
|
5266
6065
|
EmptyState,
|
|
5267
6066
|
{
|
|
5268
6067
|
title: "No activity yet",
|
|
5269
6068
|
description: "Your trading activity will appear here."
|
|
5270
6069
|
}
|
|
5271
6070
|
),
|
|
5272
|
-
isLoadingMoreActivities ? /* @__PURE__ */
|
|
5273
|
-
hasMoreActivities ? /* @__PURE__ */
|
|
6071
|
+
isLoadingMoreActivities ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
|
|
6072
|
+
hasMoreActivities ? /* @__PURE__ */ jsx15(
|
|
5274
6073
|
"div",
|
|
5275
6074
|
{
|
|
5276
6075
|
ref: activitiesLoadMoreRef,
|
|
@@ -5292,7 +6091,7 @@ var PositionsActivity = ({
|
|
|
5292
6091
|
PositionsActivity.displayName = "PositionsActivity";
|
|
5293
6092
|
|
|
5294
6093
|
// src/pages/user-profile/components/positions-value-card.tsx
|
|
5295
|
-
import { jsx as
|
|
6094
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5296
6095
|
var PositionsValueCard = ({
|
|
5297
6096
|
label,
|
|
5298
6097
|
valueLabel,
|
|
@@ -5300,7 +6099,7 @@ var PositionsValueCard = ({
|
|
|
5300
6099
|
className,
|
|
5301
6100
|
icon
|
|
5302
6101
|
}) => {
|
|
5303
|
-
return /* @__PURE__ */
|
|
6102
|
+
return /* @__PURE__ */ jsxs15(
|
|
5304
6103
|
"div",
|
|
5305
6104
|
{
|
|
5306
6105
|
className: cn(
|
|
@@ -5309,8 +6108,8 @@ var PositionsValueCard = ({
|
|
|
5309
6108
|
className
|
|
5310
6109
|
),
|
|
5311
6110
|
children: [
|
|
5312
|
-
/* @__PURE__ */
|
|
5313
|
-
icon != null ? icon : /* @__PURE__ */
|
|
6111
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
6112
|
+
icon != null ? icon : /* @__PURE__ */ jsx16(
|
|
5314
6113
|
"svg",
|
|
5315
6114
|
{
|
|
5316
6115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5319,7 +6118,7 @@ var PositionsValueCard = ({
|
|
|
5319
6118
|
viewBox: "0 0 16 16",
|
|
5320
6119
|
fill: "none",
|
|
5321
6120
|
"aria-hidden": "true",
|
|
5322
|
-
children: /* @__PURE__ */
|
|
6121
|
+
children: /* @__PURE__ */ jsx16(
|
|
5323
6122
|
"path",
|
|
5324
6123
|
{
|
|
5325
6124
|
d: "M16 7.99957C16 8.36757 15.702 8.66623 15.3333 8.66623H13.6893C13.388 8.66623 13.1233 8.86957 13.0453 9.15957L11.9273 13.3209C11.8 13.7376 11.444 13.9996 11.0333 13.9996H11.022C10.6067 13.9949 10.252 13.7229 10.1393 13.3236L7.95667 4.50623L5.838 11.9989C5.71067 12.3969 5.378 12.6496 4.98467 12.6649C4.57667 12.6869 4.23867 12.4549 4.088 12.0902L3.02133 9.10757C2.926 8.84357 2.674 8.66557 2.39333 8.66557H0.666667C0.298 8.66557 0 8.3669 0 7.9989C0 7.6309 0.298 7.33223 0.666667 7.33223H2.394C3.23667 7.33223 3.99267 7.8649 4.27733 8.65823L4.90267 10.4089L7.092 2.66557C7.226 2.2489 7.57667 1.9809 7.99933 1.9989C8.41133 2.00623 8.76333 2.27757 8.876 2.67357L11.0487 11.4509L11.7567 8.81357C11.9907 7.94157 12.7847 7.33223 13.688 7.33223H15.332C15.7007 7.33223 15.9987 7.6309 15.9987 7.9989L16 7.99957Z",
|
|
@@ -5328,9 +6127,9 @@ var PositionsValueCard = ({
|
|
|
5328
6127
|
)
|
|
5329
6128
|
}
|
|
5330
6129
|
),
|
|
5331
|
-
/* @__PURE__ */
|
|
6130
|
+
/* @__PURE__ */ jsx16("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
5332
6131
|
] }),
|
|
5333
|
-
/* @__PURE__ */
|
|
6132
|
+
/* @__PURE__ */ jsx16("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx16("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx16(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
|
|
5334
6133
|
]
|
|
5335
6134
|
}
|
|
5336
6135
|
);
|
|
@@ -5359,7 +6158,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
5359
6158
|
};
|
|
5360
6159
|
|
|
5361
6160
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
5362
|
-
import { optimizedImageUrl as optimizedImageUrl4, useLabels as
|
|
6161
|
+
import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
5363
6162
|
|
|
5364
6163
|
// src/primitives/conditional-wrapper.tsx
|
|
5365
6164
|
var ConditionalWrapper = ({
|
|
@@ -5370,9 +6169,9 @@ var ConditionalWrapper = ({
|
|
|
5370
6169
|
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
5371
6170
|
|
|
5372
6171
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
5373
|
-
import { jsx as
|
|
6172
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5374
6173
|
var DefaultAvatar = ({ className }) => {
|
|
5375
|
-
return /* @__PURE__ */
|
|
6174
|
+
return /* @__PURE__ */ jsxs16(
|
|
5376
6175
|
"svg",
|
|
5377
6176
|
{
|
|
5378
6177
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5383,15 +6182,15 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5383
6182
|
className: cn("shrink-0 text-agg-muted-foreground", className),
|
|
5384
6183
|
"aria-hidden": true,
|
|
5385
6184
|
children: [
|
|
5386
|
-
/* @__PURE__ */
|
|
5387
|
-
/* @__PURE__ */
|
|
6185
|
+
/* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_default_avatar)", children: [
|
|
6186
|
+
/* @__PURE__ */ jsx17(
|
|
5388
6187
|
"path",
|
|
5389
6188
|
{
|
|
5390
6189
|
d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
|
|
5391
6190
|
fill: "var(--agg-color-secondary-hover)"
|
|
5392
6191
|
}
|
|
5393
6192
|
),
|
|
5394
|
-
/* @__PURE__ */
|
|
6193
|
+
/* @__PURE__ */ jsx17(
|
|
5395
6194
|
"path",
|
|
5396
6195
|
{
|
|
5397
6196
|
d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
|
|
@@ -5399,7 +6198,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5399
6198
|
fillOpacity: "0.12"
|
|
5400
6199
|
}
|
|
5401
6200
|
),
|
|
5402
|
-
/* @__PURE__ */
|
|
6201
|
+
/* @__PURE__ */ jsx17(
|
|
5403
6202
|
"path",
|
|
5404
6203
|
{
|
|
5405
6204
|
d: "M73.7338 64.1259C80.4187 59.6756 84.8276 52.0804 84.8276 43.4487C84.8276 29.7376 73.7111 18.6211 60 18.6211C46.2890 18.6211 35.1724 29.7376 35.1724 43.4487C35.1724 52.0804 39.5814 59.6756 46.2662 64.1259C46.2662 64.1259 46.2683 64.1280 46.2704 64.1280C46.2683 64.1280 46.2683 64.1259 46.2683 64.1259C30.2669 68.9487 17.8076 81.9356 13.7959 98.2742L13.7980 98.2763C14.4518 99.0645 15.1304 99.8342 15.8235 100.589C15.9911 100.774 16.1669 100.949 16.3387 101.129C16.8724 101.696 17.4124 102.255 17.9669 102.801C18.1966 103.027 18.4304 103.244 18.6642 103.465C19.1773 103.954 19.6966 104.436 20.2262 104.905C20.4890 105.137 20.7559 105.367 21.0207 105.594C21.5400 106.039 22.0656 106.476 22.6014 106.902C22.8828 107.127 23.1662 107.349 23.4497 107.570C23.9918 107.988 24.5421 108.394 25.0987 108.791C25.3862 108.996 25.6697 109.205 25.9614 109.405C26.5490 109.811 27.1469 110.200 27.7490 110.585C28.0200 110.756 28.2849 110.934 28.5580 111.104C29.2531 111.532 29.9607 111.942 30.6745 112.343C30.8628 112.449 31.0469 112.562 31.2373 112.666C32.1600 113.171 33.0973 113.655 34.0490 114.112C34.0718 114.122 34.0966 114.133 34.1193 114.143C35.0276 114.578 35.9504 114.989 36.8835 115.378C37.1731 115.500 37.4690 115.608 37.7607 115.724C38.4352 115.993 39.1097 116.258 39.7966 116.502C40.1607 116.632 40.5290 116.750 40.8952 116.874C41.5200 117.085 42.1490 117.290 42.7821 117.478C43.1835 117.598 43.5869 117.710 43.9924 117.822C44.6049 117.991 45.2214 118.153 45.8442 118.304C46.2642 118.405 46.6862 118.502 47.1104 118.596C47.7331 118.732 48.3580 118.856 48.9869 118.972C49.4131 119.051 49.8373 119.131 50.2676 119.200C50.9173 119.305 51.5711 119.394 52.2269 119.479C52.6407 119.533 53.0524 119.593 53.4683 119.636C54.1924 119.715 54.9228 119.771 55.6531 119.822C56.0069 119.847 56.3566 119.885 56.7104 119.903C57.8007 119.965 58.8952 120 60 120C61.1049 120 62.1993 119.965 63.2897 119.907C63.6435 119.889 63.9952 119.851 64.3469 119.827C65.0793 119.775 65.8097 119.719 66.5318 119.640C66.9476 119.595 67.3593 119.537 67.7731 119.483C68.4290 119.398 69.0828 119.309 69.7324 119.204C70.1607 119.134 70.5869 119.055 71.0131 118.976C71.6421 118.860 72.2690 118.736 72.8897 118.600C73.3138 118.507 73.7359 118.409 74.1559 118.308C74.7766 118.157 75.3931 117.996 76.0076 117.826C76.4111 117.714 76.8166 117.602 77.2180 117.482C77.8531 117.292 78.4800 117.087 79.1049 116.878C79.4711 116.754 79.8414 116.636 80.2035 116.506C80.8883 116.260 81.5649 115.997 82.2393 115.728C82.5311 115.612 82.8269 115.502 83.1166 115.382C84.0456 114.994 84.9642 114.586 85.8683 114.151C85.8952 114.139 85.9242 114.127 85.9511 114.114C86.9028 113.657 87.8400 113.173 88.7628 112.668C88.9531 112.565 89.1373 112.451 89.3256 112.345C90.0393 111.944 90.7469 111.534 91.4421 111.106C91.7152 110.938 91.9821 110.760 92.2511 110.587C92.8531 110.202 93.4511 109.811 94.0387 109.407C94.3283 109.207 94.6138 109.000 94.9014 108.793C95.4580 108.394 96.0083 107.988 96.5504 107.572C96.8359 107.353 97.1173 107.129 97.3987 106.904C97.9324 106.478 98.4600 106.041 98.9793 105.596C99.2462 105.369 99.5131 105.139 99.7738 104.907C100.303 104.438 100.823 103.956 101.336 103.467C101.568 103.246 101.803 103.027 102.033 102.803C102.588 102.257 103.130 101.698 103.661 101.131C103.831 100.949 104.007 100.774 104.177 100.591C104.870 99.8363 105.548 99.0666 106.202 98.2783L106.204 98.2763C102.195 81.9356 89.7352 68.9487 73.7338 64.1259Z",
|
|
@@ -5408,7 +6207,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5408
6207
|
}
|
|
5409
6208
|
)
|
|
5410
6209
|
] }),
|
|
5411
|
-
/* @__PURE__ */
|
|
6210
|
+
/* @__PURE__ */ jsx17("defs", { children: /* @__PURE__ */ jsx17("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx17("rect", { width: "120", height: "120", fill: "white" }) }) })
|
|
5412
6211
|
]
|
|
5413
6212
|
}
|
|
5414
6213
|
);
|
|
@@ -5416,7 +6215,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5416
6215
|
DefaultAvatar.displayName = "DefaultAvatar";
|
|
5417
6216
|
|
|
5418
6217
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
5419
|
-
import { jsx as
|
|
6218
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5420
6219
|
var UserInfoCard = ({
|
|
5421
6220
|
user,
|
|
5422
6221
|
onEditProfile,
|
|
@@ -5426,10 +6225,10 @@ var UserInfoCard = ({
|
|
|
5426
6225
|
className
|
|
5427
6226
|
}) => {
|
|
5428
6227
|
var _a;
|
|
5429
|
-
const labels =
|
|
6228
|
+
const labels = useLabels11();
|
|
5430
6229
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
5431
6230
|
const hasWallets = wallets.length > 0;
|
|
5432
|
-
return /* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ jsxs17(
|
|
5433
6232
|
"div",
|
|
5434
6233
|
{
|
|
5435
6234
|
className: cn(
|
|
@@ -5438,26 +6237,26 @@ var UserInfoCard = ({
|
|
|
5438
6237
|
className
|
|
5439
6238
|
),
|
|
5440
6239
|
children: [
|
|
5441
|
-
/* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsxs17("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
|
|
6241
|
+
/* @__PURE__ */ jsx18("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx18(
|
|
5443
6242
|
RemoteImage,
|
|
5444
6243
|
{
|
|
5445
6244
|
src: optimizedImageUrl4(user.avatarUrl, 120),
|
|
5446
6245
|
alt: user.username,
|
|
5447
6246
|
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
5448
6247
|
}
|
|
5449
|
-
) : /* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */
|
|
6248
|
+
) : /* @__PURE__ */ jsx18(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
|
|
6249
|
+
/* @__PURE__ */ jsxs17("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
|
|
6250
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
|
|
6251
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
6252
|
+
/* @__PURE__ */ jsx18("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
|
|
6253
|
+
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx18("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
|
|
5455
6254
|
const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
|
|
5456
|
-
const iconNode = /* @__PURE__ */
|
|
6255
|
+
const iconNode = /* @__PURE__ */ jsx18("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ jsx18(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
|
|
5457
6256
|
if (!social.handle) {
|
|
5458
|
-
return /* @__PURE__ */
|
|
6257
|
+
return /* @__PURE__ */ jsx18("span", { children: iconNode }, `${social.platform}-icon`);
|
|
5459
6258
|
}
|
|
5460
|
-
return /* @__PURE__ */
|
|
6259
|
+
return /* @__PURE__ */ jsx18(
|
|
5461
6260
|
"a",
|
|
5462
6261
|
{
|
|
5463
6262
|
href: social.handle,
|
|
@@ -5470,55 +6269,55 @@ var UserInfoCard = ({
|
|
|
5470
6269
|
);
|
|
5471
6270
|
}) }) : null
|
|
5472
6271
|
] }),
|
|
5473
|
-
onEditProfile ? /* @__PURE__ */
|
|
6272
|
+
onEditProfile ? /* @__PURE__ */ jsxs17(
|
|
5474
6273
|
"button",
|
|
5475
6274
|
{
|
|
5476
6275
|
type: "button",
|
|
5477
6276
|
onClick: onEditProfile,
|
|
5478
6277
|
className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
|
|
5479
6278
|
children: [
|
|
5480
|
-
/* @__PURE__ */
|
|
5481
|
-
/* @__PURE__ */
|
|
6279
|
+
/* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
6280
|
+
/* @__PURE__ */ jsx18("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
|
|
5482
6281
|
]
|
|
5483
6282
|
}
|
|
5484
6283
|
) : null
|
|
5485
6284
|
] }),
|
|
5486
|
-
hasWallets || !!user.socialHandle ? /* @__PURE__ */
|
|
6285
|
+
hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs17("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
|
|
5487
6286
|
wallets.map((wallet, idx) => {
|
|
5488
6287
|
const chainLower = wallet.chain.toLowerCase();
|
|
5489
6288
|
const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
|
|
5490
|
-
return /* @__PURE__ */
|
|
6289
|
+
return /* @__PURE__ */ jsxs17(
|
|
5491
6290
|
"div",
|
|
5492
6291
|
{
|
|
5493
6292
|
className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
|
|
5494
6293
|
children: [
|
|
5495
|
-
/* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
6294
|
+
/* @__PURE__ */ jsx18("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx18(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
|
|
6295
|
+
/* @__PURE__ */ jsx18("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
|
|
5497
6296
|
]
|
|
5498
6297
|
},
|
|
5499
6298
|
`wallet-${idx}`
|
|
5500
6299
|
);
|
|
5501
6300
|
}),
|
|
5502
|
-
user.socialHandle ? /* @__PURE__ */
|
|
6301
|
+
user.socialHandle ? /* @__PURE__ */ jsx18("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx18("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
|
|
5503
6302
|
] }) : null
|
|
5504
6303
|
] })
|
|
5505
6304
|
] }),
|
|
5506
|
-
(onDeposit || onWithdraw) && /* @__PURE__ */
|
|
5507
|
-
onDeposit ? /* @__PURE__ */
|
|
6305
|
+
(onDeposit || onWithdraw) && /* @__PURE__ */ jsxs17("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
|
|
6306
|
+
onDeposit ? /* @__PURE__ */ jsx18(
|
|
5508
6307
|
ConditionalWrapper,
|
|
5509
6308
|
{
|
|
5510
6309
|
condition: isDepositBlocked,
|
|
5511
|
-
wrapper: (children) => /* @__PURE__ */
|
|
6310
|
+
wrapper: (children) => /* @__PURE__ */ jsx18(
|
|
5512
6311
|
Tooltip,
|
|
5513
6312
|
{
|
|
5514
|
-
content: /* @__PURE__ */
|
|
6313
|
+
content: /* @__PURE__ */ jsx18("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
5515
6314
|
size: "small",
|
|
5516
6315
|
side: "bottom",
|
|
5517
6316
|
sideOffset: 4,
|
|
5518
6317
|
children
|
|
5519
6318
|
}
|
|
5520
6319
|
),
|
|
5521
|
-
children: /* @__PURE__ */
|
|
6320
|
+
children: /* @__PURE__ */ jsx18(
|
|
5522
6321
|
Button,
|
|
5523
6322
|
__spreadProps(__spreadValues({
|
|
5524
6323
|
variant: "primary",
|
|
@@ -5530,7 +6329,7 @@ var UserInfoCard = ({
|
|
|
5530
6329
|
)
|
|
5531
6330
|
}
|
|
5532
6331
|
) : null,
|
|
5533
|
-
onWithdraw ? /* @__PURE__ */
|
|
6332
|
+
onWithdraw ? /* @__PURE__ */ jsx18(
|
|
5534
6333
|
Button,
|
|
5535
6334
|
{
|
|
5536
6335
|
variant: "secondary",
|
|
@@ -5540,15 +6339,15 @@ var UserInfoCard = ({
|
|
|
5540
6339
|
children: labels.auth.withdraw
|
|
5541
6340
|
}
|
|
5542
6341
|
) : null,
|
|
5543
|
-
onEditProfile ? /* @__PURE__ */
|
|
6342
|
+
onEditProfile ? /* @__PURE__ */ jsxs17(
|
|
5544
6343
|
"button",
|
|
5545
6344
|
{
|
|
5546
6345
|
type: "button",
|
|
5547
6346
|
onClick: onEditProfile,
|
|
5548
6347
|
className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
|
|
5549
6348
|
children: [
|
|
5550
|
-
/* @__PURE__ */
|
|
5551
|
-
/* @__PURE__ */
|
|
6349
|
+
/* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
6350
|
+
/* @__PURE__ */ jsx18("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
|
|
5552
6351
|
]
|
|
5553
6352
|
}
|
|
5554
6353
|
) : null
|
|
@@ -5560,14 +6359,14 @@ var UserInfoCard = ({
|
|
|
5560
6359
|
UserInfoCard.displayName = "UserInfoCard";
|
|
5561
6360
|
|
|
5562
6361
|
// src/pages/user-profile/index.tsx
|
|
5563
|
-
import { jsx as
|
|
6362
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5564
6363
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
5565
6364
|
style: "currency",
|
|
5566
6365
|
currency: "USD",
|
|
5567
6366
|
minimumFractionDigits: 2,
|
|
5568
6367
|
maximumFractionDigits: 2
|
|
5569
6368
|
});
|
|
5570
|
-
var
|
|
6369
|
+
var formatUsd2 = (value) => currencyFormatter.format(Number.isFinite(value) ? value : 0);
|
|
5571
6370
|
var formatSignedPercentLabel = (ratio) => {
|
|
5572
6371
|
const pct = Number.isFinite(ratio) ? ratio * 100 : 0;
|
|
5573
6372
|
const sign = pct > 0 ? "+" : "";
|
|
@@ -5970,10 +6769,10 @@ var toRedeemTransactions = (item) => {
|
|
|
5970
6769
|
});
|
|
5971
6770
|
};
|
|
5972
6771
|
var POSITION_ROW_VENUE_ORDER = [
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
6772
|
+
Venue3.polymarket,
|
|
6773
|
+
Venue3.kalshi,
|
|
6774
|
+
Venue3.opinion,
|
|
6775
|
+
Venue3.limitless
|
|
5977
6776
|
];
|
|
5978
6777
|
function venueBreakdownSortKey(venue) {
|
|
5979
6778
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -6058,14 +6857,14 @@ var UserProfilePage = ({
|
|
|
6058
6857
|
onError
|
|
6059
6858
|
}) => {
|
|
6060
6859
|
var _a, _b;
|
|
6061
|
-
const [isHydrated, setIsHydrated] =
|
|
6062
|
-
|
|
6860
|
+
const [isHydrated, setIsHydrated] = useState12(false);
|
|
6861
|
+
useEffect11(() => {
|
|
6063
6862
|
setIsHydrated(true);
|
|
6064
6863
|
}, []);
|
|
6065
6864
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
6066
6865
|
const { isDepositBlocked } = useGeoBlock();
|
|
6067
|
-
const balanceState =
|
|
6068
|
-
const labels =
|
|
6866
|
+
const balanceState = useAggBalance2();
|
|
6867
|
+
const labels = useLabels12();
|
|
6069
6868
|
const {
|
|
6070
6869
|
features: { showLimitOrders },
|
|
6071
6870
|
trading: { executionMode: configuredExecutionMode }
|
|
@@ -6073,25 +6872,35 @@ var UserProfilePage = ({
|
|
|
6073
6872
|
const client = useAggClient();
|
|
6074
6873
|
const cancelOrderMutation = useCancelManagedOrder();
|
|
6075
6874
|
const toastContext = useOptionalToast();
|
|
6076
|
-
const [internalCancellingIds, setInternalCancellingIds] =
|
|
6875
|
+
const [internalCancellingIds, setInternalCancellingIds] = useState12({});
|
|
6077
6876
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
6078
6877
|
onClaim,
|
|
6079
6878
|
onClaimResult,
|
|
6080
6879
|
onClaimSubmitError,
|
|
6081
6880
|
externalClaimingKeys: claimingPositionKeys
|
|
6082
6881
|
});
|
|
6083
|
-
const [profileUser, setProfileUser] =
|
|
6882
|
+
const [profileUser, setProfileUser] = useState12(void 0);
|
|
6084
6883
|
const shouldUseHookData = !user;
|
|
6085
|
-
const connectedVenues =
|
|
6884
|
+
const connectedVenues = useMemo8(() => {
|
|
6086
6885
|
var _a2;
|
|
6087
6886
|
if (!shouldUseHookData) return [];
|
|
6088
6887
|
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
6089
6888
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
6090
6889
|
}, [balanceState, shouldUseHookData]);
|
|
6091
|
-
const [positionFilter, setPositionFilter] =
|
|
6092
|
-
const [selectedClaimActivity, setSelectedClaimActivity] =
|
|
6890
|
+
const [positionFilter, setPositionFilter] = useState12(initialPositionFilter);
|
|
6891
|
+
const [selectedClaimActivity, setSelectedClaimActivity] = useState12(null);
|
|
6892
|
+
const [isManageBalancesOpen, setIsManageBalancesOpen] = useState12(false);
|
|
6893
|
+
const manageBalancesButtonRef = useRef10(null);
|
|
6093
6894
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
6094
6895
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
6896
|
+
const handleManageBalancesOpenChange = useCallback6((open) => {
|
|
6897
|
+
setIsManageBalancesOpen(open);
|
|
6898
|
+
if (open) return;
|
|
6899
|
+
requestAnimationFrame(() => {
|
|
6900
|
+
var _a2;
|
|
6901
|
+
return (_a2 = manageBalancesButtonRef.current) == null ? void 0 : _a2.focus();
|
|
6902
|
+
});
|
|
6903
|
+
}, []);
|
|
6095
6904
|
const activePositionsQuery = useExecutionPositions({
|
|
6096
6905
|
enabled: shouldUseHookData && isAuthenticated,
|
|
6097
6906
|
status: "active",
|
|
@@ -6104,14 +6913,14 @@ var UserProfilePage = ({
|
|
|
6104
6913
|
limit: 25,
|
|
6105
6914
|
mode: queryExecutionMode
|
|
6106
6915
|
});
|
|
6107
|
-
const handlePositionFilterChange =
|
|
6916
|
+
const handlePositionFilterChange = useCallback6(
|
|
6108
6917
|
(filter) => {
|
|
6109
6918
|
setPositionFilter(filter);
|
|
6110
6919
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
6111
6920
|
},
|
|
6112
6921
|
[onPositionFilterChangeProp]
|
|
6113
6922
|
);
|
|
6114
|
-
|
|
6923
|
+
useEffect11(() => {
|
|
6115
6924
|
setPositionFilter(initialPositionFilter);
|
|
6116
6925
|
}, [initialPositionFilter]);
|
|
6117
6926
|
const ordersQuery = useExecutionOrders({
|
|
@@ -6168,7 +6977,7 @@ var UserProfilePage = ({
|
|
|
6168
6977
|
limit: 25,
|
|
6169
6978
|
mode: queryExecutionMode
|
|
6170
6979
|
});
|
|
6171
|
-
const openOrderQueries =
|
|
6980
|
+
const openOrderQueries = useMemo8(
|
|
6172
6981
|
() => [
|
|
6173
6982
|
pendingOpenOrdersQuery,
|
|
6174
6983
|
signingOpenOrdersQuery,
|
|
@@ -6194,7 +7003,7 @@ var UserProfilePage = ({
|
|
|
6194
7003
|
enabled: shouldUseHookData && isAuthenticated,
|
|
6195
7004
|
limit: 25
|
|
6196
7005
|
});
|
|
6197
|
-
const handleCancelOrder =
|
|
7006
|
+
const handleCancelOrder = useCallback6(
|
|
6198
7007
|
(order) => __async(null, null, function* () {
|
|
6199
7008
|
if (onCancelOrder) {
|
|
6200
7009
|
onCancelOrder(order);
|
|
@@ -6227,7 +7036,7 @@ var UserProfilePage = ({
|
|
|
6227
7036
|
}),
|
|
6228
7037
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
6229
7038
|
);
|
|
6230
|
-
const handleClaimPosition =
|
|
7039
|
+
const handleClaimPosition = useCallback6(
|
|
6231
7040
|
(position) => {
|
|
6232
7041
|
var _a2, _b2;
|
|
6233
7042
|
return startClaim({
|
|
@@ -6238,7 +7047,7 @@ var UserProfilePage = ({
|
|
|
6238
7047
|
},
|
|
6239
7048
|
[startClaim]
|
|
6240
7049
|
);
|
|
6241
|
-
const handleActivityRowClick =
|
|
7050
|
+
const handleActivityRowClick = useCallback6(
|
|
6242
7051
|
(activity) => {
|
|
6243
7052
|
if (activity.kind === "redeem") {
|
|
6244
7053
|
setSelectedClaimActivity(activity);
|
|
@@ -6248,13 +7057,13 @@ var UserProfilePage = ({
|
|
|
6248
7057
|
},
|
|
6249
7058
|
[onActivityClick]
|
|
6250
7059
|
);
|
|
6251
|
-
const handleClaimTransactionSelect =
|
|
7060
|
+
const handleClaimTransactionSelect = useCallback6((transaction) => {
|
|
6252
7061
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
6253
7062
|
setSelectedClaimActivity(null);
|
|
6254
7063
|
if (!href || typeof window === "undefined") return;
|
|
6255
7064
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
6256
7065
|
}, []);
|
|
6257
|
-
|
|
7066
|
+
useEffect11(() => {
|
|
6258
7067
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
6259
7068
|
setProfileUser(void 0);
|
|
6260
7069
|
return;
|
|
@@ -6273,7 +7082,7 @@ var UserProfilePage = ({
|
|
|
6273
7082
|
isActive = false;
|
|
6274
7083
|
};
|
|
6275
7084
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
6276
|
-
const resolvedUser =
|
|
7085
|
+
const resolvedUser = useMemo8(() => {
|
|
6277
7086
|
var _a2, _b2, _c, _d, _e, _f;
|
|
6278
7087
|
if (user) return user;
|
|
6279
7088
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -6307,40 +7116,32 @@ var UserProfilePage = ({
|
|
|
6307
7116
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
6308
7117
|
};
|
|
6309
7118
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
6310
|
-
const _resolvedVenueBalances =
|
|
7119
|
+
const _resolvedVenueBalances = useMemo8(() => {
|
|
6311
7120
|
if (_venueBalances) return _venueBalances;
|
|
6312
7121
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
6313
7122
|
chain: item.label,
|
|
6314
7123
|
accountCount: item.accountCount,
|
|
6315
|
-
balanceLabel:
|
|
7124
|
+
balanceLabel: formatUsd2(item.balance)
|
|
6316
7125
|
}));
|
|
6317
7126
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
6318
|
-
const positionsValueLabel =
|
|
7127
|
+
const positionsValueLabel = useMemo8(() => {
|
|
6319
7128
|
var _a2;
|
|
6320
7129
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
return formatUsd(positionsValueTotal);
|
|
6325
|
-
}, [balance, balanceState]);
|
|
6326
|
-
const availableBalanceLabel = useMemo7(() => {
|
|
7130
|
+
return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
|
|
7131
|
+
}, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
|
|
7132
|
+
const availableBalanceLabel = useMemo8(() => {
|
|
6327
7133
|
var _a2, _b2;
|
|
6328
|
-
return
|
|
7134
|
+
return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
6329
7135
|
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
6330
|
-
const reservedBalanceLabel = useMemo7(() => {
|
|
6331
|
-
var _a2;
|
|
6332
|
-
const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
|
|
6333
|
-
return reserved > 0 ? formatUsd(reserved) : void 0;
|
|
6334
|
-
}, [balanceState.reservedBalance]);
|
|
6335
7136
|
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig2();
|
|
6336
7137
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
6337
|
-
venueId:
|
|
7138
|
+
venueId: Venue3.kalshi,
|
|
6338
7139
|
disabledVenues,
|
|
6339
7140
|
isConfigLoading: isAppConfigLoading
|
|
6340
7141
|
}) === "available";
|
|
6341
7142
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
6342
7143
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
6343
|
-
const resolvedActivities =
|
|
7144
|
+
const resolvedActivities = useMemo8(() => {
|
|
6344
7145
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
6345
7146
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
6346
7147
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -6491,7 +7292,7 @@ var UserProfilePage = ({
|
|
|
6491
7292
|
};
|
|
6492
7293
|
});
|
|
6493
7294
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
6494
|
-
const resolvedOpenOrders =
|
|
7295
|
+
const resolvedOpenOrders = useMemo8(() => {
|
|
6495
7296
|
if (openOrders) return openOrders;
|
|
6496
7297
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
6497
7298
|
for (const query of openOrderQueries) {
|
|
@@ -6532,30 +7333,30 @@ var UserProfilePage = ({
|
|
|
6532
7333
|
});
|
|
6533
7334
|
});
|
|
6534
7335
|
}, [labels, openOrderQueries, openOrders]);
|
|
6535
|
-
const isOpenOrdersQueryLoading =
|
|
7336
|
+
const isOpenOrdersQueryLoading = useMemo8(
|
|
6536
7337
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
6537
7338
|
[openOrderQueries]
|
|
6538
7339
|
);
|
|
6539
|
-
const hasOpenOrdersQueryError =
|
|
7340
|
+
const hasOpenOrdersQueryError = useMemo8(
|
|
6540
7341
|
() => openOrderQueries.some((query) => query.error),
|
|
6541
7342
|
[openOrderQueries]
|
|
6542
7343
|
);
|
|
6543
|
-
const hasMoreOpenOrdersQuery =
|
|
7344
|
+
const hasMoreOpenOrdersQuery = useMemo8(
|
|
6544
7345
|
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
6545
7346
|
[openOrderQueries]
|
|
6546
7347
|
);
|
|
6547
|
-
const isLoadingMoreOpenOrdersQuery =
|
|
7348
|
+
const isLoadingMoreOpenOrdersQuery = useMemo8(
|
|
6548
7349
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
6549
7350
|
[openOrderQueries]
|
|
6550
7351
|
);
|
|
6551
|
-
const handleLoadMoreOpenOrders =
|
|
7352
|
+
const handleLoadMoreOpenOrders = useCallback6(() => {
|
|
6552
7353
|
for (const query of openOrderQueries) {
|
|
6553
7354
|
if (query.hasNextPage) {
|
|
6554
7355
|
void query.fetchNextPage();
|
|
6555
7356
|
}
|
|
6556
7357
|
}
|
|
6557
7358
|
}, [openOrderQueries]);
|
|
6558
|
-
const adaptPositionGroups =
|
|
7359
|
+
const adaptPositionGroups = useCallback6(
|
|
6559
7360
|
(groups) => {
|
|
6560
7361
|
return groups.flatMap((group) => {
|
|
6561
7362
|
var _a2, _b2, _c, _d;
|
|
@@ -6599,9 +7400,9 @@ var UserProfilePage = ({
|
|
|
6599
7400
|
averagePrice: outcome.avgEntryPrice,
|
|
6600
7401
|
currentLabel: currentPriceCents == null ? "\u2014" : `${currentPriceCents}\xA2`,
|
|
6601
7402
|
currentPrice: displayCurrentPrice,
|
|
6602
|
-
valueLabel: displayCurrentValue == null ? "\u2014" :
|
|
7403
|
+
valueLabel: displayCurrentValue == null ? "\u2014" : formatUsd2(displayCurrentValue),
|
|
6603
7404
|
currentValue: displayCurrentValue,
|
|
6604
|
-
pnlLabel: displayPnlValue == null || pnlPercent == null ? "\u2014" : `${pnlPrefix}${
|
|
7405
|
+
pnlLabel: displayPnlValue == null || pnlPercent == null ? "\u2014" : `${pnlPrefix}${formatUsd2(displayPnlValue)} (${pnlPrefix}${pnlPercent}%)`,
|
|
6605
7406
|
pnlValue: displayPnlValue,
|
|
6606
7407
|
pnlPercent: displayPnlPercent,
|
|
6607
7408
|
isPnlPositive: displayPnlValue != null && displayPnlValue >= 0,
|
|
@@ -6609,9 +7410,9 @@ var UserProfilePage = ({
|
|
|
6609
7410
|
marketStatus: group.venueMarket.status,
|
|
6610
7411
|
winner: (_d2 = outcome.winner) != null ? _d2 : null,
|
|
6611
7412
|
resolutionDate: group.resolutionDate,
|
|
6612
|
-
closedTotalTradedLabel:
|
|
7413
|
+
closedTotalTradedLabel: formatUsd2(totalTradedValue),
|
|
6613
7414
|
totalTradedValue,
|
|
6614
|
-
closedAmountWonLabel:
|
|
7415
|
+
closedAmountWonLabel: formatUsd2(finalPayoutValue),
|
|
6615
7416
|
finalPayoutValue,
|
|
6616
7417
|
finalPnlValue,
|
|
6617
7418
|
finalPnlPercent,
|
|
@@ -6625,15 +7426,15 @@ var UserProfilePage = ({
|
|
|
6625
7426
|
},
|
|
6626
7427
|
[]
|
|
6627
7428
|
);
|
|
6628
|
-
const resolvedActivePositions =
|
|
7429
|
+
const resolvedActivePositions = useMemo8(() => {
|
|
6629
7430
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
6630
7431
|
return source.filter(shouldIncludeByShares);
|
|
6631
7432
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
6632
|
-
const resolvedClosedPositions =
|
|
7433
|
+
const resolvedClosedPositions = useMemo8(() => {
|
|
6633
7434
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
6634
7435
|
return source.filter(shouldIncludeByShares);
|
|
6635
7436
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
6636
|
-
return /* @__PURE__ */
|
|
7437
|
+
return /* @__PURE__ */ jsx19(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx19(
|
|
6637
7438
|
"section",
|
|
6638
7439
|
{
|
|
6639
7440
|
className: cn(
|
|
@@ -6641,7 +7442,7 @@ var UserProfilePage = ({
|
|
|
6641
7442
|
"w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
|
|
6642
7443
|
classNames == null ? void 0 : classNames.root
|
|
6643
7444
|
),
|
|
6644
|
-
children: /* @__PURE__ */
|
|
7445
|
+
children: /* @__PURE__ */ jsxs18(
|
|
6645
7446
|
"div",
|
|
6646
7447
|
{
|
|
6647
7448
|
className: cn(
|
|
@@ -6651,8 +7452,8 @@ var UserProfilePage = ({
|
|
|
6651
7452
|
classNames == null ? void 0 : classNames.topRow
|
|
6652
7453
|
),
|
|
6653
7454
|
children: [
|
|
6654
|
-
/* @__PURE__ */
|
|
6655
|
-
/* @__PURE__ */
|
|
7455
|
+
/* @__PURE__ */ jsxs18("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
|
|
7456
|
+
/* @__PURE__ */ jsx19(
|
|
6656
7457
|
"div",
|
|
6657
7458
|
{
|
|
6658
7459
|
className: cn(
|
|
@@ -6660,7 +7461,7 @@ var UserProfilePage = ({
|
|
|
6660
7461
|
"flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
|
|
6661
7462
|
classNames == null ? void 0 : classNames.leftColumn
|
|
6662
7463
|
),
|
|
6663
|
-
children: /* @__PURE__ */
|
|
7464
|
+
children: /* @__PURE__ */ jsx19(
|
|
6664
7465
|
UserInfoCard,
|
|
6665
7466
|
{
|
|
6666
7467
|
user: resolvedUser,
|
|
@@ -6673,7 +7474,7 @@ var UserProfilePage = ({
|
|
|
6673
7474
|
)
|
|
6674
7475
|
}
|
|
6675
7476
|
),
|
|
6676
|
-
/* @__PURE__ */
|
|
7477
|
+
/* @__PURE__ */ jsxs18(
|
|
6677
7478
|
"div",
|
|
6678
7479
|
{
|
|
6679
7480
|
className: cn(
|
|
@@ -6681,7 +7482,7 @@ var UserProfilePage = ({
|
|
|
6681
7482
|
classNames == null ? void 0 : classNames.rightColumn
|
|
6682
7483
|
),
|
|
6683
7484
|
children: [
|
|
6684
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ jsxs18(
|
|
6685
7486
|
"div",
|
|
6686
7487
|
{
|
|
6687
7488
|
className: cn(
|
|
@@ -6689,7 +7490,7 @@ var UserProfilePage = ({
|
|
|
6689
7490
|
isKalshiAvailable ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
|
|
6690
7491
|
),
|
|
6691
7492
|
children: [
|
|
6692
|
-
/* @__PURE__ */
|
|
7493
|
+
/* @__PURE__ */ jsx19(
|
|
6693
7494
|
PositionsValueCard,
|
|
6694
7495
|
{
|
|
6695
7496
|
label: labels.userProfile.balance.positionsValue,
|
|
@@ -6697,22 +7498,21 @@ var UserProfilePage = ({
|
|
|
6697
7498
|
isLoading: isPositionsValueLoading
|
|
6698
7499
|
}
|
|
6699
7500
|
),
|
|
6700
|
-
isKalshiAvailable ? /* @__PURE__ */
|
|
7501
|
+
isKalshiAvailable ? /* @__PURE__ */ jsx19(
|
|
6701
7502
|
PositionsValueCard,
|
|
6702
7503
|
{
|
|
6703
7504
|
label: labels.userProfile.balance.kalshiBalance,
|
|
6704
|
-
valueLabel:
|
|
6705
|
-
icon: /* @__PURE__ */
|
|
7505
|
+
valueLabel: formatUsd2((_a = balanceState.kalshiBalance) != null ? _a : 0),
|
|
7506
|
+
icon: /* @__PURE__ */ jsx19(VenueLogo, { venue: Venue3.kalshi, size: "small", className: "size-4" })
|
|
6706
7507
|
}
|
|
6707
7508
|
) : null
|
|
6708
7509
|
]
|
|
6709
7510
|
}
|
|
6710
7511
|
),
|
|
6711
|
-
/* @__PURE__ */
|
|
7512
|
+
/* @__PURE__ */ jsx19(
|
|
6712
7513
|
AvailableBalanceCard,
|
|
6713
7514
|
{
|
|
6714
7515
|
valueLabel: availableBalanceLabel,
|
|
6715
|
-
reservedValueLabel: reservedBalanceLabel,
|
|
6716
7516
|
isLoading: isAvailableBalanceLoading,
|
|
6717
7517
|
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
6718
7518
|
key: b.key,
|
|
@@ -6720,14 +7520,16 @@ var UserProfilePage = ({
|
|
|
6720
7520
|
balance: b.balance,
|
|
6721
7521
|
accountCount: b.accountCount,
|
|
6722
7522
|
venues: b.venues
|
|
6723
|
-
}))
|
|
7523
|
+
})),
|
|
7524
|
+
manageButtonRef: manageBalancesButtonRef,
|
|
7525
|
+
onManage: () => handleManageBalancesOpenChange(true)
|
|
6724
7526
|
}
|
|
6725
7527
|
)
|
|
6726
7528
|
]
|
|
6727
7529
|
}
|
|
6728
7530
|
)
|
|
6729
7531
|
] }),
|
|
6730
|
-
/* @__PURE__ */
|
|
7532
|
+
/* @__PURE__ */ jsx19(
|
|
6731
7533
|
PositionsActivity,
|
|
6732
7534
|
{
|
|
6733
7535
|
tab,
|
|
@@ -6779,7 +7581,7 @@ var UserProfilePage = ({
|
|
|
6779
7581
|
className: classNames == null ? void 0 : classNames.positionsActivity
|
|
6780
7582
|
}
|
|
6781
7583
|
),
|
|
6782
|
-
/* @__PURE__ */
|
|
7584
|
+
/* @__PURE__ */ jsx19(
|
|
6783
7585
|
ClaimActivityBreakdownModal,
|
|
6784
7586
|
{
|
|
6785
7587
|
activity: selectedClaimActivity,
|
|
@@ -6789,6 +7591,13 @@ var UserProfilePage = ({
|
|
|
6789
7591
|
},
|
|
6790
7592
|
onTransactionSelect: handleClaimTransactionSelect
|
|
6791
7593
|
}
|
|
7594
|
+
),
|
|
7595
|
+
/* @__PURE__ */ jsx19(
|
|
7596
|
+
ManageBalancesModal,
|
|
7597
|
+
{
|
|
7598
|
+
open: isManageBalancesOpen,
|
|
7599
|
+
onOpenChange: handleManageBalancesOpenChange
|
|
7600
|
+
}
|
|
6792
7601
|
)
|
|
6793
7602
|
]
|
|
6794
7603
|
}
|
|
@@ -6804,6 +7613,7 @@ export {
|
|
|
6804
7613
|
EventMarketPage,
|
|
6805
7614
|
useHomePageModals,
|
|
6806
7615
|
HomePage,
|
|
7616
|
+
ManageBalancesModal,
|
|
6807
7617
|
USER_PROFILE_TAB_POSITIONS,
|
|
6808
7618
|
USER_PROFILE_TAB_OPEN_ORDERS,
|
|
6809
7619
|
USER_PROFILE_TAB_ACTIVITY,
|