@agg-build/ui 2.1.2 → 2.1.4
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-ZOECARZW.mjs → chunk-BW7S2YR3.mjs} +798 -312
- package/dist/{chunk-7ZR5JYB3.mjs → chunk-FLESSOSU.mjs} +2077 -533
- package/dist/{chunk-5RBHMMY3.mjs → chunk-R2YNZJZ3.mjs} +69 -27
- package/dist/{chunk-75AMJAWR.mjs → chunk-T4YZGAYS.mjs} +22 -1
- package/dist/{chunk-JJDYOBVG.mjs → chunk-TBZWRUFB.mjs} +654 -560
- package/dist/{chunk-TBD3N4T4.mjs → chunk-VP76G6PN.mjs} +41 -41
- package/dist/{chunk-NRNBJPYK.mjs → chunk-XHE2VO3S.mjs} +4 -21
- package/dist/events.js +776 -638
- package/dist/events.mjs +5 -3
- package/dist/index.js +5665 -3867
- package/dist/index.mjs +112 -455
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +8330 -6452
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +40 -41
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +652 -415
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.utils.d.mts +1 -25
- package/dist/types/events/item/event-list-item.utils.d.ts +1 -25
- package/dist/types/events/item-details/index.d.mts +2 -1
- package/dist/types/events/item-details/index.d.ts +2 -1
- package/dist/types/events/market-details/market-details-graph-panel.d.mts +39 -0
- package/dist/types/events/market-details/market-details-graph-panel.d.ts +39 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +2 -1
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +2 -1
- package/dist/types/events/market-details/market-details.types.d.mts +31 -0
- package/dist/types/events/market-details/market-details.types.d.ts +31 -0
- package/dist/types/events/market-details/market-details.utils.d.mts +3 -16
- package/dist/types/events/market-details/market-details.utils.d.ts +3 -16
- package/dist/types/events/shared/format-event-title.d.mts +1 -2
- package/dist/types/events/shared/format-event-title.d.ts +1 -2
- package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
- package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
- package/dist/types/notifications/agg-notification-events-provider.d.mts +10 -1
- package/dist/types/notifications/agg-notification-events-provider.d.ts +10 -1
- package/dist/types/pages/event-market/event-market.shared.d.mts +30 -0
- package/dist/types/pages/event-market/event-market.shared.d.ts +30 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.mts +8 -0
- package/dist/types/pages/event-market/sports-event-market-page.d.ts +8 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +13 -0
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +13 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +156 -0
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +156 -0
- package/dist/types/pages/event-market/sports-line-rail.d.mts +17 -0
- package/dist/types/pages/event-market/sports-line-rail.d.ts +17 -0
- package/dist/types/pages/event-market/sports-market-card.d.mts +22 -0
- package/dist/types/pages/event-market/sports-market-card.d.ts +22 -0
- package/dist/types/pages/event-market/sports-markets.d.mts +13 -0
- package/dist/types/pages/event-market/sports-markets.d.ts +13 -0
- package/dist/types/primitives/search/search.utils.d.mts +1 -3
- package/dist/types/primitives/search/search.utils.d.ts +1 -3
- package/dist/types/primitives/state-message/index.d.mts +1 -1
- package/dist/types/primitives/state-message/index.d.ts +1 -1
- package/dist/types/primitives/state-message/state-message.types.d.mts +1 -1
- package/dist/types/primitives/state-message/state-message.types.d.ts +1 -1
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +7 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +7 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.mts +5 -2
- package/dist/types/trading/settlement/settlement-text.utils.d.ts +5 -2
- 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-TBZWRUFB.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BW7S2YR3.mjs";
|
|
22
22
|
import {
|
|
23
23
|
AggErrorBoundary,
|
|
24
24
|
Button,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
resolveTabVenus,
|
|
49
49
|
shortenAddress,
|
|
50
50
|
sortCategoriesForNavigation
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-VP76G6PN.mjs";
|
|
52
52
|
|
|
53
53
|
// src/pages/home/index.tsx
|
|
54
54
|
import {
|
|
@@ -56,25 +56,23 @@ import {
|
|
|
56
56
|
useAppConfig,
|
|
57
57
|
useCategories,
|
|
58
58
|
useEventListState,
|
|
59
|
-
useLabels as
|
|
60
|
-
useSdkUiConfig as
|
|
59
|
+
useLabels as useLabels4,
|
|
60
|
+
useSdkUiConfig as useSdkUiConfig4,
|
|
61
61
|
useSearch
|
|
62
62
|
} from "@agg-build/hooks";
|
|
63
63
|
import { VENUES } from "@agg-build/sdk";
|
|
64
|
-
import { useCallback as
|
|
64
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
|
|
65
65
|
|
|
66
66
|
// src/pages/event-market/index.tsx
|
|
67
67
|
import {
|
|
68
|
-
resolveEventTradingState,
|
|
69
|
-
TradeSide,
|
|
68
|
+
resolveEventTradingState as resolveEventTradingState3,
|
|
69
|
+
TradeSide as TradeSide2,
|
|
70
70
|
useEnrichedVenueEvent,
|
|
71
|
-
useEventTradingContext,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
useSdkUiConfig
|
|
71
|
+
useEventTradingContext as useEventTradingContext4,
|
|
72
|
+
useMidpoints as useMidpoints2,
|
|
73
|
+
useSdkUiConfig as useSdkUiConfig3
|
|
75
74
|
} from "@agg-build/hooks";
|
|
76
|
-
import
|
|
77
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
75
|
+
import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
78
76
|
|
|
79
77
|
// src/pages/event-market/event-market.utils.ts
|
|
80
78
|
var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
|
|
@@ -130,20 +128,26 @@ var resolveEventMarketPageStickyState = ({
|
|
|
130
128
|
};
|
|
131
129
|
};
|
|
132
130
|
|
|
133
|
-
// src/pages/event-market/
|
|
131
|
+
// src/pages/event-market/event-market.shared.tsx
|
|
132
|
+
import { useLabels } from "@agg-build/hooks";
|
|
133
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
134
|
+
import { useEffect, useState } from "react";
|
|
134
135
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
135
136
|
var MOBILE_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1023px)";
|
|
136
|
-
var
|
|
137
|
+
var SPORTS_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1279px)";
|
|
138
|
+
var getIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
|
|
137
139
|
if (typeof window === "undefined") return false;
|
|
138
140
|
if (typeof window.matchMedia !== "function") return false;
|
|
139
|
-
return window.matchMedia(
|
|
141
|
+
return window.matchMedia(mediaQuery).matches;
|
|
140
142
|
};
|
|
141
|
-
var useIsMobileEventMarketViewport = () => {
|
|
142
|
-
const [isMobileViewport, setIsMobileViewport] = useState(
|
|
143
|
+
var useIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
|
|
144
|
+
const [isMobileViewport, setIsMobileViewport] = useState(
|
|
145
|
+
() => getIsMobileEventMarketViewport(mediaQuery)
|
|
146
|
+
);
|
|
143
147
|
useEffect(() => {
|
|
144
148
|
if (typeof window === "undefined") return;
|
|
145
149
|
if (typeof window.matchMedia !== "function") return;
|
|
146
|
-
const mediaQueryList = window.matchMedia(
|
|
150
|
+
const mediaQueryList = window.matchMedia(mediaQuery);
|
|
147
151
|
const handleChange = () => {
|
|
148
152
|
setIsMobileViewport(mediaQueryList.matches);
|
|
149
153
|
};
|
|
@@ -152,7 +156,7 @@ var useIsMobileEventMarketViewport = () => {
|
|
|
152
156
|
return () => {
|
|
153
157
|
mediaQueryList.removeEventListener("change", handleChange);
|
|
154
158
|
};
|
|
155
|
-
}, []);
|
|
159
|
+
}, [mediaQuery]);
|
|
156
160
|
return isMobileViewport;
|
|
157
161
|
};
|
|
158
162
|
var resolveDesktopTradePlaceOrderClassNames = (classNames) => {
|
|
@@ -231,6 +235,7 @@ var EventMarketPageMobileTrade = ({
|
|
|
231
235
|
{
|
|
232
236
|
eventTradingState,
|
|
233
237
|
executionMode,
|
|
238
|
+
isQuotePanelActive: isOpen,
|
|
234
239
|
midpointsResult,
|
|
235
240
|
onBeforePrimaryAction,
|
|
236
241
|
className: cn(
|
|
@@ -275,83 +280,1587 @@ var EventMarketPageNotFoundState = ({
|
|
|
275
280
|
}
|
|
276
281
|
);
|
|
277
282
|
};
|
|
278
|
-
var EventMarketPageLoadingState = ({
|
|
283
|
+
var EventMarketPageLoadingState = ({
|
|
284
|
+
classNames,
|
|
285
|
+
stickyOrderPanel
|
|
286
|
+
}) => {
|
|
287
|
+
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
288
|
+
stickyOrderPanel
|
|
289
|
+
});
|
|
290
|
+
return /* @__PURE__ */ jsx(
|
|
291
|
+
"section",
|
|
292
|
+
{
|
|
293
|
+
className: cn(
|
|
294
|
+
"agg-event-market-page",
|
|
295
|
+
"w-full mx-auto max-w-[1440px] px-6 lg:px-10 pb-10",
|
|
296
|
+
classNames == null ? void 0 : classNames.root
|
|
297
|
+
),
|
|
298
|
+
children: /* @__PURE__ */ jsxs(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: cn(
|
|
302
|
+
"agg-page-content",
|
|
303
|
+
"flex w-full flex-col gap-6 lg:flex-row lg:items-start lg:gap-8",
|
|
304
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
|
|
305
|
+
classNames == null ? void 0 : classNames.content
|
|
306
|
+
),
|
|
307
|
+
style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ jsxs(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
className: cn(
|
|
313
|
+
"agg-page-main flex min-w-0 flex-1 flex-col gap-6 mb-10",
|
|
314
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
315
|
+
classNames == null ? void 0 : classNames.main
|
|
316
|
+
),
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx(
|
|
319
|
+
EventListItemDetails,
|
|
320
|
+
{
|
|
321
|
+
isLoading: true,
|
|
322
|
+
classNames: {
|
|
323
|
+
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsxs("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
|
|
328
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
|
|
329
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
|
|
330
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
|
|
331
|
+
] })
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ jsx(
|
|
336
|
+
"aside",
|
|
337
|
+
{
|
|
338
|
+
className: cn(
|
|
339
|
+
"agg-sidebar",
|
|
340
|
+
"hidden w-full shrink-0 lg:block lg:w-[342px] lg:shrink-0",
|
|
341
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
|
|
342
|
+
classNames == null ? void 0 : classNames.sidebar
|
|
343
|
+
),
|
|
344
|
+
children: /* @__PURE__ */ jsx(
|
|
345
|
+
PlaceOrder,
|
|
346
|
+
{
|
|
347
|
+
isLoading: true,
|
|
348
|
+
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
349
|
+
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// src/pages/event-market/sports-event-market-page.tsx
|
|
362
|
+
import {
|
|
363
|
+
resolveEventTradingState as resolveEventTradingState2,
|
|
364
|
+
TradeSide,
|
|
365
|
+
useEventTradingContext as useEventTradingContext3,
|
|
366
|
+
useMidpoints,
|
|
367
|
+
useSdkUiConfig as useSdkUiConfig2
|
|
368
|
+
} from "@agg-build/hooks";
|
|
369
|
+
import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
370
|
+
|
|
371
|
+
// src/pages/event-market/sports-markets.tsx
|
|
372
|
+
import {
|
|
373
|
+
MarketStatus as MarketStatus2,
|
|
374
|
+
resolveMarketTradingState as resolveMarketTradingState2,
|
|
375
|
+
useEventTradingContext as useEventTradingContext2,
|
|
376
|
+
useLabels as useLabels3,
|
|
377
|
+
useVenueMarkets
|
|
378
|
+
} from "@agg-build/hooks";
|
|
379
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
380
|
+
|
|
381
|
+
// src/pages/event-market/sports-market-card.tsx
|
|
382
|
+
import {
|
|
383
|
+
MarketStatus,
|
|
384
|
+
resolveMarketTradingState,
|
|
385
|
+
useEventTradingContext,
|
|
386
|
+
useLabels as useLabels2,
|
|
387
|
+
useSdkUiConfig
|
|
388
|
+
} from "@agg-build/hooks";
|
|
389
|
+
import { useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
390
|
+
|
|
391
|
+
// src/pages/event-market/sports-line-rail.tsx
|
|
392
|
+
import * as React from "react";
|
|
393
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
394
|
+
function VenueRow({ venues, active }) {
|
|
395
|
+
if (!venues || venues.length === 0) return /* @__PURE__ */ jsx2("span", { className: "h-4" });
|
|
396
|
+
const shown = venues.length > 3 ? venues.slice(0, 2) : venues;
|
|
397
|
+
const extra = venues.length - shown.length;
|
|
398
|
+
return /* @__PURE__ */ jsxs2(
|
|
399
|
+
"span",
|
|
400
|
+
{
|
|
401
|
+
className: cn(
|
|
402
|
+
"flex h-4 items-center justify-center gap-1",
|
|
403
|
+
!active && "text-agg-muted-foreground"
|
|
404
|
+
),
|
|
405
|
+
children: [
|
|
406
|
+
shown.map((venue, index) => /* @__PURE__ */ jsx2(
|
|
407
|
+
VenueLogo,
|
|
408
|
+
{
|
|
409
|
+
venue,
|
|
410
|
+
isMonochromatic: !active,
|
|
411
|
+
size: "small",
|
|
412
|
+
className: "size-3! shrink-0"
|
|
413
|
+
},
|
|
414
|
+
`${venue}-${index}`
|
|
415
|
+
)),
|
|
416
|
+
extra > 0 && /* @__PURE__ */ jsxs2("span", { className: "text-[10px] font-agg-bold uppercase leading-[14px] text-agg-muted-foreground", children: [
|
|
417
|
+
"+",
|
|
418
|
+
extra
|
|
419
|
+
] })
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
function SportsLineRail({
|
|
425
|
+
stops,
|
|
426
|
+
selectedIndex,
|
|
427
|
+
onSelect,
|
|
428
|
+
ariaLabel,
|
|
429
|
+
previousAriaLabel,
|
|
430
|
+
nextAriaLabel,
|
|
431
|
+
className
|
|
432
|
+
}) {
|
|
433
|
+
const scrollRef = React.useRef(null);
|
|
434
|
+
const itemRefs = React.useRef([]);
|
|
435
|
+
const didInit = React.useRef(false);
|
|
436
|
+
const programmatic = React.useRef(false);
|
|
437
|
+
const progTimer = React.useRef(void 0);
|
|
438
|
+
const skipCenterOnPropSync = React.useRef(false);
|
|
439
|
+
const pendingScrollIndex = React.useRef(null);
|
|
440
|
+
const scrollSettleTimer = React.useRef(void 0);
|
|
441
|
+
const stopCount = stops.length;
|
|
442
|
+
const [pad, setPad] = React.useState({ left: 0, right: 0 });
|
|
443
|
+
const [mask, setMask] = React.useState({ left: false, right: false });
|
|
444
|
+
const updateMask = React.useCallback(() => {
|
|
445
|
+
const c = scrollRef.current;
|
|
446
|
+
if (!c || !c.clientWidth) return;
|
|
447
|
+
setMask({
|
|
448
|
+
left: c.scrollLeft > 1,
|
|
449
|
+
right: c.scrollLeft + c.clientWidth < c.scrollWidth - 1
|
|
450
|
+
});
|
|
451
|
+
}, []);
|
|
452
|
+
const resolveNearestIndexToViewportCenter = React.useCallback(() => {
|
|
453
|
+
const container = scrollRef.current;
|
|
454
|
+
if (!container || !container.clientWidth) return null;
|
|
455
|
+
const viewportCenter = container.scrollLeft + container.clientWidth / 2;
|
|
456
|
+
let nearestIndex = null;
|
|
457
|
+
let nearestDistance = Number.POSITIVE_INFINITY;
|
|
458
|
+
itemRefs.current.forEach((item, index) => {
|
|
459
|
+
if (!item) return;
|
|
460
|
+
const itemCenter = item.offsetLeft + item.offsetWidth / 2;
|
|
461
|
+
const distance = Math.abs(itemCenter - viewportCenter);
|
|
462
|
+
if (distance < nearestDistance) {
|
|
463
|
+
nearestDistance = distance;
|
|
464
|
+
nearestIndex = index;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
return nearestIndex;
|
|
468
|
+
}, []);
|
|
469
|
+
React.useLayoutEffect(() => {
|
|
470
|
+
const c = scrollRef.current;
|
|
471
|
+
if (!c) return;
|
|
472
|
+
const measure = () => {
|
|
473
|
+
var _a, _b, _c, _d;
|
|
474
|
+
const w = c.clientWidth;
|
|
475
|
+
if (!w) return;
|
|
476
|
+
const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
|
|
477
|
+
const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
|
|
478
|
+
setPad({
|
|
479
|
+
left: Math.max(0, w / 2 - firstW / 2),
|
|
480
|
+
right: Math.max(0, w / 2 - lastW / 2)
|
|
481
|
+
});
|
|
482
|
+
updateMask();
|
|
483
|
+
};
|
|
484
|
+
const onScroll = () => {
|
|
485
|
+
if (!programmatic.current) {
|
|
486
|
+
const nearestIndex = resolveNearestIndexToViewportCenter();
|
|
487
|
+
if (nearestIndex != null && nearestIndex !== selectedIndex) {
|
|
488
|
+
pendingScrollIndex.current = nearestIndex;
|
|
489
|
+
clearTimeout(scrollSettleTimer.current);
|
|
490
|
+
scrollSettleTimer.current = setTimeout(() => {
|
|
491
|
+
const nextIndex = pendingScrollIndex.current;
|
|
492
|
+
if (nextIndex == null || nextIndex === selectedIndex) return;
|
|
493
|
+
skipCenterOnPropSync.current = true;
|
|
494
|
+
onSelect(nextIndex);
|
|
495
|
+
}, 120);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
updateMask();
|
|
499
|
+
};
|
|
500
|
+
measure();
|
|
501
|
+
const ro = new ResizeObserver(measure);
|
|
502
|
+
ro.observe(c);
|
|
503
|
+
c.addEventListener("scroll", onScroll, { passive: true });
|
|
504
|
+
return () => {
|
|
505
|
+
ro.disconnect();
|
|
506
|
+
c.removeEventListener("scroll", onScroll);
|
|
507
|
+
clearTimeout(scrollSettleTimer.current);
|
|
508
|
+
};
|
|
509
|
+
}, [onSelect, resolveNearestIndexToViewportCenter, selectedIndex, stopCount, updateMask]);
|
|
510
|
+
React.useEffect(() => {
|
|
511
|
+
pendingScrollIndex.current = selectedIndex;
|
|
512
|
+
}, [selectedIndex]);
|
|
513
|
+
React.useEffect(() => {
|
|
514
|
+
const c = scrollRef.current;
|
|
515
|
+
const el = itemRefs.current[selectedIndex];
|
|
516
|
+
if (!c || !el || !c.clientWidth) return;
|
|
517
|
+
if (skipCenterOnPropSync.current) {
|
|
518
|
+
skipCenterOnPropSync.current = false;
|
|
519
|
+
updateMask();
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
const max = c.scrollWidth - c.clientWidth;
|
|
523
|
+
const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
|
|
524
|
+
programmatic.current = true;
|
|
525
|
+
c.scrollTo({
|
|
526
|
+
left: Math.max(0, Math.min(max, target)),
|
|
527
|
+
behavior: didInit.current ? "smooth" : "auto"
|
|
528
|
+
});
|
|
529
|
+
if (pad.left > 0 || pad.right > 0) didInit.current = true;
|
|
530
|
+
clearTimeout(progTimer.current);
|
|
531
|
+
progTimer.current = setTimeout(() => {
|
|
532
|
+
programmatic.current = false;
|
|
533
|
+
}, 500);
|
|
534
|
+
updateMask();
|
|
535
|
+
}, [selectedIndex, stopCount, pad, updateMask]);
|
|
536
|
+
const select = (index) => {
|
|
537
|
+
const next = Math.min(stops.length - 1, Math.max(0, index));
|
|
538
|
+
if (next !== selectedIndex) onSelect(next);
|
|
539
|
+
};
|
|
540
|
+
const step = (delta) => select(selectedIndex + delta);
|
|
541
|
+
if (stopCount === 0) return null;
|
|
542
|
+
return /* @__PURE__ */ jsxs2(
|
|
543
|
+
"div",
|
|
544
|
+
{
|
|
545
|
+
className: cn("flex items-center justify-center gap-3 px-3 py-3 sm:gap-4 sm:px-5", className),
|
|
546
|
+
"aria-label": ariaLabel,
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ jsx2(
|
|
549
|
+
"button",
|
|
550
|
+
{
|
|
551
|
+
type: "button",
|
|
552
|
+
onClick: () => step(-1),
|
|
553
|
+
disabled: selectedIndex === 0,
|
|
554
|
+
"aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
|
|
555
|
+
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",
|
|
556
|
+
children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-left", className: "size-4" })
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative min-w-0 flex-1", children: [
|
|
560
|
+
/* @__PURE__ */ jsx2(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
ref: scrollRef,
|
|
564
|
+
style: { paddingLeft: pad.left, paddingRight: pad.right },
|
|
565
|
+
className: "flex items-end gap-1 overflow-x-hidden py-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
566
|
+
children: stops.map((stop, index) => {
|
|
567
|
+
const active = index === selectedIndex;
|
|
568
|
+
return /* @__PURE__ */ jsxs2(
|
|
569
|
+
"button",
|
|
570
|
+
{
|
|
571
|
+
type: "button",
|
|
572
|
+
ref: (el) => {
|
|
573
|
+
itemRefs.current[index] = el;
|
|
574
|
+
},
|
|
575
|
+
onClick: () => select(index),
|
|
576
|
+
disabled: stop.disabled,
|
|
577
|
+
"aria-pressed": active,
|
|
578
|
+
className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
|
|
579
|
+
children: [
|
|
580
|
+
/* @__PURE__ */ jsx2(
|
|
581
|
+
"span",
|
|
582
|
+
{
|
|
583
|
+
className: cn(
|
|
584
|
+
"flex h-8 min-w-[60px] items-center justify-center rounded-agg-full border px-3 text-agg-sm leading-agg-5 tabular-nums transition-colors",
|
|
585
|
+
active ? "border-agg-primary bg-agg-secondary font-agg-bold text-agg-foreground" : "border-transparent bg-agg-secondary text-agg-muted-foreground hover:bg-agg-secondary-hover hover:text-agg-foreground"
|
|
586
|
+
),
|
|
587
|
+
children: stop.value
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ jsx2(VenueRow, { venues: stop.venues, active })
|
|
591
|
+
]
|
|
592
|
+
},
|
|
593
|
+
index
|
|
594
|
+
);
|
|
595
|
+
})
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ jsx2(
|
|
599
|
+
"span",
|
|
600
|
+
{
|
|
601
|
+
className: cn(
|
|
602
|
+
"pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r from-agg-secondary to-transparent transition-opacity duration-200",
|
|
603
|
+
mask.left ? "opacity-100" : "opacity-0"
|
|
604
|
+
)
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ jsx2(
|
|
608
|
+
"span",
|
|
609
|
+
{
|
|
610
|
+
className: cn(
|
|
611
|
+
"pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-agg-secondary to-transparent transition-opacity duration-200",
|
|
612
|
+
mask.right ? "opacity-100" : "opacity-0"
|
|
613
|
+
)
|
|
614
|
+
}
|
|
615
|
+
)
|
|
616
|
+
] }),
|
|
617
|
+
/* @__PURE__ */ jsx2(
|
|
618
|
+
"button",
|
|
619
|
+
{
|
|
620
|
+
type: "button",
|
|
621
|
+
onClick: () => step(1),
|
|
622
|
+
disabled: selectedIndex === stopCount - 1,
|
|
623
|
+
"aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
|
|
624
|
+
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",
|
|
625
|
+
children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-right", className: "size-4" })
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// src/pages/event-market/sports-event-market.utils.ts
|
|
634
|
+
var SPORTS_MARKET_TYPE_KEYS = [
|
|
635
|
+
"moneyline",
|
|
636
|
+
"spread",
|
|
637
|
+
"total",
|
|
638
|
+
"prop",
|
|
639
|
+
"completion",
|
|
640
|
+
"other"
|
|
641
|
+
];
|
|
642
|
+
var SPORTS_PERIOD_KEYS = [
|
|
643
|
+
"full",
|
|
644
|
+
"1h",
|
|
645
|
+
"2h",
|
|
646
|
+
"q1",
|
|
647
|
+
"q2",
|
|
648
|
+
"q3",
|
|
649
|
+
"q4",
|
|
650
|
+
"ot",
|
|
651
|
+
"first_inning",
|
|
652
|
+
"second_inning",
|
|
653
|
+
"third_inning",
|
|
654
|
+
"first_5_innings",
|
|
655
|
+
"other"
|
|
656
|
+
];
|
|
657
|
+
var SPORTS_MARKET_CATEGORY_KEYS = [
|
|
658
|
+
"game_lines",
|
|
659
|
+
"exact_score",
|
|
660
|
+
"corners",
|
|
661
|
+
"goals",
|
|
662
|
+
"assists",
|
|
663
|
+
"shots",
|
|
664
|
+
"other"
|
|
665
|
+
];
|
|
666
|
+
var SPORTS_MARKET_GROUP_KEYS = [
|
|
667
|
+
"game_lines",
|
|
668
|
+
"spreads",
|
|
669
|
+
"totals",
|
|
670
|
+
"period_lines",
|
|
671
|
+
"exact_score",
|
|
672
|
+
"team_props",
|
|
673
|
+
"player_props",
|
|
674
|
+
"specials",
|
|
675
|
+
"completion",
|
|
676
|
+
"other"
|
|
677
|
+
];
|
|
678
|
+
var SPORTS_PERIOD_KEY_SET = new Set(SPORTS_PERIOD_KEYS);
|
|
679
|
+
var SPORTS_MARKET_TYPE_KEY_SET = new Set(SPORTS_MARKET_TYPE_KEYS);
|
|
680
|
+
var SPORTS_MARKET_CATEGORY_KEY_SET = new Set(SPORTS_MARKET_CATEGORY_KEYS);
|
|
681
|
+
var SPORTS_MARKET_GROUP_KEY_SET = new Set(SPORTS_MARKET_GROUP_KEYS);
|
|
682
|
+
var SPORTS_LEGACY_PROP_CATEGORY_KEY_SET = /* @__PURE__ */ new Set([
|
|
683
|
+
"corners",
|
|
684
|
+
"goals",
|
|
685
|
+
"assists",
|
|
686
|
+
"shots"
|
|
687
|
+
]);
|
|
688
|
+
var SPORTS_MARKET_GROUP_TO_TAB = {
|
|
689
|
+
game_lines: "game_lines",
|
|
690
|
+
spreads: "game_lines",
|
|
691
|
+
totals: "game_lines",
|
|
692
|
+
period_lines: "halves",
|
|
693
|
+
exact_score: "exact_score",
|
|
694
|
+
team_props: "other",
|
|
695
|
+
player_props: "other",
|
|
696
|
+
specials: "other",
|
|
697
|
+
completion: "other",
|
|
698
|
+
other: "other"
|
|
699
|
+
};
|
|
700
|
+
var SPORTS_SECTION_TAB_DEFINITIONS = [
|
|
701
|
+
{
|
|
702
|
+
key: "game_lines",
|
|
703
|
+
// NO sportsMarketType filter: spread/total markets on some sports (e.g.
|
|
704
|
+
// esports "Map 1 Rounds Handicap"/"Total Rounds") are sportsMarketType="other"
|
|
705
|
+
// with marketGroup=spreads/totals; AND-ing the game-line types would drop them
|
|
706
|
+
// and leave only the moneyline. marketGroup already scopes the tab. (Safe now
|
|
707
|
+
// that classify_market no longer mis-groups prop/to-score-first/extra-innings
|
|
708
|
+
// markets into game_lines/totals — see agg-venue-core market_group.rs.)
|
|
709
|
+
marketGroup: ["game_lines", "spreads", "totals"]
|
|
710
|
+
// No server-side period filter: many regular-time game-line markets arrive
|
|
711
|
+
// with period=null (moneyline sides, team totals, BTTS), and a
|
|
712
|
+
// period=["full"] filter would drop them server-side. The Game Lines tab
|
|
713
|
+
// narrows to the regular-time group client-side instead (see SportsMarkets).
|
|
714
|
+
},
|
|
715
|
+
{ key: "exact_score", marketGroup: ["exact_score"] },
|
|
716
|
+
{
|
|
717
|
+
key: "halves",
|
|
718
|
+
// NO sportsMarketType filter: half-result legs ("France leading at halftime?")
|
|
719
|
+
// are sportsMarketType="other"; AND-ing the game-line types would drop them.
|
|
720
|
+
// marketGroup=period_lines + period already scope the tab.
|
|
721
|
+
marketGroup: ["period_lines"],
|
|
722
|
+
period: ["1h", "2h"]
|
|
723
|
+
},
|
|
724
|
+
{ key: "corners", marketCategory: "corners" },
|
|
725
|
+
{ key: "goals", marketCategory: "goals" },
|
|
726
|
+
{ key: "assists", marketCategory: "assists" },
|
|
727
|
+
{ key: "shots", marketCategory: "shots" },
|
|
728
|
+
{
|
|
729
|
+
key: "other",
|
|
730
|
+
marketGroup: ["other", "team_props", "player_props", "specials", "completion"]
|
|
731
|
+
}
|
|
732
|
+
];
|
|
733
|
+
var SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS = ["game_lines", "other"];
|
|
734
|
+
var SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET = new Set(
|
|
735
|
+
SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS
|
|
736
|
+
);
|
|
737
|
+
var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
|
|
738
|
+
"esports",
|
|
739
|
+
"video games",
|
|
740
|
+
"video game",
|
|
741
|
+
"computer games",
|
|
742
|
+
"computer game",
|
|
743
|
+
"gaming"
|
|
744
|
+
]);
|
|
745
|
+
var ESPORTS_TITLE_PATTERN = /\b(?:esports?|valorant|counter-strike|cs2|league of legends|lol|dota|rocket league|overwatch|rainbow six|starcraft|call of duty)\b/i;
|
|
746
|
+
var SERIES_SCOPE_PATTERN = /\b(?:bo[1-9]|best of \d+|map \d+|game \d+)\b/i;
|
|
747
|
+
var SPORTS_SECTION_TAB_BY_KEY = new Map(
|
|
748
|
+
SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => [definition.key, definition])
|
|
749
|
+
);
|
|
750
|
+
var SPORTS_PERIOD_ORDER = [
|
|
751
|
+
"full",
|
|
752
|
+
"1h",
|
|
753
|
+
"2h",
|
|
754
|
+
"q1",
|
|
755
|
+
"q2",
|
|
756
|
+
"q3",
|
|
757
|
+
"q4",
|
|
758
|
+
"ot",
|
|
759
|
+
"first_inning",
|
|
760
|
+
"second_inning",
|
|
761
|
+
"third_inning",
|
|
762
|
+
"first_5_innings",
|
|
763
|
+
"other"
|
|
764
|
+
];
|
|
765
|
+
var SPORTS_MARKET_TYPE_ORDER = [
|
|
766
|
+
"moneyline",
|
|
767
|
+
"spread",
|
|
768
|
+
"total",
|
|
769
|
+
"prop",
|
|
770
|
+
"completion",
|
|
771
|
+
"other"
|
|
772
|
+
];
|
|
773
|
+
var YES_NO_LABELS = /* @__PURE__ */ new Set(["yes", "no"]);
|
|
774
|
+
var LINE_MARKET_TYPES = /* @__PURE__ */ new Set(["spread", "total"]);
|
|
775
|
+
var toTrimmedString = (value) => {
|
|
776
|
+
return typeof value === "string" ? value.trim() : "";
|
|
777
|
+
};
|
|
778
|
+
var sanitizeFamilyValue = (value) => {
|
|
779
|
+
return value.toLowerCase().replace(/[-+]?\d+(?:\.\d+)?/g, "").replace(/[¢$]/g, "").replace(/\s+/g, " ").replace(/[|:()[\]{}]/g, "").trim();
|
|
780
|
+
};
|
|
781
|
+
var stripLineValueFromQuestion = (question) => {
|
|
782
|
+
const strippedQuestion = sanitizeFamilyValue(question);
|
|
783
|
+
return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
|
|
784
|
+
};
|
|
785
|
+
var getSportsPeriodOrderIndex = (period) => {
|
|
786
|
+
const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
|
|
787
|
+
return periodIndex >= 0 ? periodIndex : SPORTS_PERIOD_ORDER.length;
|
|
788
|
+
};
|
|
789
|
+
var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
|
|
790
|
+
if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
|
|
791
|
+
const marketTypeIndex = SPORTS_MARKET_TYPE_ORDER.indexOf(sportsMarketType);
|
|
792
|
+
return marketTypeIndex >= 0 ? marketTypeIndex : SPORTS_MARKET_TYPE_ORDER.length;
|
|
793
|
+
};
|
|
794
|
+
var resolveSportsSectionDefinition = (key) => {
|
|
795
|
+
const resolvedDefinition = SPORTS_SECTION_TAB_BY_KEY.get(key);
|
|
796
|
+
if (!resolvedDefinition) {
|
|
797
|
+
return SPORTS_SECTION_TAB_DEFINITIONS[0];
|
|
798
|
+
}
|
|
799
|
+
return resolvedDefinition;
|
|
800
|
+
};
|
|
801
|
+
var normalizeSportsPeriod = (value) => {
|
|
802
|
+
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
803
|
+
if (!resolvedValue) return "full";
|
|
804
|
+
return SPORTS_PERIOD_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
|
|
805
|
+
};
|
|
806
|
+
var normalizeSportsMarketType = (value) => {
|
|
807
|
+
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
808
|
+
if (!resolvedValue) return null;
|
|
809
|
+
return SPORTS_MARKET_TYPE_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
|
|
810
|
+
};
|
|
811
|
+
var normalizeSportsMarketCategory = (value) => {
|
|
812
|
+
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
813
|
+
if (!resolvedValue) return null;
|
|
814
|
+
return SPORTS_MARKET_CATEGORY_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
|
|
815
|
+
};
|
|
816
|
+
var normalizeSportsMarketGroup = (value) => {
|
|
817
|
+
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
818
|
+
if (!resolvedValue) return null;
|
|
819
|
+
return SPORTS_MARKET_GROUP_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
|
|
820
|
+
};
|
|
821
|
+
var resolveMarketSectionTabKey = (market) => {
|
|
822
|
+
const category = normalizeSportsMarketCategory(market.marketCategory);
|
|
823
|
+
if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) {
|
|
824
|
+
return category;
|
|
825
|
+
}
|
|
826
|
+
const group = normalizeSportsMarketGroup(market.marketGroup);
|
|
827
|
+
if (group) return SPORTS_MARKET_GROUP_TO_TAB[group];
|
|
828
|
+
if (category === "game_lines") return "game_lines";
|
|
829
|
+
if (category === "exact_score") return "exact_score";
|
|
830
|
+
if (category === "other") return "other";
|
|
831
|
+
return null;
|
|
832
|
+
};
|
|
833
|
+
var resolveSportsSectionFilters = (key) => {
|
|
834
|
+
var _a;
|
|
835
|
+
const resolvedDefinition = resolveSportsSectionDefinition(key);
|
|
836
|
+
const useMarketGroup = !!((_a = resolvedDefinition.marketGroup) == null ? void 0 : _a.length);
|
|
837
|
+
return {
|
|
838
|
+
marketGroup: useMarketGroup ? [...resolvedDefinition.marketGroup] : void 0,
|
|
839
|
+
// Only fall back to the deprecated marketCategory filter when the tab has no
|
|
840
|
+
// marketGroup mapping. Sending both would AND them server-side and drop
|
|
841
|
+
// markets that carry only one of the two.
|
|
842
|
+
marketCategory: !useMarketGroup && resolvedDefinition.marketCategory ? [resolvedDefinition.marketCategory] : void 0,
|
|
843
|
+
sportsMarketType: resolvedDefinition.sportsMarketType ? [...resolvedDefinition.sportsMarketType] : void 0,
|
|
844
|
+
period: resolvedDefinition.period ? [...resolvedDefinition.period] : void 0
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
var resolveSportsSectionMarkets = ({
|
|
848
|
+
tabKey,
|
|
849
|
+
eventMarkets,
|
|
850
|
+
sectionMarkets
|
|
851
|
+
}) => {
|
|
852
|
+
const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tabKey);
|
|
853
|
+
if (tabKey !== "game_lines") return effectiveSectionMarkets;
|
|
854
|
+
const eventMoneylineMarkets = eventMarkets.filter(
|
|
855
|
+
(market) => normalizeSportsMarketType(market.sportsMarketType) === "moneyline" && resolveMarketSectionTabKey(market) === "game_lines"
|
|
856
|
+
);
|
|
857
|
+
if (eventMoneylineMarkets.length === 0) return effectiveSectionMarkets;
|
|
858
|
+
const lineSectionMarkets = effectiveSectionMarkets.filter(
|
|
859
|
+
(market) => normalizeSportsMarketType(market.sportsMarketType) !== "moneyline"
|
|
860
|
+
);
|
|
861
|
+
return [...eventMoneylineMarkets, ...lineSectionMarkets];
|
|
862
|
+
};
|
|
863
|
+
var resolveSportsMarketCardVariant = (market) => {
|
|
864
|
+
var _a;
|
|
865
|
+
const normalizedOutcomeLabels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
|
|
866
|
+
(outcome) => toTrimmedString(outcome.label).toLowerCase()
|
|
867
|
+
);
|
|
868
|
+
const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
|
|
869
|
+
if (sportsMarketType && LINE_MARKET_TYPES.has(sportsMarketType)) {
|
|
870
|
+
return "line";
|
|
871
|
+
}
|
|
872
|
+
if (market.lineValue != null) {
|
|
873
|
+
return "line";
|
|
874
|
+
}
|
|
875
|
+
if (normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label))) {
|
|
876
|
+
return "yes_no";
|
|
877
|
+
}
|
|
878
|
+
return "outcome";
|
|
879
|
+
};
|
|
880
|
+
var isBinarySportsMoneylineMarket = (market) => {
|
|
881
|
+
var _a;
|
|
882
|
+
const normalizedOutcomeLabels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
|
|
883
|
+
(outcome) => toTrimmedString(outcome.label).toLowerCase()
|
|
884
|
+
);
|
|
885
|
+
const marketSubtype = toTrimmedString(market.marketSubtype).toLowerCase();
|
|
886
|
+
const marketGroup = normalizeSportsMarketGroup(market.marketGroup);
|
|
887
|
+
const hasMoneylineAggKey = toTrimmedString(market.aggKey).includes("_ml_");
|
|
888
|
+
return (marketSubtype === "moneyline" || hasMoneylineAggKey) && marketGroup === "game_lines" && normalizeSportsPeriod(market.period) === "full" && normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label));
|
|
889
|
+
};
|
|
890
|
+
var resolveDisplayGroupFamilyKey = (market) => {
|
|
891
|
+
var _a, _b, _c;
|
|
892
|
+
const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
|
|
893
|
+
const outcomeKey = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
|
|
894
|
+
(outcome) => sanitizeFamilyValue(toTrimmedString(outcome.title) || toTrimmedString(outcome.label))
|
|
895
|
+
).filter(Boolean).sort((left, right) => left.localeCompare(right)).join("|");
|
|
896
|
+
const sportsMarketType = (_b = normalizeSportsMarketType(market.sportsMarketType)) != null ? _b : "other";
|
|
897
|
+
const period = normalizeSportsPeriod(market.period);
|
|
898
|
+
const marketCategory = (_c = normalizeSportsMarketCategory(market.marketCategory)) != null ? _c : "other";
|
|
899
|
+
if (isBinarySportsMoneylineMarket(market)) {
|
|
900
|
+
return `${period}|moneyline|${marketCategory}`;
|
|
901
|
+
}
|
|
902
|
+
if (sportsMarketType === "spread") {
|
|
903
|
+
return `${period}|spread|${marketCategory}`;
|
|
904
|
+
}
|
|
905
|
+
if (market.lineValue != null || LINE_MARKET_TYPES.has(sportsMarketType)) {
|
|
906
|
+
return `${period}|${sportsMarketType}|${marketCategory}|${normalizedQuestion}|${outcomeKey}`;
|
|
907
|
+
}
|
|
908
|
+
return `${period}|${sportsMarketType}|${marketCategory}|${toTrimmedString(market.question)}|${outcomeKey}|${market.id}`;
|
|
909
|
+
};
|
|
910
|
+
var resolveDisplayGroupTitle = (market) => {
|
|
911
|
+
const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
|
|
912
|
+
const question = toTrimmedString(market.question);
|
|
913
|
+
if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
|
|
914
|
+
if (sportsMarketType === "spread") return "Spreads";
|
|
915
|
+
if (!question) {
|
|
916
|
+
return sportsMarketType != null ? sportsMarketType : market.id;
|
|
917
|
+
}
|
|
918
|
+
if (sportsMarketType === "total") {
|
|
919
|
+
const base = stripLineValueFromQuestion(question).replace(/o\s*\/\s*u/gi, " ").replace(/\btotals?\b/gi, " ").replace(/\s+/g, " ").trim();
|
|
920
|
+
return base ? `${base} Totals` : "Totals";
|
|
921
|
+
}
|
|
922
|
+
if (market.lineValue != null) {
|
|
923
|
+
const strippedQuestion = stripLineValueFromQuestion(question);
|
|
924
|
+
return strippedQuestion || question;
|
|
925
|
+
}
|
|
926
|
+
return question;
|
|
927
|
+
};
|
|
928
|
+
var sortMarketsByLineValue = (markets) => {
|
|
929
|
+
return [...markets].sort((leftMarket, rightMarket) => {
|
|
930
|
+
var _a, _b;
|
|
931
|
+
const leftLineValue = (_a = leftMarket.lineValue) != null ? _a : Number.NEGATIVE_INFINITY;
|
|
932
|
+
const rightLineValue = (_b = rightMarket.lineValue) != null ? _b : Number.NEGATIVE_INFINITY;
|
|
933
|
+
if (leftLineValue !== rightLineValue) {
|
|
934
|
+
return leftLineValue - rightLineValue;
|
|
935
|
+
}
|
|
936
|
+
return leftMarket.question.localeCompare(rightMarket.question);
|
|
937
|
+
});
|
|
938
|
+
};
|
|
939
|
+
var buildSportsMarketDisplayGroups = (markets) => {
|
|
940
|
+
var _a;
|
|
941
|
+
const groupsByKey = /* @__PURE__ */ new Map();
|
|
942
|
+
for (const market of markets) {
|
|
943
|
+
const groupKey = resolveDisplayGroupFamilyKey(market);
|
|
944
|
+
const currentMarkets = (_a = groupsByKey.get(groupKey)) != null ? _a : [];
|
|
945
|
+
currentMarkets.push(market);
|
|
946
|
+
groupsByKey.set(groupKey, currentMarkets);
|
|
947
|
+
}
|
|
948
|
+
const groups = Array.from(groupsByKey.entries()).map(([id, groupMarkets]) => {
|
|
949
|
+
var _a2;
|
|
950
|
+
const orderedMarkets = sortMarketsByLineValue(groupMarkets);
|
|
951
|
+
const firstMarket = orderedMarkets[0];
|
|
952
|
+
const sportsMarketType = normalizeSportsMarketType(firstMarket == null ? void 0 : firstMarket.sportsMarketType);
|
|
953
|
+
const marketCategory = normalizeSportsMarketCategory(firstMarket == null ? void 0 : firstMarket.marketCategory);
|
|
954
|
+
const period = normalizeSportsPeriod(firstMarket == null ? void 0 : firstMarket.period);
|
|
955
|
+
const sectionRank = (_a2 = firstMarket == null ? void 0 : firstMarket.sectionRank) != null ? _a2 : Number.MAX_SAFE_INTEGER;
|
|
956
|
+
return {
|
|
957
|
+
id,
|
|
958
|
+
title: resolveDisplayGroupTitle(firstMarket),
|
|
959
|
+
questionKey: sanitizeFamilyValue(toTrimmedString(firstMarket == null ? void 0 : firstMarket.question)),
|
|
960
|
+
sportsMarketType,
|
|
961
|
+
marketCategory,
|
|
962
|
+
period,
|
|
963
|
+
sectionRank,
|
|
964
|
+
markets: orderedMarkets,
|
|
965
|
+
hasLineVariants: orderedMarkets.some((market) => market.lineValue != null)
|
|
966
|
+
};
|
|
967
|
+
});
|
|
968
|
+
return groups.sort((leftGroup, rightGroup) => {
|
|
969
|
+
var _a2, _b, _c, _d;
|
|
970
|
+
if (leftGroup.sectionRank !== rightGroup.sectionRank) {
|
|
971
|
+
return leftGroup.sectionRank - rightGroup.sectionRank;
|
|
972
|
+
}
|
|
973
|
+
const leftMarketTypeOrder = getSportsMarketTypeOrderIndex(leftGroup.sportsMarketType);
|
|
974
|
+
const rightMarketTypeOrder = getSportsMarketTypeOrderIndex(rightGroup.sportsMarketType);
|
|
975
|
+
if (leftMarketTypeOrder !== rightMarketTypeOrder) {
|
|
976
|
+
return leftMarketTypeOrder - rightMarketTypeOrder;
|
|
977
|
+
}
|
|
978
|
+
const leftLineValue = (_b = (_a2 = leftGroup.markets[0]) == null ? void 0 : _a2.lineValue) != null ? _b : Number.NEGATIVE_INFINITY;
|
|
979
|
+
const rightLineValue = (_d = (_c = rightGroup.markets[0]) == null ? void 0 : _c.lineValue) != null ? _d : Number.NEGATIVE_INFINITY;
|
|
980
|
+
if (leftLineValue !== rightLineValue) {
|
|
981
|
+
return leftLineValue - rightLineValue;
|
|
982
|
+
}
|
|
983
|
+
return leftGroup.title.localeCompare(rightGroup.title);
|
|
984
|
+
});
|
|
985
|
+
};
|
|
986
|
+
var groupSportsMarketsByPeriod = (markets) => {
|
|
987
|
+
var _a;
|
|
988
|
+
const periodGroups = /* @__PURE__ */ new Map();
|
|
989
|
+
for (const market of markets) {
|
|
990
|
+
const period = normalizeSportsPeriod(market.period);
|
|
991
|
+
const currentMarkets = (_a = periodGroups.get(period)) != null ? _a : [];
|
|
992
|
+
currentMarkets.push(market);
|
|
993
|
+
periodGroups.set(period, currentMarkets);
|
|
994
|
+
}
|
|
995
|
+
return Array.from(periodGroups.entries()).map(([key, groupedMarkets]) => ({
|
|
996
|
+
key,
|
|
997
|
+
markets: groupedMarkets,
|
|
998
|
+
groups: buildSportsMarketDisplayGroups(groupedMarkets)
|
|
999
|
+
})).sort((leftGroup, rightGroup) => {
|
|
1000
|
+
return getSportsPeriodOrderIndex(leftGroup.key) - getSportsPeriodOrderIndex(rightGroup.key);
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
var resolveSelectedSportsLineValue = (lineValue) => {
|
|
1004
|
+
if (lineValue == null) return "0";
|
|
1005
|
+
return Number.isInteger(lineValue) ? String(lineValue) : lineValue.toFixed(1);
|
|
1006
|
+
};
|
|
1007
|
+
var collectVenueNames = (market) => {
|
|
1008
|
+
var _a;
|
|
1009
|
+
const venues = /* @__PURE__ */ new Set([market.venue]);
|
|
1010
|
+
for (const matchedVenueMarket of (_a = market.matchedVenueMarkets) != null ? _a : []) {
|
|
1011
|
+
venues.add(matchedVenueMarket.venue);
|
|
1012
|
+
}
|
|
1013
|
+
return Array.from(venues);
|
|
1014
|
+
};
|
|
1015
|
+
var resolveTotalGroupVolume = (markets) => {
|
|
1016
|
+
return markets.reduce((totalVolume, market) => {
|
|
1017
|
+
var _a;
|
|
1018
|
+
return totalVolume + ((_a = market.volume) != null ? _a : 0);
|
|
1019
|
+
}, 0);
|
|
1020
|
+
};
|
|
1021
|
+
var resolveSportsExpandedMarkets = (markets) => {
|
|
1022
|
+
var _a;
|
|
1023
|
+
const expandedMarkets = [];
|
|
1024
|
+
const seenMarketIds = /* @__PURE__ */ new Set();
|
|
1025
|
+
for (const market of markets) {
|
|
1026
|
+
if (!seenMarketIds.has(market.id)) {
|
|
1027
|
+
seenMarketIds.add(market.id);
|
|
1028
|
+
expandedMarkets.push(market);
|
|
1029
|
+
}
|
|
1030
|
+
for (const matchedVenueMarket of (_a = market.matchedVenueMarkets) != null ? _a : []) {
|
|
1031
|
+
if (seenMarketIds.has(matchedVenueMarket.id)) continue;
|
|
1032
|
+
seenMarketIds.add(matchedVenueMarket.id);
|
|
1033
|
+
expandedMarkets.push(matchedVenueMarket);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return expandedMarkets;
|
|
1037
|
+
};
|
|
1038
|
+
var resolveSportsExpandedMarketsVolume = (markets) => {
|
|
1039
|
+
return resolveSportsExpandedMarkets(markets).reduce((totalVolume, market) => {
|
|
1040
|
+
var _a;
|
|
1041
|
+
return totalVolume + ((_a = market.volume) != null ? _a : 0);
|
|
1042
|
+
}, 0);
|
|
1043
|
+
};
|
|
1044
|
+
var resolveHighestVolumeIndex = (markets) => {
|
|
1045
|
+
let bestIndex = 0;
|
|
1046
|
+
let bestVolume = Number.NEGATIVE_INFINITY;
|
|
1047
|
+
markets.forEach((market, index) => {
|
|
1048
|
+
var _a;
|
|
1049
|
+
const volume = (_a = market.volume) != null ? _a : 0;
|
|
1050
|
+
if (volume > bestVolume) {
|
|
1051
|
+
bestVolume = volume;
|
|
1052
|
+
bestIndex = index;
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
return bestIndex;
|
|
1056
|
+
};
|
|
1057
|
+
var resolveSlideKind = (group) => {
|
|
1058
|
+
if (group.sportsMarketType === "moneyline") return "moneyline";
|
|
1059
|
+
if (group.sportsMarketType === "spread") return "spread";
|
|
1060
|
+
if (group.sportsMarketType === "total") return "total";
|
|
1061
|
+
return "other";
|
|
1062
|
+
};
|
|
1063
|
+
var aggregateSportsLineStops = (markets) => {
|
|
1064
|
+
var _a;
|
|
1065
|
+
const marketsByLineValue = /* @__PURE__ */ new Map();
|
|
1066
|
+
for (const market of markets) {
|
|
1067
|
+
const value = resolveSelectedSportsLineValue(market.lineValue);
|
|
1068
|
+
const lineMarkets = (_a = marketsByLineValue.get(value)) != null ? _a : [];
|
|
1069
|
+
lineMarkets.push(market);
|
|
1070
|
+
marketsByLineValue.set(value, lineMarkets);
|
|
1071
|
+
}
|
|
1072
|
+
return Array.from(marketsByLineValue.entries()).map(([value, lineMarkets]) => {
|
|
1073
|
+
var _a2, _b;
|
|
1074
|
+
const representative = (_a2 = lineMarkets[resolveHighestVolumeIndex(lineMarkets)]) != null ? _a2 : lineMarkets[0];
|
|
1075
|
+
const venues = /* @__PURE__ */ new Set();
|
|
1076
|
+
for (const lineMarket of lineMarkets) {
|
|
1077
|
+
for (const venue of collectVenueNames(lineMarket)) {
|
|
1078
|
+
venues.add(venue);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return {
|
|
1082
|
+
value,
|
|
1083
|
+
representative,
|
|
1084
|
+
venues: Array.from(venues),
|
|
1085
|
+
volume: resolveTotalGroupVolume(lineMarkets),
|
|
1086
|
+
lineValue: (_b = representative.lineValue) != null ? _b : Number.NEGATIVE_INFINITY
|
|
1087
|
+
};
|
|
1088
|
+
}).sort(
|
|
1089
|
+
(left, right) => left.lineValue !== right.lineValue ? left.lineValue - right.lineValue : left.value.localeCompare(right.value)
|
|
1090
|
+
);
|
|
1091
|
+
};
|
|
1092
|
+
var buildSportsSlideFromGroup = (group) => {
|
|
1093
|
+
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets) : [];
|
|
1094
|
+
const hasLadder = lineStops.length > 1;
|
|
1095
|
+
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
1096
|
+
value: lineStop.value,
|
|
1097
|
+
venues: lineStop.venues,
|
|
1098
|
+
market: lineStop.representative
|
|
1099
|
+
})) : [];
|
|
1100
|
+
const defaultStopIndex = hasLadder ? lineStops.reduce(
|
|
1101
|
+
(bestIndex, lineStop, index) => lineStop.volume > lineStops[bestIndex].volume ? index : bestIndex,
|
|
1102
|
+
0
|
|
1103
|
+
) : 0;
|
|
1104
|
+
return {
|
|
1105
|
+
id: group.id,
|
|
1106
|
+
kind: resolveSlideKind(group),
|
|
1107
|
+
group,
|
|
1108
|
+
hasLadder,
|
|
1109
|
+
stops,
|
|
1110
|
+
defaultStopIndex
|
|
1111
|
+
};
|
|
1112
|
+
};
|
|
1113
|
+
var resolveSportsCategoryTokens = (event) => {
|
|
1114
|
+
return new Set(
|
|
1115
|
+
event.categories.flatMap((entry) => {
|
|
1116
|
+
const categoryName = toTrimmedString(entry.category.name).toLowerCase();
|
|
1117
|
+
const categoryDisplayName = toTrimmedString(entry.category.displayName).toLowerCase();
|
|
1118
|
+
return [categoryName, categoryDisplayName].filter(Boolean);
|
|
1119
|
+
})
|
|
1120
|
+
);
|
|
1121
|
+
};
|
|
1122
|
+
var isNonStandardSportsLikeEvent = (event) => {
|
|
1123
|
+
const categoryTokens = resolveSportsCategoryTokens(event);
|
|
1124
|
+
if ([...categoryTokens].some((token) => ESPORTS_CATEGORY_TOKENS.has(token))) {
|
|
1125
|
+
return true;
|
|
1126
|
+
}
|
|
1127
|
+
if (ESPORTS_TITLE_PATTERN.test(event.title) || SERIES_SCOPE_PATTERN.test(event.title)) {
|
|
1128
|
+
return true;
|
|
1129
|
+
}
|
|
1130
|
+
return event.venueMarkets.some((market) => {
|
|
1131
|
+
const question = toTrimmedString(market.question);
|
|
1132
|
+
return ESPORTS_TITLE_PATTERN.test(question) || SERIES_SCOPE_PATTERN.test(question);
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
var resolveVisibleSportsSectionTabDefinitions = (event) => {
|
|
1136
|
+
const presentTabKeys = /* @__PURE__ */ new Set();
|
|
1137
|
+
for (const market of event.venueMarkets) {
|
|
1138
|
+
const tabKey = resolveMarketSectionTabKey(market);
|
|
1139
|
+
if (tabKey) presentTabKeys.add(tabKey);
|
|
1140
|
+
}
|
|
1141
|
+
let definitions = SPORTS_SECTION_TAB_DEFINITIONS.filter(
|
|
1142
|
+
(definition) => presentTabKeys.has(definition.key)
|
|
1143
|
+
);
|
|
1144
|
+
if (isNonStandardSportsLikeEvent(event)) {
|
|
1145
|
+
definitions = definitions.filter(
|
|
1146
|
+
(definition) => SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET.has(definition.key)
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
return definitions;
|
|
1150
|
+
};
|
|
1151
|
+
var mergeSportsSectionMarketsIntoEvent = ({
|
|
1152
|
+
event,
|
|
1153
|
+
sectionMarketsByKey
|
|
1154
|
+
}) => {
|
|
1155
|
+
var _a;
|
|
1156
|
+
const orderedVenueMarkets = [...event.venueMarkets];
|
|
1157
|
+
const seenMarketIds = new Set(orderedVenueMarkets.map((market) => market.id));
|
|
1158
|
+
for (const sectionKey of SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => definition.key)) {
|
|
1159
|
+
for (const market of (_a = sectionMarketsByKey[sectionKey]) != null ? _a : []) {
|
|
1160
|
+
if (seenMarketIds.has(market.id)) continue;
|
|
1161
|
+
seenMarketIds.add(market.id);
|
|
1162
|
+
orderedVenueMarkets.push(market);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
return __spreadProps(__spreadValues({}, event), {
|
|
1166
|
+
venueMarkets: orderedVenueMarkets
|
|
1167
|
+
});
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
// src/pages/event-market/sports-market-card.tsx
|
|
1171
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1172
|
+
var SportsMarketCard = ({
|
|
1173
|
+
group,
|
|
1174
|
+
venueMarkets,
|
|
1175
|
+
isExpanded,
|
|
1176
|
+
onToggle,
|
|
1177
|
+
onOutcomeSelect,
|
|
1178
|
+
live,
|
|
1179
|
+
midpointsFallback,
|
|
1180
|
+
midpointsFallbackVenues,
|
|
1181
|
+
midpointsResult
|
|
1182
|
+
}) => {
|
|
1183
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1184
|
+
const labels = useLabels2();
|
|
1185
|
+
const {
|
|
1186
|
+
formatting: { formatCompactCurrency }
|
|
1187
|
+
} = useSdkUiConfig();
|
|
1188
|
+
const tradingContext = useEventTradingContext();
|
|
1189
|
+
const slide = useMemo(() => buildSportsSlideFromGroup(group), [group]);
|
|
1190
|
+
const [selectedLineIndex, setSelectedLineIndex] = useState3(slide.defaultStopIndex);
|
|
1191
|
+
const combinedMoneylineMarkets = useMemo(
|
|
1192
|
+
() => group.markets.filter((market) => isBinarySportsMoneylineMarket(market)),
|
|
1193
|
+
[group.markets]
|
|
1194
|
+
);
|
|
1195
|
+
const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length;
|
|
1196
|
+
useEffect3(() => {
|
|
1197
|
+
if (!slide.hasLadder) return;
|
|
1198
|
+
const tradingMarketId = tradingContext == null ? void 0 : tradingContext.selectedMarketId;
|
|
1199
|
+
if (!tradingMarketId) return;
|
|
1200
|
+
const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
|
|
1201
|
+
if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
|
|
1202
|
+
}, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
|
|
1203
|
+
const activeMoneylineMarket = isCombinedMoneylineGroup && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_a = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _a : null : null;
|
|
1204
|
+
const activeMarket = slide.hasLadder ? (_d = (_c = (_b = slide.stops[selectedLineIndex]) == null ? void 0 : _b.market) != null ? _c : group.markets[0]) != null ? _d : null : (_e = activeMoneylineMarket != null ? activeMoneylineMarket : group.markets[0]) != null ? _e : null;
|
|
1205
|
+
const activeDefaultOutcome = isCombinedMoneylineGroup && activeMarket ? (_f = activeMarket.venueMarketOutcomes.find(
|
|
1206
|
+
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
1207
|
+
)) != null ? _f : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
1208
|
+
const wasExpandedRef = useRef2(isExpanded);
|
|
1209
|
+
useEffect3(() => {
|
|
1210
|
+
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
1211
|
+
wasExpandedRef.current = isExpanded;
|
|
1212
|
+
if (!justOpened || !activeMarket) return;
|
|
1213
|
+
if (resolveMarketTradingState(activeMarket).isTradingDisabled) return;
|
|
1214
|
+
const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
|
|
1215
|
+
const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
|
|
1216
|
+
if (hasInScopeOutcome) return;
|
|
1217
|
+
const firstOutcome = activeDefaultOutcome;
|
|
1218
|
+
if (firstOutcome) {
|
|
1219
|
+
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
1220
|
+
}
|
|
1221
|
+
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
1222
|
+
if (!activeMarket) return null;
|
|
1223
|
+
const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
|
|
1224
|
+
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
1225
|
+
)) != null ? _g : activeDefaultOutcome;
|
|
1226
|
+
const activeOutcomeVenueCount = (() => {
|
|
1227
|
+
var _a2, _b2;
|
|
1228
|
+
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
1229
|
+
const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
|
|
1230
|
+
for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
|
|
1231
|
+
const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
|
|
1232
|
+
(market) => market.id === matchedOutcome.venueMarketId
|
|
1233
|
+
);
|
|
1234
|
+
if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
|
|
1235
|
+
venueNames.add(matchedVenueMarket.venue);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
|
|
1239
|
+
})();
|
|
1240
|
+
const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
|
|
1241
|
+
const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
|
|
1242
|
+
const compactSubtitle = `${activeOutcomeVenueCount} ${activeOutcomeVenueCount === 1 ? labels.marketDetails.meta.venueSingular : labels.marketDetails.meta.venuePlural} \xB7 ${formatCompactCurrency(activeMarketVolume || resolveTotalGroupVolume([activeMarket]))} ${labels.eventMarketPage.sports.volumeShort} \xB7 ${formatCompactCurrency(totalGroupVolume || resolveTotalGroupVolume(group.markets))} ${labels.eventMarketPage.sports.totalVolumeShort}`;
|
|
1243
|
+
const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
|
|
1244
|
+
if (!isCombinedMoneylineGroup) return void 0;
|
|
1245
|
+
return combinedMoneylineMarkets.flatMap((market, index) => {
|
|
1246
|
+
var _a2;
|
|
1247
|
+
const typedMarket = market;
|
|
1248
|
+
const yesOutcome = market.venueMarketOutcomes.find(
|
|
1249
|
+
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
1250
|
+
);
|
|
1251
|
+
if (!yesOutcome) return [];
|
|
1252
|
+
const label = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
|
|
1253
|
+
if (!label) return [];
|
|
1254
|
+
return [
|
|
1255
|
+
{
|
|
1256
|
+
id: yesOutcome.id,
|
|
1257
|
+
label,
|
|
1258
|
+
title: label,
|
|
1259
|
+
probability: yesOutcome.price,
|
|
1260
|
+
tone: index === 0 ? "positive" : "negative",
|
|
1261
|
+
variant: "outcome",
|
|
1262
|
+
venue: market.venue
|
|
1263
|
+
}
|
|
1264
|
+
];
|
|
1265
|
+
});
|
|
1266
|
+
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup]);
|
|
1267
|
+
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1268
|
+
const handleLineSelect = (index) => {
|
|
1269
|
+
var _a2, _b2;
|
|
1270
|
+
const previousMarket = activeMarket;
|
|
1271
|
+
setSelectedLineIndex(index);
|
|
1272
|
+
const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
|
|
1273
|
+
if (!market) return;
|
|
1274
|
+
const isGroupBeingTraded = group.markets.some(
|
|
1275
|
+
(groupMarket) => groupMarket.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
|
|
1276
|
+
);
|
|
1277
|
+
if (!isGroupBeingTraded) return;
|
|
1278
|
+
const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
|
|
1279
|
+
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
1280
|
+
) : -1;
|
|
1281
|
+
const nextOutcome = (_b2 = previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
|
|
1282
|
+
if (nextOutcome) {
|
|
1283
|
+
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
|
|
1284
|
+
} else {
|
|
1285
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
return /* @__PURE__ */ jsx3(
|
|
1289
|
+
MarketDetails,
|
|
1290
|
+
{
|
|
1291
|
+
marketId: activeMarket.id,
|
|
1292
|
+
venueMarkets,
|
|
1293
|
+
title: group.title,
|
|
1294
|
+
compactHeader: true,
|
|
1295
|
+
subtitleOverride: compactSubtitle,
|
|
1296
|
+
headerOutcomeVariant,
|
|
1297
|
+
headerOutcomeItemsOverride: combinedMoneylineHeaderOutcomeItems,
|
|
1298
|
+
isOpened: isExpanded,
|
|
1299
|
+
suppressOutcomeFallbackSelection: activeMarket.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId),
|
|
1300
|
+
onOpenChange: () => onToggle(group.id, activeMarket),
|
|
1301
|
+
onOutcomeSelect: (selection) => onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, selection),
|
|
1302
|
+
headerAccessory: slide.hasLadder ? /* @__PURE__ */ jsx3(
|
|
1303
|
+
SportsLineRail,
|
|
1304
|
+
{
|
|
1305
|
+
stops: slide.stops.map((stop) => ({
|
|
1306
|
+
value: stop.value,
|
|
1307
|
+
venues: stop.venues,
|
|
1308
|
+
disabled: stop.market.status !== MarketStatus.open
|
|
1309
|
+
})),
|
|
1310
|
+
selectedIndex: selectedLineIndex,
|
|
1311
|
+
onSelect: handleLineSelect,
|
|
1312
|
+
ariaLabel: labels.eventMarketPage.sports.lineSelectorAria(group.title),
|
|
1313
|
+
previousAriaLabel: labels.eventMarketPage.sports.previousLineAria(group.title),
|
|
1314
|
+
nextAriaLabel: labels.eventMarketPage.sports.nextLineAria(group.title)
|
|
1315
|
+
}
|
|
1316
|
+
) : void 0,
|
|
1317
|
+
classNames: { root: "agg-market-list-item agg-sports-market-card" },
|
|
1318
|
+
live,
|
|
1319
|
+
midpointsFallback,
|
|
1320
|
+
midpointsFallbackVenues,
|
|
1321
|
+
midpointsResult
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1324
|
+
};
|
|
1325
|
+
SportsMarketCard.displayName = "SportsMarketCard";
|
|
1326
|
+
|
|
1327
|
+
// src/pages/event-market/sports-markets.tsx
|
|
1328
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1329
|
+
var resolveSportsSectionLabel = (labels, key) => {
|
|
1330
|
+
switch (key) {
|
|
1331
|
+
case "game_lines":
|
|
1332
|
+
return labels.eventMarketPage.sports.gameLinesTab;
|
|
1333
|
+
case "halves":
|
|
1334
|
+
return labels.eventMarketPage.sports.halvesTab;
|
|
1335
|
+
case "exact_score":
|
|
1336
|
+
return labels.eventMarketPage.sports.exactScoreTab;
|
|
1337
|
+
case "corners":
|
|
1338
|
+
return labels.eventMarketPage.sports.cornersTab;
|
|
1339
|
+
case "goals":
|
|
1340
|
+
return labels.eventMarketPage.sports.goalsTab;
|
|
1341
|
+
case "assists":
|
|
1342
|
+
return labels.eventMarketPage.sports.assistsTab;
|
|
1343
|
+
case "shots":
|
|
1344
|
+
return labels.eventMarketPage.sports.shotsTab;
|
|
1345
|
+
case "other":
|
|
1346
|
+
return labels.eventMarketPage.sports.otherTab;
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
var resolveSportsPeriodLabel = (labels, period) => {
|
|
1350
|
+
switch (period) {
|
|
1351
|
+
case "full":
|
|
1352
|
+
return labels.eventMarketPage.sports.fullPeriod;
|
|
1353
|
+
case "1h":
|
|
1354
|
+
return labels.eventMarketPage.sports.firstHalfPeriod;
|
|
1355
|
+
case "2h":
|
|
1356
|
+
return labels.eventMarketPage.sports.secondHalfPeriod;
|
|
1357
|
+
case "q1":
|
|
1358
|
+
return labels.eventMarketPage.sports.quarterOnePeriod;
|
|
1359
|
+
case "q2":
|
|
1360
|
+
return labels.eventMarketPage.sports.quarterTwoPeriod;
|
|
1361
|
+
case "q3":
|
|
1362
|
+
return labels.eventMarketPage.sports.quarterThreePeriod;
|
|
1363
|
+
case "q4":
|
|
1364
|
+
return labels.eventMarketPage.sports.quarterFourPeriod;
|
|
1365
|
+
case "ot":
|
|
1366
|
+
return labels.eventMarketPage.sports.overtimePeriod;
|
|
1367
|
+
case "first_inning":
|
|
1368
|
+
return "1st Inning";
|
|
1369
|
+
case "second_inning":
|
|
1370
|
+
return "2nd Inning";
|
|
1371
|
+
case "third_inning":
|
|
1372
|
+
return "3rd Inning";
|
|
1373
|
+
case "first_5_innings":
|
|
1374
|
+
return "1st 5 Innings";
|
|
1375
|
+
case "other":
|
|
1376
|
+
return labels.eventMarketPage.sports.otherPeriod;
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
var SportsTabButton = ({
|
|
1380
|
+
isActive,
|
|
1381
|
+
label,
|
|
1382
|
+
onClick
|
|
1383
|
+
}) => {
|
|
1384
|
+
return /* @__PURE__ */ jsx4(
|
|
1385
|
+
"button",
|
|
1386
|
+
{
|
|
1387
|
+
type: "button",
|
|
1388
|
+
role: "tab",
|
|
1389
|
+
"aria-selected": isActive,
|
|
1390
|
+
"data-testid": "sports-section-tab",
|
|
1391
|
+
className: cn(
|
|
1392
|
+
"inline-flex h-9 shrink-0 cursor-pointer items-center justify-center rounded-agg-full border px-4 text-agg-sm leading-agg-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
|
|
1393
|
+
isActive ? "border-agg-primary bg-agg-secondary font-agg-bold text-agg-foreground" : "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
|
|
1394
|
+
),
|
|
1395
|
+
onClick,
|
|
1396
|
+
children: label
|
|
1397
|
+
}
|
|
1398
|
+
);
|
|
1399
|
+
};
|
|
1400
|
+
var SportsMarketsLoadingState = () => {
|
|
1401
|
+
const labels = useLabels3();
|
|
1402
|
+
return /* @__PURE__ */ jsxs3(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
className: "flex flex-col gap-3",
|
|
1406
|
+
role: "status",
|
|
1407
|
+
"aria-label": labels.eventMarketPage.sports.loadingTitle,
|
|
1408
|
+
children: [
|
|
1409
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: labels.eventMarketPage.sports.loadingDescription }),
|
|
1410
|
+
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs3(
|
|
1411
|
+
"div",
|
|
1412
|
+
{
|
|
1413
|
+
className: "flex min-h-[76px] animate-pulse flex-col gap-3 rounded-agg-2xl border border-agg-separator bg-agg-secondary px-5 py-3 sm:flex-row sm:items-center sm:justify-between",
|
|
1414
|
+
children: [
|
|
1415
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
1416
|
+
/* @__PURE__ */ jsx4("div", { className: "h-5 w-32 rounded-agg-sm bg-agg-secondary-hover" }),
|
|
1417
|
+
/* @__PURE__ */ jsx4("div", { className: "h-4 w-40 rounded-agg-sm bg-agg-secondary-hover" })
|
|
1418
|
+
] }),
|
|
1419
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
|
|
1420
|
+
/* @__PURE__ */ jsx4("div", { className: "h-9 w-32 rounded-agg-full bg-agg-secondary-hover" }),
|
|
1421
|
+
/* @__PURE__ */ jsx4("div", { className: "hidden h-9 w-32 rounded-agg-full bg-agg-secondary-hover sm:block" })
|
|
1422
|
+
] })
|
|
1423
|
+
]
|
|
1424
|
+
},
|
|
1425
|
+
`sports-card-skeleton-${index}`
|
|
1426
|
+
))
|
|
1427
|
+
]
|
|
1428
|
+
}
|
|
1429
|
+
);
|
|
1430
|
+
};
|
|
1431
|
+
var SportsMarkets = ({
|
|
1432
|
+
event,
|
|
1433
|
+
onSectionMarketsChange,
|
|
1434
|
+
onOutcomeSelect,
|
|
1435
|
+
live,
|
|
1436
|
+
midpointsResult
|
|
1437
|
+
}) => {
|
|
1438
|
+
var _a, _b;
|
|
1439
|
+
const labels = useLabels3();
|
|
1440
|
+
const tradingContext = useEventTradingContext2();
|
|
1441
|
+
const hasAggKey = Boolean(event.aggKey);
|
|
1442
|
+
const gameMarketsQuery = useVenueMarkets({
|
|
1443
|
+
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
1444
|
+
limit: 100,
|
|
1445
|
+
status: MarketStatus2.open,
|
|
1446
|
+
enabled: hasAggKey
|
|
1447
|
+
});
|
|
1448
|
+
const {
|
|
1449
|
+
markets: gameMarkets,
|
|
1450
|
+
hasNextPage: hasNextGameMarketsPage,
|
|
1451
|
+
isFetchingNextPage: isFetchingNextGameMarketsPage,
|
|
1452
|
+
fetchNextPage: fetchNextGameMarketsPage
|
|
1453
|
+
} = gameMarketsQuery;
|
|
1454
|
+
const tabSourceMarkets = useMemo2(() => {
|
|
1455
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1456
|
+
const merged = [];
|
|
1457
|
+
for (const market of [...event.venueMarkets, ...gameMarkets]) {
|
|
1458
|
+
if (seen.has(market.id)) continue;
|
|
1459
|
+
seen.add(market.id);
|
|
1460
|
+
merged.push(market);
|
|
1461
|
+
}
|
|
1462
|
+
return merged;
|
|
1463
|
+
}, [event.venueMarkets, gameMarkets]);
|
|
1464
|
+
const visibleSectionDefinitions = useMemo2(
|
|
1465
|
+
() => resolveVisibleSportsSectionTabDefinitions(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
|
|
1466
|
+
[event, tabSourceMarkets]
|
|
1467
|
+
);
|
|
1468
|
+
const shouldRenderTabs = visibleSectionDefinitions.length > 1 && tabSourceMarkets.length > 1;
|
|
1469
|
+
const [activeTabKey, setActiveTabKey] = useState4(
|
|
1470
|
+
(_b = (_a = visibleSectionDefinitions[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines"
|
|
1471
|
+
);
|
|
1472
|
+
const [expandedGroupId, setExpandedGroupId] = useState4(null);
|
|
1473
|
+
const [stableMarketsByTab, setStableMarketsByTab] = useState4({});
|
|
1474
|
+
const activeTabLabel = resolveSportsSectionLabel(labels, activeTabKey);
|
|
1475
|
+
const sectionFilters = resolveSportsSectionFilters(activeTabKey);
|
|
1476
|
+
const sectionMarketsQuery = useVenueMarkets({
|
|
1477
|
+
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
1478
|
+
sportsMarketType: sectionFilters.sportsMarketType,
|
|
1479
|
+
period: sectionFilters.period,
|
|
1480
|
+
marketCategory: sectionFilters.marketCategory,
|
|
1481
|
+
marketGroup: sectionFilters.marketGroup,
|
|
1482
|
+
limit: 20,
|
|
1483
|
+
status: MarketStatus2.open,
|
|
1484
|
+
enabled: hasAggKey
|
|
1485
|
+
});
|
|
1486
|
+
const {
|
|
1487
|
+
markets: sectionMarkets,
|
|
1488
|
+
isLoading: isSectionLoading,
|
|
1489
|
+
hasNextPage,
|
|
1490
|
+
isFetchingNextPage,
|
|
1491
|
+
fetchNextPage
|
|
1492
|
+
} = sectionMarketsQuery;
|
|
1493
|
+
const resolvedSectionMarkets = useMemo2(
|
|
1494
|
+
() => resolveSportsSectionMarkets({
|
|
1495
|
+
tabKey: activeTabKey,
|
|
1496
|
+
eventMarkets: tabSourceMarkets,
|
|
1497
|
+
sectionMarkets
|
|
1498
|
+
}),
|
|
1499
|
+
[activeTabKey, tabSourceMarkets, sectionMarkets]
|
|
1500
|
+
);
|
|
1501
|
+
const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
|
|
1502
|
+
const stableSectionMarkets = stableMarketsByTab[activeTabKey];
|
|
1503
|
+
const displayedSectionMarkets = stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [];
|
|
1504
|
+
const periodGroups = useMemo2(
|
|
1505
|
+
() => groupSportsMarketsByPeriod(displayedSectionMarkets),
|
|
1506
|
+
[displayedSectionMarkets]
|
|
1507
|
+
);
|
|
1508
|
+
const displayedPeriodGroups = useMemo2(
|
|
1509
|
+
() => activeTabKey === "game_lines" ? periodGroups.filter((periodGroup) => periodGroup.key === "full") : periodGroups,
|
|
1510
|
+
[activeTabKey, periodGroups]
|
|
1511
|
+
);
|
|
1512
|
+
const allGroups = useMemo2(
|
|
1513
|
+
() => displayedPeriodGroups.flatMap((periodGroup) => periodGroup.groups),
|
|
1514
|
+
[displayedPeriodGroups]
|
|
1515
|
+
);
|
|
1516
|
+
useEffect4(() => {
|
|
1517
|
+
if (hasNextPage && !isFetchingNextPage) {
|
|
1518
|
+
void fetchNextPage();
|
|
1519
|
+
}
|
|
1520
|
+
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
1521
|
+
useEffect4(() => {
|
|
1522
|
+
if (hasNextGameMarketsPage && !isFetchingNextGameMarketsPage) {
|
|
1523
|
+
void fetchNextGameMarketsPage();
|
|
1524
|
+
}
|
|
1525
|
+
}, [hasNextGameMarketsPage, isFetchingNextGameMarketsPage, fetchNextGameMarketsPage]);
|
|
1526
|
+
useEffect4(() => {
|
|
1527
|
+
if (!isSectionSettled) return;
|
|
1528
|
+
setStableMarketsByTab((currentStableMarketsByTab) => {
|
|
1529
|
+
var _a2;
|
|
1530
|
+
const currentMarkets = (_a2 = currentStableMarketsByTab[activeTabKey]) != null ? _a2 : [];
|
|
1531
|
+
if (currentMarkets.length === resolvedSectionMarkets.length && currentMarkets.every((market, index) => {
|
|
1532
|
+
var _a3;
|
|
1533
|
+
return market.id === ((_a3 = resolvedSectionMarkets[index]) == null ? void 0 : _a3.id);
|
|
1534
|
+
})) {
|
|
1535
|
+
return currentStableMarketsByTab;
|
|
1536
|
+
}
|
|
1537
|
+
return __spreadProps(__spreadValues({}, currentStableMarketsByTab), {
|
|
1538
|
+
[activeTabKey]: resolvedSectionMarkets
|
|
1539
|
+
});
|
|
1540
|
+
});
|
|
1541
|
+
}, [activeTabKey, isSectionSettled, resolvedSectionMarkets]);
|
|
1542
|
+
useEffect4(() => {
|
|
1543
|
+
if (!hasAggKey) return;
|
|
1544
|
+
onSectionMarketsChange(activeTabKey, displayedSectionMarkets);
|
|
1545
|
+
}, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
|
|
1546
|
+
useEffect4(() => {
|
|
1547
|
+
var _a2, _b2;
|
|
1548
|
+
if (visibleSectionDefinitions.some((definition) => definition.key === activeTabKey)) return;
|
|
1549
|
+
setActiveTabKey((_b2 = (_a2 = visibleSectionDefinitions[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
|
|
1550
|
+
}, [activeTabKey, visibleSectionDefinitions]);
|
|
1551
|
+
const lastActiveTabRef = useRef3(null);
|
|
1552
|
+
useEffect4(() => {
|
|
1553
|
+
if (allGroups.length === 0) return;
|
|
1554
|
+
if (lastActiveTabRef.current !== activeTabKey) {
|
|
1555
|
+
lastActiveTabRef.current = activeTabKey;
|
|
1556
|
+
setExpandedGroupId(null);
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
if (expandedGroupId && !allGroups.some((group) => group.id === expandedGroupId)) {
|
|
1560
|
+
setExpandedGroupId(null);
|
|
1561
|
+
}
|
|
1562
|
+
}, [activeTabKey, allGroups, expandedGroupId]);
|
|
1563
|
+
const handleToggleGroup = (groupId, market) => {
|
|
1564
|
+
if (groupId === expandedGroupId) {
|
|
1565
|
+
setExpandedGroupId(null);
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
setExpandedGroupId(groupId);
|
|
1569
|
+
if (resolveMarketTradingState2(market).isTradingDisabled) return;
|
|
1570
|
+
if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
|
|
1571
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
const handleGroupOutcomeSelect = (groupId) => {
|
|
1575
|
+
setExpandedGroupId(groupId);
|
|
1576
|
+
onOutcomeSelect == null ? void 0 : onOutcomeSelect();
|
|
1577
|
+
};
|
|
1578
|
+
if (!hasAggKey && event.venueMarkets.length === 0) {
|
|
1579
|
+
return /* @__PURE__ */ jsx4(
|
|
1580
|
+
StateMessage,
|
|
1581
|
+
{
|
|
1582
|
+
title: labels.eventMarketPage.sports.emptyTitle,
|
|
1583
|
+
description: labels.eventMarketPage.unavailableDescription,
|
|
1584
|
+
icon: /* @__PURE__ */ jsx4(Icon, { name: "warning", className: "h-10 w-10 text-agg-warning" }),
|
|
1585
|
+
classNames: { root: "min-h-[220px]" }
|
|
1586
|
+
}
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
const shouldShowLoadingState = stableSectionMarkets == null && !isSectionSettled;
|
|
1590
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-5", "data-testid": "sports-markets", children: [
|
|
1591
|
+
shouldRenderTabs ? /* @__PURE__ */ jsx4(
|
|
1592
|
+
"div",
|
|
1593
|
+
{
|
|
1594
|
+
role: "tablist",
|
|
1595
|
+
"aria-label": labels.eventMarketPage.sports.sectionTabsAria,
|
|
1596
|
+
className: "flex flex-nowrap items-center gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1597
|
+
children: visibleSectionDefinitions.map((definition) => /* @__PURE__ */ jsx4(
|
|
1598
|
+
SportsTabButton,
|
|
1599
|
+
{
|
|
1600
|
+
isActive: definition.key === activeTabKey,
|
|
1601
|
+
label: resolveSportsSectionLabel(labels, definition.key),
|
|
1602
|
+
onClick: () => setActiveTabKey(definition.key)
|
|
1603
|
+
},
|
|
1604
|
+
definition.key
|
|
1605
|
+
))
|
|
1606
|
+
}
|
|
1607
|
+
) : null,
|
|
1608
|
+
shouldShowLoadingState ? /* @__PURE__ */ jsx4(SportsMarketsLoadingState, {}) : null,
|
|
1609
|
+
!shouldShowLoadingState && allGroups.length === 0 ? /* @__PURE__ */ jsx4(
|
|
1610
|
+
StateMessage,
|
|
1611
|
+
{
|
|
1612
|
+
title: labels.eventMarketPage.sports.emptyTitle,
|
|
1613
|
+
description: labels.eventMarketPage.sports.emptyDescription(activeTabLabel),
|
|
1614
|
+
icon: /* @__PURE__ */ jsx4(Icon, { name: "search", className: "h-10 w-10 text-agg-muted-foreground" }),
|
|
1615
|
+
classNames: { root: "min-h-[220px]" }
|
|
1616
|
+
}
|
|
1617
|
+
) : null,
|
|
1618
|
+
displayedPeriodGroups.map((periodGroup) => {
|
|
1619
|
+
const hasMultiplePeriods = displayedPeriodGroups.length > 1;
|
|
1620
|
+
return /* @__PURE__ */ jsxs3(
|
|
1621
|
+
"section",
|
|
1622
|
+
{
|
|
1623
|
+
className: "flex flex-col gap-3",
|
|
1624
|
+
"data-period-key": periodGroup.key,
|
|
1625
|
+
children: [
|
|
1626
|
+
hasMultiplePeriods ? /* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", className: "text-agg-foreground", children: resolveSportsPeriodLabel(labels, periodGroup.key) }) : null,
|
|
1627
|
+
periodGroup.groups.map((group) => /* @__PURE__ */ jsx4(
|
|
1628
|
+
SportsMarketCard,
|
|
1629
|
+
{
|
|
1630
|
+
group,
|
|
1631
|
+
venueMarkets: displayedSectionMarkets,
|
|
1632
|
+
isExpanded: expandedGroupId === group.id,
|
|
1633
|
+
onToggle: handleToggleGroup,
|
|
1634
|
+
onOutcomeSelect: (_groupId, _selection) => handleGroupOutcomeSelect(group.id),
|
|
1635
|
+
live,
|
|
1636
|
+
midpointsResult
|
|
1637
|
+
},
|
|
1638
|
+
group.id
|
|
1639
|
+
))
|
|
1640
|
+
]
|
|
1641
|
+
},
|
|
1642
|
+
`${activeTabKey}-${periodGroup.key}`
|
|
1643
|
+
);
|
|
1644
|
+
})
|
|
1645
|
+
] });
|
|
1646
|
+
};
|
|
1647
|
+
SportsMarkets.displayName = "SportsMarkets";
|
|
1648
|
+
|
|
1649
|
+
// src/pages/event-market/sports-event-market-page.tsx
|
|
1650
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1651
|
+
var areSportsSectionMarketsEqual = (leftMarkets, rightMarkets) => {
|
|
1652
|
+
if (leftMarkets.length !== rightMarkets.length) return false;
|
|
1653
|
+
return leftMarkets.every((market, index) => {
|
|
1654
|
+
var _a;
|
|
1655
|
+
return market.id === ((_a = rightMarkets[index]) == null ? void 0 : _a.id);
|
|
1656
|
+
});
|
|
1657
|
+
};
|
|
1658
|
+
var SportsEventMarketPage = ({
|
|
1659
|
+
event,
|
|
1660
|
+
defaultMarketId,
|
|
1661
|
+
defaultOutcomeId,
|
|
279
1662
|
classNames,
|
|
280
|
-
|
|
1663
|
+
ariaLabel,
|
|
1664
|
+
showPlaceOrder,
|
|
1665
|
+
executionMode,
|
|
1666
|
+
stickyOrderPanel,
|
|
1667
|
+
resolvedClaim,
|
|
1668
|
+
onBeforePrimaryAction
|
|
281
1669
|
}) => {
|
|
1670
|
+
const [sectionMarketsByKey, setSectionMarketsByKey] = useState5({});
|
|
1671
|
+
const composedEvent = useMemo3(() => {
|
|
1672
|
+
return mergeSportsSectionMarketsIntoEvent({
|
|
1673
|
+
event,
|
|
1674
|
+
sectionMarketsByKey
|
|
1675
|
+
});
|
|
1676
|
+
}, [event, sectionMarketsByKey]);
|
|
1677
|
+
const eventTradingState = useMemo3(() => resolveEventTradingState2(composedEvent), [composedEvent]);
|
|
1678
|
+
const hasSportsSections = useMemo3(
|
|
1679
|
+
() => resolveVisibleSportsSectionTabDefinitions(event).length > 0,
|
|
1680
|
+
[event]
|
|
1681
|
+
);
|
|
282
1682
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
283
1683
|
stickyOrderPanel
|
|
284
1684
|
});
|
|
285
|
-
|
|
1685
|
+
const {
|
|
1686
|
+
trading: { executionMode: configuredExecutionMode }
|
|
1687
|
+
} = useSdkUiConfig2();
|
|
1688
|
+
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
1689
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
|
|
1690
|
+
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
1691
|
+
const tradingContext = useEventTradingContext3();
|
|
1692
|
+
const midpointsResult = useMidpoints(composedEvent.venueMarkets);
|
|
1693
|
+
const internalResolvedClaim = useResolvedMarketClaim({
|
|
1694
|
+
market: eventTradingState.primaryMarket,
|
|
1695
|
+
enabled: eventTradingState.kind === "resolved",
|
|
1696
|
+
executionMode: resolvedExecutionMode
|
|
1697
|
+
});
|
|
1698
|
+
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
1699
|
+
const setTradeSideRef = useRef4(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
1700
|
+
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
1701
|
+
useEffect5(() => {
|
|
1702
|
+
return () => {
|
|
1703
|
+
var _a;
|
|
1704
|
+
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide.Buy);
|
|
1705
|
+
};
|
|
1706
|
+
}, []);
|
|
1707
|
+
const handleSectionMarketsChange = useCallback2(
|
|
1708
|
+
(tabKey, markets) => {
|
|
1709
|
+
setSectionMarketsByKey((currentSectionMarketsByKey) => {
|
|
1710
|
+
var _a;
|
|
1711
|
+
const currentMarkets = (_a = currentSectionMarketsByKey[tabKey]) != null ? _a : [];
|
|
1712
|
+
if (areSportsSectionMarketsEqual(currentMarkets, markets)) {
|
|
1713
|
+
return currentSectionMarketsByKey;
|
|
1714
|
+
}
|
|
1715
|
+
return __spreadProps(__spreadValues({}, currentSectionMarketsByKey), {
|
|
1716
|
+
[tabKey]: markets
|
|
1717
|
+
});
|
|
1718
|
+
});
|
|
1719
|
+
},
|
|
1720
|
+
[]
|
|
1721
|
+
);
|
|
1722
|
+
if (!composedEvent.venueMarkets.length) {
|
|
1723
|
+
return /* @__PURE__ */ jsx5(EventMarketPageUnavailableState, { ariaLabel });
|
|
1724
|
+
}
|
|
1725
|
+
return /* @__PURE__ */ jsxs4(
|
|
286
1726
|
"section",
|
|
287
1727
|
{
|
|
288
1728
|
className: cn(
|
|
289
1729
|
"agg-event-market-page",
|
|
290
|
-
"w-full
|
|
1730
|
+
"mx-auto w-full max-w-[1440px] px-4 pb-10 pt-4 sm:px-6 sm:pt-6 xl:px-9 xl:pt-8",
|
|
291
1731
|
classNames == null ? void 0 : classNames.root
|
|
292
1732
|
),
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
1733
|
+
"aria-label": ariaLabel != null ? ariaLabel : composedEvent.title,
|
|
1734
|
+
children: [
|
|
1735
|
+
/* @__PURE__ */ jsxs4(
|
|
1736
|
+
"div",
|
|
1737
|
+
{
|
|
1738
|
+
className: cn(
|
|
1739
|
+
"agg-page-content",
|
|
1740
|
+
"flex w-full flex-col gap-6 xl:flex-row xl:items-start xl:gap-[60px]",
|
|
1741
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
|
|
1742
|
+
classNames == null ? void 0 : classNames.content
|
|
1743
|
+
),
|
|
1744
|
+
style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
|
|
1745
|
+
children: [
|
|
1746
|
+
/* @__PURE__ */ jsxs4(
|
|
1747
|
+
"div",
|
|
1748
|
+
{
|
|
1749
|
+
className: cn(
|
|
1750
|
+
"agg-page-main mb-10 flex min-w-0 flex-1 flex-col gap-10",
|
|
1751
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
1752
|
+
classNames == null ? void 0 : classNames.main
|
|
1753
|
+
),
|
|
1754
|
+
children: [
|
|
1755
|
+
/* @__PURE__ */ jsx5(
|
|
1756
|
+
EventListItemDetails,
|
|
1757
|
+
{
|
|
1758
|
+
event: composedEvent,
|
|
1759
|
+
defaultMarketId,
|
|
1760
|
+
defaultOutcomeId,
|
|
1761
|
+
eventTradingState,
|
|
1762
|
+
midpointsResult,
|
|
1763
|
+
classNames: {
|
|
1764
|
+
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero),
|
|
1765
|
+
// The sports tabs + market cards own market navigation, so hide the
|
|
1766
|
+
// hero's per-market selector pills (one per line market would be noise).
|
|
1767
|
+
headerPills: "hidden"
|
|
1768
|
+
}
|
|
319
1769
|
}
|
|
320
|
-
|
|
1770
|
+
),
|
|
1771
|
+
hasSportsSections ? /* @__PURE__ */ jsx5(
|
|
1772
|
+
SportsMarkets,
|
|
1773
|
+
{
|
|
1774
|
+
event,
|
|
1775
|
+
onSectionMarketsChange: handleSectionMarketsChange,
|
|
1776
|
+
midpointsResult,
|
|
1777
|
+
onOutcomeSelect: isMobileViewport ? () => {
|
|
1778
|
+
setIsMobileTradeOpen(true);
|
|
1779
|
+
} : void 0
|
|
1780
|
+
}
|
|
1781
|
+
) : /* @__PURE__ */ jsx5(
|
|
1782
|
+
MarketDetailsList,
|
|
1783
|
+
{
|
|
1784
|
+
eventId: composedEvent.id,
|
|
1785
|
+
markets: eventTradingState.displayMarkets,
|
|
1786
|
+
eventTradingState,
|
|
1787
|
+
live: true,
|
|
1788
|
+
expandSelectedMarketOnChange: !isMobileViewport,
|
|
1789
|
+
autoExpandFallbackMarket: !isMobileViewport,
|
|
1790
|
+
autoSelectFallbackMarket: !isMobileViewport,
|
|
1791
|
+
onOutcomeSelect: () => {
|
|
1792
|
+
if (!isMobileViewport) return;
|
|
1793
|
+
setIsMobileTradeOpen(true);
|
|
1794
|
+
},
|
|
1795
|
+
classNames: { root: "agg-market-list", item: "agg-market-list-item" },
|
|
1796
|
+
midpointsResult
|
|
1797
|
+
}
|
|
1798
|
+
),
|
|
1799
|
+
showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx5("div", { className: "xl:hidden", children: /* @__PURE__ */ jsx5(
|
|
1800
|
+
PlaceOrder,
|
|
1801
|
+
{
|
|
1802
|
+
eventTradingState,
|
|
1803
|
+
executionMode: resolvedExecutionMode,
|
|
1804
|
+
resolvedClaim: effectiveResolvedClaim,
|
|
1805
|
+
midpointsResult,
|
|
1806
|
+
onBeforePrimaryAction,
|
|
1807
|
+
className: cn(
|
|
1808
|
+
"agg-mobile-trade-panel w-full overflow-hidden",
|
|
1809
|
+
classNames == null ? void 0 : classNames.mobileTrade
|
|
1810
|
+
),
|
|
1811
|
+
classNames: resolveMobileTradePlaceOrderClassNames(classNames)
|
|
1812
|
+
}
|
|
1813
|
+
) }) : null,
|
|
1814
|
+
/* @__PURE__ */ jsx5(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
|
|
1815
|
+
]
|
|
1816
|
+
}
|
|
1817
|
+
),
|
|
1818
|
+
/* @__PURE__ */ jsx5(
|
|
1819
|
+
"aside",
|
|
1820
|
+
{
|
|
1821
|
+
className: cn(
|
|
1822
|
+
"agg-sidebar hidden w-full xl:block xl:max-w-[343px] xl:shrink-0",
|
|
1823
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
|
|
1824
|
+
classNames == null ? void 0 : classNames.sidebar
|
|
321
1825
|
),
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
1826
|
+
children: showPlaceOrder !== false ? /* @__PURE__ */ jsx5(
|
|
1827
|
+
PlaceOrder,
|
|
1828
|
+
{
|
|
1829
|
+
eventTradingState,
|
|
1830
|
+
executionMode: resolvedExecutionMode,
|
|
1831
|
+
resolvedClaim: effectiveResolvedClaim,
|
|
1832
|
+
midpointsResult,
|
|
1833
|
+
onBeforePrimaryAction,
|
|
1834
|
+
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
1835
|
+
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
1836
|
+
}
|
|
1837
|
+
) : null
|
|
1838
|
+
}
|
|
1839
|
+
)
|
|
1840
|
+
]
|
|
1841
|
+
}
|
|
1842
|
+
),
|
|
1843
|
+
!eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx5(
|
|
1844
|
+
EventMarketPageMobileTrade,
|
|
1845
|
+
{
|
|
1846
|
+
classNames,
|
|
1847
|
+
eventTradingState,
|
|
1848
|
+
executionMode: resolvedExecutionMode,
|
|
1849
|
+
showPlaceOrder,
|
|
1850
|
+
isOpen: isMobileTradeOpen,
|
|
1851
|
+
onOpenChange: setIsMobileTradeOpen,
|
|
1852
|
+
midpointsResult,
|
|
1853
|
+
onBeforePrimaryAction
|
|
1854
|
+
}
|
|
1855
|
+
) : null
|
|
1856
|
+
]
|
|
352
1857
|
}
|
|
353
1858
|
);
|
|
354
1859
|
};
|
|
1860
|
+
SportsEventMarketPage.displayName = "SportsEventMarketPage";
|
|
1861
|
+
|
|
1862
|
+
// src/pages/event-market/index.tsx
|
|
1863
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
355
1864
|
var EventMarketPageContent = ({
|
|
356
1865
|
event,
|
|
357
1866
|
defaultMarketId,
|
|
@@ -364,36 +1873,36 @@ var EventMarketPageContent = ({
|
|
|
364
1873
|
resolvedClaim,
|
|
365
1874
|
onBeforePrimaryAction
|
|
366
1875
|
}) => {
|
|
367
|
-
const eventTradingState =
|
|
1876
|
+
const eventTradingState = useMemo4(() => resolveEventTradingState3(event), [event]);
|
|
368
1877
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
369
1878
|
stickyOrderPanel
|
|
370
1879
|
});
|
|
371
1880
|
const {
|
|
372
1881
|
trading: { executionMode: configuredExecutionMode }
|
|
373
|
-
} =
|
|
1882
|
+
} = useSdkUiConfig3();
|
|
374
1883
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
375
|
-
const [isMobileTradeOpen, setIsMobileTradeOpen] =
|
|
1884
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
|
|
376
1885
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
377
|
-
const tradingContext =
|
|
378
|
-
const midpointsResult =
|
|
1886
|
+
const tradingContext = useEventTradingContext4();
|
|
1887
|
+
const midpointsResult = useMidpoints2(event.venueMarkets);
|
|
379
1888
|
const internalResolvedClaim = useResolvedMarketClaim({
|
|
380
1889
|
market: eventTradingState.primaryMarket,
|
|
381
1890
|
enabled: eventTradingState.kind === "resolved",
|
|
382
1891
|
executionMode: resolvedExecutionMode
|
|
383
1892
|
});
|
|
384
1893
|
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
385
|
-
const setTradeSideRef =
|
|
1894
|
+
const setTradeSideRef = useRef5(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
386
1895
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
387
|
-
|
|
1896
|
+
useEffect6(() => {
|
|
388
1897
|
return () => {
|
|
389
1898
|
var _a;
|
|
390
|
-
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef,
|
|
1899
|
+
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide2.Buy);
|
|
391
1900
|
};
|
|
392
1901
|
}, []);
|
|
393
1902
|
if (!event.venueMarkets.length) {
|
|
394
|
-
return /* @__PURE__ */
|
|
1903
|
+
return /* @__PURE__ */ jsx6(EventMarketPageUnavailableState, { ariaLabel });
|
|
395
1904
|
}
|
|
396
|
-
return /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ jsxs5(
|
|
397
1906
|
"section",
|
|
398
1907
|
{
|
|
399
1908
|
className: cn(
|
|
@@ -403,7 +1912,7 @@ var EventMarketPageContent = ({
|
|
|
403
1912
|
),
|
|
404
1913
|
"aria-label": ariaLabel != null ? ariaLabel : event.title,
|
|
405
1914
|
children: [
|
|
406
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ jsxs5(
|
|
407
1916
|
"div",
|
|
408
1917
|
{
|
|
409
1918
|
className: cn(
|
|
@@ -414,7 +1923,7 @@ var EventMarketPageContent = ({
|
|
|
414
1923
|
),
|
|
415
1924
|
style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
|
|
416
1925
|
children: [
|
|
417
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ jsxs5(
|
|
418
1927
|
"div",
|
|
419
1928
|
{
|
|
420
1929
|
className: cn(
|
|
@@ -423,7 +1932,7 @@ var EventMarketPageContent = ({
|
|
|
423
1932
|
classNames == null ? void 0 : classNames.main
|
|
424
1933
|
),
|
|
425
1934
|
children: [
|
|
426
|
-
/* @__PURE__ */
|
|
1935
|
+
/* @__PURE__ */ jsx6(
|
|
427
1936
|
EventListItemDetails,
|
|
428
1937
|
{
|
|
429
1938
|
event,
|
|
@@ -436,7 +1945,7 @@ var EventMarketPageContent = ({
|
|
|
436
1945
|
}
|
|
437
1946
|
}
|
|
438
1947
|
),
|
|
439
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ jsx6(
|
|
440
1949
|
MarketDetailsList,
|
|
441
1950
|
{
|
|
442
1951
|
eventId: event.id,
|
|
@@ -454,11 +1963,12 @@ var EventMarketPageContent = ({
|
|
|
454
1963
|
midpointsResult
|
|
455
1964
|
}
|
|
456
1965
|
),
|
|
457
|
-
showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */
|
|
1966
|
+
showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx6("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx6(
|
|
458
1967
|
PlaceOrder,
|
|
459
1968
|
{
|
|
460
1969
|
eventTradingState,
|
|
461
1970
|
executionMode: resolvedExecutionMode,
|
|
1971
|
+
isQuotePanelActive: isMobileViewport,
|
|
462
1972
|
resolvedClaim: effectiveResolvedClaim,
|
|
463
1973
|
midpointsResult,
|
|
464
1974
|
onBeforePrimaryAction,
|
|
@@ -469,11 +1979,11 @@ var EventMarketPageContent = ({
|
|
|
469
1979
|
classNames: resolveMobileTradePlaceOrderClassNames(classNames)
|
|
470
1980
|
}
|
|
471
1981
|
) }) : null,
|
|
472
|
-
/* @__PURE__ */
|
|
1982
|
+
/* @__PURE__ */ jsx6(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
|
|
473
1983
|
]
|
|
474
1984
|
}
|
|
475
1985
|
),
|
|
476
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ jsx6(
|
|
477
1987
|
"aside",
|
|
478
1988
|
{
|
|
479
1989
|
className: cn(
|
|
@@ -481,11 +1991,12 @@ var EventMarketPageContent = ({
|
|
|
481
1991
|
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
|
|
482
1992
|
classNames == null ? void 0 : classNames.sidebar
|
|
483
1993
|
),
|
|
484
|
-
children: showPlaceOrder !== false ? /* @__PURE__ */
|
|
1994
|
+
children: showPlaceOrder !== false ? /* @__PURE__ */ jsx6(
|
|
485
1995
|
PlaceOrder,
|
|
486
1996
|
{
|
|
487
1997
|
eventTradingState,
|
|
488
1998
|
executionMode: resolvedExecutionMode,
|
|
1999
|
+
isQuotePanelActive: !isMobileViewport,
|
|
489
2000
|
resolvedClaim: effectiveResolvedClaim,
|
|
490
2001
|
midpointsResult,
|
|
491
2002
|
onBeforePrimaryAction,
|
|
@@ -498,7 +2009,7 @@ var EventMarketPageContent = ({
|
|
|
498
2009
|
]
|
|
499
2010
|
}
|
|
500
2011
|
),
|
|
501
|
-
!eventTradingState.isTradingDisabled ? /* @__PURE__ */
|
|
2012
|
+
!eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx6(
|
|
502
2013
|
EventMarketPageMobileTrade,
|
|
503
2014
|
{
|
|
504
2015
|
classNames,
|
|
@@ -517,18 +2028,33 @@ var EventMarketPageContent = ({
|
|
|
517
2028
|
};
|
|
518
2029
|
var EventMarketPage = (props) => {
|
|
519
2030
|
var _a;
|
|
2031
|
+
const {
|
|
2032
|
+
features: { showSportsMarkets }
|
|
2033
|
+
} = useSdkUiConfig3();
|
|
520
2034
|
const hasEventProp = "event" in props && !!props.event;
|
|
521
2035
|
const {
|
|
522
2036
|
event: fetchedEvent,
|
|
523
2037
|
error: eventError,
|
|
524
|
-
isLoading: isFetchingEvent
|
|
2038
|
+
isLoading: isFetchingEvent,
|
|
2039
|
+
isEnriching
|
|
525
2040
|
} = useEnrichedVenueEvent({
|
|
526
2041
|
eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
|
|
527
2042
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
528
2043
|
});
|
|
2044
|
+
const renderEventContent = (event) => {
|
|
2045
|
+
const contentProps = __spreadProps(__spreadValues({}, props), {
|
|
2046
|
+
event,
|
|
2047
|
+
isLoading: false
|
|
2048
|
+
});
|
|
2049
|
+
const hasKnownSport = !!event.sport && event.sport !== "other_sport";
|
|
2050
|
+
if (showSportsMarkets === true && event.structureType === "sport" && hasKnownSport) {
|
|
2051
|
+
return /* @__PURE__ */ jsx6(SportsEventMarketPage, __spreadValues({}, contentProps));
|
|
2052
|
+
}
|
|
2053
|
+
return /* @__PURE__ */ jsx6(EventMarketPageContent, __spreadValues({}, contentProps));
|
|
2054
|
+
};
|
|
529
2055
|
const content = (() => {
|
|
530
2056
|
if (props.isLoading) {
|
|
531
|
-
return /* @__PURE__ */
|
|
2057
|
+
return /* @__PURE__ */ jsx6(
|
|
532
2058
|
EventMarketPageLoadingState,
|
|
533
2059
|
{
|
|
534
2060
|
classNames: props.classNames,
|
|
@@ -537,10 +2063,10 @@ var EventMarketPage = (props) => {
|
|
|
537
2063
|
);
|
|
538
2064
|
}
|
|
539
2065
|
if ("event" in props && props.event) {
|
|
540
|
-
return
|
|
2066
|
+
return renderEventContent(props.event);
|
|
541
2067
|
}
|
|
542
|
-
if (isFetchingEvent) {
|
|
543
|
-
return /* @__PURE__ */
|
|
2068
|
+
if (isFetchingEvent || fetchedEvent && !fetchedEvent.venueMarkets.length && isEnriching) {
|
|
2069
|
+
return /* @__PURE__ */ jsx6(
|
|
544
2070
|
EventMarketPageLoadingState,
|
|
545
2071
|
{
|
|
546
2072
|
classNames: props.classNames,
|
|
@@ -550,13 +2076,13 @@ var EventMarketPage = (props) => {
|
|
|
550
2076
|
}
|
|
551
2077
|
if (!fetchedEvent) {
|
|
552
2078
|
if (isErrorWithStatus(eventError, 404)) {
|
|
553
|
-
return /* @__PURE__ */
|
|
2079
|
+
return /* @__PURE__ */ jsx6(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
|
|
554
2080
|
}
|
|
555
|
-
return /* @__PURE__ */
|
|
2081
|
+
return /* @__PURE__ */ jsx6(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
|
|
556
2082
|
}
|
|
557
|
-
return
|
|
2083
|
+
return renderEventContent(fetchedEvent);
|
|
558
2084
|
})();
|
|
559
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx6(AggErrorBoundary, { onError: props.onError, children: content });
|
|
560
2086
|
};
|
|
561
2087
|
EventMarketPage.displayName = "EventMarketPage";
|
|
562
2088
|
|
|
@@ -621,15 +2147,15 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
|
621
2147
|
};
|
|
622
2148
|
|
|
623
2149
|
// src/pages/home/use-scroll-restoration.ts
|
|
624
|
-
import { useLayoutEffect, useRef as
|
|
2150
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState7 } from "react";
|
|
625
2151
|
function useScrollRestoration({
|
|
626
2152
|
enabled,
|
|
627
2153
|
scrollY,
|
|
628
2154
|
isReady
|
|
629
2155
|
}) {
|
|
630
|
-
const restoredRef =
|
|
631
|
-
const [isRestoring, setIsRestoring] =
|
|
632
|
-
|
|
2156
|
+
const restoredRef = useRef6(false);
|
|
2157
|
+
const [isRestoring, setIsRestoring] = useState7(enabled && scrollY > 0);
|
|
2158
|
+
useLayoutEffect2(() => {
|
|
633
2159
|
if (!enabled || restoredRef.current) return;
|
|
634
2160
|
if (!isReady) return;
|
|
635
2161
|
restoredRef.current = true;
|
|
@@ -642,15 +2168,15 @@ function useScrollRestoration({
|
|
|
642
2168
|
}
|
|
643
2169
|
|
|
644
2170
|
// src/pages/home/use-home-page-modals.ts
|
|
645
|
-
import { useCallback, useEffect as
|
|
2171
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useState as useState8 } from "react";
|
|
646
2172
|
var useHomePageModals = () => {
|
|
647
|
-
const [profileOpen, setProfileOpen] =
|
|
648
|
-
const [depositOpen, setDepositOpen] =
|
|
649
|
-
const [withdrawOpen, setWithdrawOpen] =
|
|
650
|
-
const onProfileClick =
|
|
651
|
-
const onDepositClick =
|
|
652
|
-
const onWithdrawClick =
|
|
653
|
-
|
|
2173
|
+
const [profileOpen, setProfileOpen] = useState8(false);
|
|
2174
|
+
const [depositOpen, setDepositOpen] = useState8(false);
|
|
2175
|
+
const [withdrawOpen, setWithdrawOpen] = useState8(false);
|
|
2176
|
+
const onProfileClick = useCallback3(() => setProfileOpen(true), []);
|
|
2177
|
+
const onDepositClick = useCallback3(() => setDepositOpen(true), []);
|
|
2178
|
+
const onWithdrawClick = useCallback3(() => setWithdrawOpen(true), []);
|
|
2179
|
+
useEffect7(() => {
|
|
654
2180
|
if (typeof window === "undefined") return;
|
|
655
2181
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
656
2182
|
window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
@@ -672,7 +2198,7 @@ var useHomePageModals = () => {
|
|
|
672
2198
|
};
|
|
673
2199
|
|
|
674
2200
|
// src/pages/home/index.tsx
|
|
675
|
-
import { jsx as
|
|
2201
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
676
2202
|
var MIN_SEARCH_LENGTH = 3;
|
|
677
2203
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
678
2204
|
var SEARCH_RESULTS_LIMIT = 20;
|
|
@@ -687,20 +2213,20 @@ var HomeSearchResults = ({
|
|
|
687
2213
|
onEventClick,
|
|
688
2214
|
onMarketClick
|
|
689
2215
|
}) => {
|
|
690
|
-
const labels =
|
|
691
|
-
const { search: searchConfig } =
|
|
2216
|
+
const labels = useLabels4();
|
|
2217
|
+
const { search: searchConfig } = useSdkUiConfig4();
|
|
692
2218
|
const { disabledVenues } = useAppConfig();
|
|
693
|
-
const [activeVenueTabValue, setActiveVenueTabValue] =
|
|
2219
|
+
const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
|
|
694
2220
|
const eventListTabs = useEventListTabs();
|
|
695
2221
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
696
|
-
const visibleVenues =
|
|
2222
|
+
const visibleVenues = useMemo5(
|
|
697
2223
|
() => disabledVenues.length === 0 ? void 0 : getVisibleVenueIdsByConfig(VENUES, disabledVenues),
|
|
698
2224
|
[disabledVenues]
|
|
699
2225
|
);
|
|
700
|
-
const activeVenueTab =
|
|
2226
|
+
const activeVenueTab = useMemo5(() => {
|
|
701
2227
|
return eventListTabs.find((tab) => tab.value === activeVenueTabValue);
|
|
702
2228
|
}, [activeVenueTabValue, eventListTabs]);
|
|
703
|
-
const activeCategoryTab =
|
|
2229
|
+
const activeCategoryTab = useMemo5(() => {
|
|
704
2230
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
705
2231
|
}, [activeTabValue, resolvedTabs]);
|
|
706
2232
|
const activeVenues = resolveTabVenus(activeVenueTab, visibleVenues);
|
|
@@ -724,15 +2250,15 @@ var HomeSearchResults = ({
|
|
|
724
2250
|
// so debounced keystrokes don't pay reranker latency.
|
|
725
2251
|
deep: true
|
|
726
2252
|
});
|
|
727
|
-
const openEvents =
|
|
2253
|
+
const openEvents = useMemo5(() => {
|
|
728
2254
|
let filtered = filterOpenEvents(searchResults);
|
|
729
2255
|
if (activeVenues == null ? void 0 : activeVenues.length) {
|
|
730
2256
|
filtered = filtered.filter((e) => activeVenues.includes(e.venue));
|
|
731
2257
|
}
|
|
732
2258
|
return filtered;
|
|
733
2259
|
}, [searchResults, activeVenues]);
|
|
734
|
-
const loadMoreRef =
|
|
735
|
-
|
|
2260
|
+
const loadMoreRef = useRef7(null);
|
|
2261
|
+
useEffect8(() => {
|
|
736
2262
|
if (!hasNextPage) return;
|
|
737
2263
|
const target = loadMoreRef.current;
|
|
738
2264
|
if (!target) return;
|
|
@@ -759,10 +2285,10 @@ var HomeSearchResults = ({
|
|
|
759
2285
|
const loadingPlaceholderCount = isFetchingNextPage ? 6 : 0;
|
|
760
2286
|
const shouldRenderPaginationLoadingItems = hasNextPage;
|
|
761
2287
|
if (isLoading && !isPlaceholderData) {
|
|
762
|
-
return /* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ jsx7(Skeleton, { view: "event-list", ariaLabel: labels.search.loadingResults, className });
|
|
763
2289
|
}
|
|
764
|
-
return /* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
2290
|
+
return /* @__PURE__ */ jsxs6("section", { className: cn("agg-search-results-section flex w-full flex-col gap-5", className), children: [
|
|
2291
|
+
/* @__PURE__ */ jsxs6(
|
|
766
2292
|
"header",
|
|
767
2293
|
{
|
|
768
2294
|
ref: headerRef,
|
|
@@ -772,8 +2298,8 @@ var HomeSearchResults = ({
|
|
|
772
2298
|
"gap-2 sm:flex-row sm:items-center sm:gap-4"
|
|
773
2299
|
),
|
|
774
2300
|
children: [
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
/* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ jsx7("div", { ref: titleRef, className: "agg-search-results-title min-w-32", children: /* @__PURE__ */ jsx7(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: resultsTitle }) }),
|
|
2302
|
+
/* @__PURE__ */ jsx7(
|
|
777
2303
|
EventListTabs,
|
|
778
2304
|
{
|
|
779
2305
|
ariaLabel: labels.eventList.tabsAria(resultsTitle),
|
|
@@ -786,7 +2312,7 @@ var HomeSearchResults = ({
|
|
|
786
2312
|
]
|
|
787
2313
|
}
|
|
788
2314
|
),
|
|
789
|
-
!isError && openEvents.length === 0 ? /* @__PURE__ */
|
|
2315
|
+
!isError && openEvents.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx7(
|
|
790
2316
|
StateMessage,
|
|
791
2317
|
{
|
|
792
2318
|
title: labels.eventList.emptyTitle,
|
|
@@ -795,18 +2321,18 @@ var HomeSearchResults = ({
|
|
|
795
2321
|
title: "!text-agg-base leading-agg-6",
|
|
796
2322
|
description: "!text-agg-sm leading-agg-5"
|
|
797
2323
|
},
|
|
798
|
-
icon: /* @__PURE__ */
|
|
2324
|
+
icon: /* @__PURE__ */ jsx7(Icon, { name: "search-empty" })
|
|
799
2325
|
}
|
|
800
2326
|
) }) : null,
|
|
801
|
-
isError ? /* @__PURE__ */
|
|
2327
|
+
isError ? /* @__PURE__ */ jsx7(
|
|
802
2328
|
StateMessage,
|
|
803
2329
|
{
|
|
804
2330
|
title: labels.eventList.errorTitle,
|
|
805
2331
|
description: labels.eventList.errorDescription,
|
|
806
|
-
icon: /* @__PURE__ */
|
|
2332
|
+
icon: /* @__PURE__ */ jsx7(Icon, { name: "warning" })
|
|
807
2333
|
}
|
|
808
2334
|
) : null,
|
|
809
|
-
/* @__PURE__ */
|
|
2335
|
+
/* @__PURE__ */ jsxs6(
|
|
810
2336
|
"div",
|
|
811
2337
|
{
|
|
812
2338
|
className: cn(
|
|
@@ -817,7 +2343,7 @@ var HomeSearchResults = ({
|
|
|
817
2343
|
isPlaceholderData && "opacity-60"
|
|
818
2344
|
),
|
|
819
2345
|
children: [
|
|
820
|
-
openEvents.map((event) => /* @__PURE__ */
|
|
2346
|
+
openEvents.map((event) => /* @__PURE__ */ jsx7(
|
|
821
2347
|
EventListItem,
|
|
822
2348
|
{
|
|
823
2349
|
event,
|
|
@@ -839,7 +2365,7 @@ var HomeSearchResults = ({
|
|
|
839
2365
|
},
|
|
840
2366
|
event.id
|
|
841
2367
|
)),
|
|
842
|
-
shouldRenderPaginationLoadingItems ? Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */
|
|
2368
|
+
shouldRenderPaginationLoadingItems ? Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx7(
|
|
843
2369
|
EventListItem,
|
|
844
2370
|
{
|
|
845
2371
|
isLoading: true,
|
|
@@ -852,7 +2378,7 @@ var HomeSearchResults = ({
|
|
|
852
2378
|
]
|
|
853
2379
|
}
|
|
854
2380
|
),
|
|
855
|
-
hasNextPage ? /* @__PURE__ */
|
|
2381
|
+
hasNextPage ? /* @__PURE__ */ jsx7("div", { ref: loadMoreRef, className: "agg-search-results-sentinel h-px w-full", "aria-hidden": true }) : null
|
|
856
2382
|
] });
|
|
857
2383
|
};
|
|
858
2384
|
var HomePage = ({
|
|
@@ -874,7 +2400,7 @@ var HomePage = ({
|
|
|
874
2400
|
stickyOrderPanel
|
|
875
2401
|
}) => {
|
|
876
2402
|
var _a, _b, _c, _d;
|
|
877
|
-
const labels =
|
|
2403
|
+
const labels = useLabels4();
|
|
878
2404
|
const {
|
|
879
2405
|
search: {
|
|
880
2406
|
value: searchValue,
|
|
@@ -884,11 +2410,11 @@ var HomePage = ({
|
|
|
884
2410
|
onSelect: onSelectEventInternal
|
|
885
2411
|
},
|
|
886
2412
|
trading: { executionMode }
|
|
887
|
-
} =
|
|
2413
|
+
} = useSdkUiConfig4();
|
|
888
2414
|
const { capture, consume } = useEventListState();
|
|
889
|
-
const [snapshot] =
|
|
890
|
-
const eventListStateRef =
|
|
891
|
-
const handleSelectEvent =
|
|
2415
|
+
const [snapshot] = useState9(() => consume());
|
|
2416
|
+
const eventListStateRef = useRef7(null);
|
|
2417
|
+
const handleSelectEvent = useCallback4(
|
|
892
2418
|
(event) => {
|
|
893
2419
|
var _a2, _b2, _c2, _d2;
|
|
894
2420
|
capture({
|
|
@@ -907,14 +2433,14 @@ var HomePage = ({
|
|
|
907
2433
|
);
|
|
908
2434
|
const hasCustomTabs = !!tabs && tabs.length > 0;
|
|
909
2435
|
const normalizedSearchValue = searchValue.trim();
|
|
910
|
-
const [stickySelectedEvent, setStickySelectedEvent] =
|
|
2436
|
+
const [stickySelectedEvent, setStickySelectedEvent] = useState9(
|
|
911
2437
|
selectedEvent
|
|
912
2438
|
);
|
|
913
|
-
const [debouncedSearchValue, setDebouncedSearchValue] =
|
|
2439
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = useState9(() => {
|
|
914
2440
|
return normalizedSearchValue.length >= MIN_SEARCH_LENGTH ? normalizedSearchValue : "";
|
|
915
2441
|
});
|
|
916
|
-
const [isMobileSearchViewport, setIsMobileSearchViewport] =
|
|
917
|
-
|
|
2442
|
+
const [isMobileSearchViewport, setIsMobileSearchViewport] = useState9(false);
|
|
2443
|
+
useEffect8(() => {
|
|
918
2444
|
if (typeof window === "undefined") return;
|
|
919
2445
|
const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
|
|
920
2446
|
const handleMediaQueryChange = (event) => {
|
|
@@ -932,7 +2458,7 @@ var HomePage = ({
|
|
|
932
2458
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
933
2459
|
};
|
|
934
2460
|
}, []);
|
|
935
|
-
|
|
2461
|
+
useEffect8(() => {
|
|
936
2462
|
if (normalizedSearchValue.length < MIN_SEARCH_LENGTH) {
|
|
937
2463
|
setDebouncedSearchValue("");
|
|
938
2464
|
return;
|
|
@@ -944,7 +2470,7 @@ var HomePage = ({
|
|
|
944
2470
|
window.clearTimeout(timeoutId);
|
|
945
2471
|
};
|
|
946
2472
|
}, [normalizedSearchValue]);
|
|
947
|
-
|
|
2473
|
+
useEffect8(() => {
|
|
948
2474
|
if (selectedEvent) {
|
|
949
2475
|
setStickySelectedEvent(selectedEvent);
|
|
950
2476
|
return;
|
|
@@ -959,53 +2485,53 @@ var HomePage = ({
|
|
|
959
2485
|
limit: categoriesLimit,
|
|
960
2486
|
enabled: !hasCustomTabs
|
|
961
2487
|
});
|
|
962
|
-
const categoryTabs =
|
|
2488
|
+
const categoryTabs = useMemo5(() => {
|
|
963
2489
|
return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
|
|
964
2490
|
}, [categories, resolvedAllCategoryTabLabel]);
|
|
965
|
-
const resolvedTabs =
|
|
2491
|
+
const resolvedTabs = useMemo5(() => {
|
|
966
2492
|
if (hasCustomTabs && tabs) return tabs;
|
|
967
2493
|
return categoryTabs;
|
|
968
2494
|
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
969
2495
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
970
|
-
const [activeTabValue, setActiveTabValue] =
|
|
2496
|
+
const [activeTabValue, setActiveTabValue] = useState9(() => {
|
|
971
2497
|
if (snapshot == null ? void 0 : snapshot.categoryTab) {
|
|
972
2498
|
return snapshot.categoryTab;
|
|
973
2499
|
}
|
|
974
2500
|
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
975
2501
|
});
|
|
976
|
-
const activeTabValueRef =
|
|
2502
|
+
const activeTabValueRef = useRef7(activeTabValue);
|
|
977
2503
|
activeTabValueRef.current = activeTabValue;
|
|
978
|
-
|
|
2504
|
+
useEffect8(() => {
|
|
979
2505
|
setActiveTabValue((currentValue) => {
|
|
980
2506
|
const hasCurrentValue = resolvedTabs.some((tab) => tab.value === currentValue);
|
|
981
2507
|
if (hasCurrentValue) return currentValue;
|
|
982
2508
|
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
983
2509
|
});
|
|
984
2510
|
}, [defaultActiveTab, resolvedTabs]);
|
|
985
|
-
const tabsItems =
|
|
2511
|
+
const tabsItems = useMemo5(() => {
|
|
986
2512
|
return resolvedTabs.map((tab) => {
|
|
987
2513
|
const isActive = tab.value === activeTabValue;
|
|
988
2514
|
return {
|
|
989
2515
|
value: tab.value,
|
|
990
2516
|
label: tab.label,
|
|
991
|
-
icon: tab.iconName ? /* @__PURE__ */
|
|
2517
|
+
icon: tab.iconName ? /* @__PURE__ */ jsx7(
|
|
992
2518
|
"span",
|
|
993
2519
|
{
|
|
994
2520
|
className: cn(
|
|
995
2521
|
"transition-colors duration-300 ease-in-out",
|
|
996
2522
|
isActive ? "text-agg-primary" : "text-agg-foreground group-hover/agg-tab:text-agg-muted-foreground"
|
|
997
2523
|
),
|
|
998
|
-
children: /* @__PURE__ */
|
|
2524
|
+
children: /* @__PURE__ */ jsx7(Icon, { name: tab.iconName, size: "small", color: "currentColor" })
|
|
999
2525
|
}
|
|
1000
2526
|
) : void 0,
|
|
1001
2527
|
disabled: tab.disabled
|
|
1002
2528
|
};
|
|
1003
2529
|
});
|
|
1004
2530
|
}, [activeTabValue, resolvedTabs]);
|
|
1005
|
-
const activeTab =
|
|
2531
|
+
const activeTab = useMemo5(() => {
|
|
1006
2532
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
1007
2533
|
}, [activeTabValue, resolvedTabs]);
|
|
1008
|
-
const resolvedSectionItems =
|
|
2534
|
+
const resolvedSectionItems = useMemo5(() => {
|
|
1009
2535
|
var _a2, _b2, _c2;
|
|
1010
2536
|
if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
|
|
1011
2537
|
return resolvedEventSectionItems;
|
|
@@ -1050,8 +2576,8 @@ var HomePage = ({
|
|
|
1050
2576
|
scrollY: (_d = snapshot == null ? void 0 : snapshot.scrollY) != null ? _d : 0,
|
|
1051
2577
|
isReady: isScrollRestorationReady
|
|
1052
2578
|
});
|
|
1053
|
-
return /* @__PURE__ */
|
|
1054
|
-
withHeader ? /* @__PURE__ */
|
|
2579
|
+
return /* @__PURE__ */ jsx7(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs6("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
|
|
2580
|
+
withHeader ? /* @__PURE__ */ jsx7(
|
|
1055
2581
|
Header,
|
|
1056
2582
|
{
|
|
1057
2583
|
search: isMobileSearchViewport ? null : void 0,
|
|
@@ -1060,7 +2586,7 @@ var HomePage = ({
|
|
|
1060
2586
|
onLogoClick: handleLogoClick
|
|
1061
2587
|
}
|
|
1062
2588
|
) : null,
|
|
1063
|
-
!resolvedSelectedEvent && !isShowingAllResults ? /* @__PURE__ */
|
|
2589
|
+
!resolvedSelectedEvent && !isShowingAllResults ? /* @__PURE__ */ jsx7(
|
|
1064
2590
|
"header",
|
|
1065
2591
|
{
|
|
1066
2592
|
className: cn(
|
|
@@ -1068,7 +2594,7 @@ var HomePage = ({
|
|
|
1068
2594
|
"w-full bg-agg-secondary border-b border-agg-separator h-14! md:h-15!",
|
|
1069
2595
|
classNames == null ? void 0 : classNames.header
|
|
1070
2596
|
),
|
|
1071
|
-
children: /* @__PURE__ */
|
|
2597
|
+
children: /* @__PURE__ */ jsx7("div", { className: "mx-auto h-full w-full max-w-[1440px] px-6 lg:px-10", children: /* @__PURE__ */ jsx7(
|
|
1072
2598
|
Tabs,
|
|
1073
2599
|
{
|
|
1074
2600
|
ariaLabel: labels.home.categoryTabsAria,
|
|
@@ -1082,14 +2608,14 @@ var HomePage = ({
|
|
|
1082
2608
|
) })
|
|
1083
2609
|
}
|
|
1084
2610
|
) : null,
|
|
1085
|
-
resolvedSelectedEvent ? /* @__PURE__ */
|
|
2611
|
+
resolvedSelectedEvent ? /* @__PURE__ */ jsx7(
|
|
1086
2612
|
EventMarketPage,
|
|
1087
2613
|
{
|
|
1088
2614
|
eventId: resolvedSelectedEvent.id,
|
|
1089
2615
|
executionMode,
|
|
1090
2616
|
stickyOrderPanel
|
|
1091
2617
|
}
|
|
1092
|
-
) : /* @__PURE__ */
|
|
2618
|
+
) : /* @__PURE__ */ jsxs6(
|
|
1093
2619
|
"div",
|
|
1094
2620
|
{
|
|
1095
2621
|
className: cn(
|
|
@@ -1097,14 +2623,14 @@ var HomePage = ({
|
|
|
1097
2623
|
"pt-4 sm:pt-6 md:pt-8 pb-10"
|
|
1098
2624
|
),
|
|
1099
2625
|
children: [
|
|
1100
|
-
shouldRenderMobileSearch ? /* @__PURE__ */
|
|
2626
|
+
shouldRenderMobileSearch ? /* @__PURE__ */ jsx7("div", { className: "agg-page-mobile-search w-full pb-5 md:hidden", children: /* @__PURE__ */ jsx7(
|
|
1101
2627
|
Search,
|
|
1102
2628
|
{
|
|
1103
2629
|
onSelectEvent: handleMobileSearchSelect,
|
|
1104
2630
|
onSeeAllEvents: onSeeAllEventsProp
|
|
1105
2631
|
}
|
|
1106
2632
|
) }) : null,
|
|
1107
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsx7(
|
|
1108
2634
|
"main",
|
|
1109
2635
|
{
|
|
1110
2636
|
className: cn(
|
|
@@ -1112,7 +2638,7 @@ var HomePage = ({
|
|
|
1112
2638
|
"flex w-full flex-col gap-4 sm:gap-6 md:gap-10 mb-10",
|
|
1113
2639
|
classNames == null ? void 0 : classNames.sections
|
|
1114
2640
|
),
|
|
1115
|
-
children: isShowingAllResults && debouncedSearchValue ? /* @__PURE__ */
|
|
2641
|
+
children: isShowingAllResults && debouncedSearchValue ? /* @__PURE__ */ jsx7(
|
|
1116
2642
|
HomeSearchResults,
|
|
1117
2643
|
{
|
|
1118
2644
|
activeTabValue,
|
|
@@ -1125,11 +2651,11 @@ var HomePage = ({
|
|
|
1125
2651
|
}
|
|
1126
2652
|
) : resolvedSectionItems.map((eventSectionItem, sectionIndex) => {
|
|
1127
2653
|
var _a2, _b2, _c2, _d2;
|
|
1128
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx7(
|
|
1129
2655
|
"div",
|
|
1130
2656
|
{
|
|
1131
2657
|
className: "agg-home-section",
|
|
1132
|
-
children: /* @__PURE__ */
|
|
2658
|
+
children: /* @__PURE__ */ jsx7(
|
|
1133
2659
|
EventList,
|
|
1134
2660
|
__spreadValues({
|
|
1135
2661
|
title: eventSectionItem.title,
|
|
@@ -1174,13 +2700,13 @@ import {
|
|
|
1174
2700
|
useExecutionOrders,
|
|
1175
2701
|
useExecutionPositions,
|
|
1176
2702
|
useGeoBlock,
|
|
1177
|
-
useLabels as
|
|
2703
|
+
useLabels as useLabels9,
|
|
1178
2704
|
useQueryClient,
|
|
1179
|
-
useSdkUiConfig as
|
|
2705
|
+
useSdkUiConfig as useSdkUiConfig5,
|
|
1180
2706
|
useUserActivity
|
|
1181
2707
|
} from "@agg-build/hooks";
|
|
1182
2708
|
import { Venue } from "@agg-build/sdk";
|
|
1183
|
-
import { useCallback as
|
|
2709
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo7, useState as useState11 } from "react";
|
|
1184
2710
|
|
|
1185
2711
|
// src/pages/user-profile/chain-display.ts
|
|
1186
2712
|
var CHAIN_ID_TO_LABEL = {
|
|
@@ -1203,8 +2729,8 @@ var formatChainIdLabel = (chainId) => {
|
|
|
1203
2729
|
};
|
|
1204
2730
|
|
|
1205
2731
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
1206
|
-
import { useLabels as
|
|
1207
|
-
import { jsx as
|
|
2732
|
+
import { useLabels as useLabels5 } from "@agg-build/hooks";
|
|
2733
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1208
2734
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
1209
2735
|
var CHAIN_ID_TO_ICON_URL = {
|
|
1210
2736
|
"1": `${BASE_URL}/public/prediction-markets/logos/ETH.svg`,
|
|
@@ -1258,11 +2784,11 @@ var AvailableBalanceCard = ({
|
|
|
1258
2784
|
isLoading = false,
|
|
1259
2785
|
className
|
|
1260
2786
|
}) => {
|
|
1261
|
-
const labels =
|
|
2787
|
+
const labels = useLabels5();
|
|
1262
2788
|
const balanceLabels = labels.userProfile.balance;
|
|
1263
2789
|
const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
|
|
1264
2790
|
const hasPaperBalance = chains.some(isPaperChain);
|
|
1265
|
-
return /* @__PURE__ */
|
|
2791
|
+
return /* @__PURE__ */ jsxs7(
|
|
1266
2792
|
"div",
|
|
1267
2793
|
{
|
|
1268
2794
|
className: cn(
|
|
@@ -1271,8 +2797,8 @@ var AvailableBalanceCard = ({
|
|
|
1271
2797
|
className
|
|
1272
2798
|
),
|
|
1273
2799
|
children: [
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
2800
|
+
/* @__PURE__ */ jsx8("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
2801
|
+
/* @__PURE__ */ jsx8(
|
|
1276
2802
|
"svg",
|
|
1277
2803
|
{
|
|
1278
2804
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1282,7 +2808,7 @@ var AvailableBalanceCard = ({
|
|
|
1282
2808
|
fill: "none",
|
|
1283
2809
|
"aria-hidden": "true",
|
|
1284
2810
|
focusable: "false",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
2811
|
+
children: /* @__PURE__ */ jsx8(
|
|
1286
2812
|
"path",
|
|
1287
2813
|
{
|
|
1288
2814
|
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",
|
|
@@ -1291,31 +2817,31 @@ var AvailableBalanceCard = ({
|
|
|
1291
2817
|
)
|
|
1292
2818
|
}
|
|
1293
2819
|
),
|
|
1294
|
-
/* @__PURE__ */
|
|
2820
|
+
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
|
|
1295
2821
|
] }) }),
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ jsxs7("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
2823
|
+
/* @__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 }),
|
|
2824
|
+
/* @__PURE__ */ jsx8(
|
|
1299
2825
|
Tooltip,
|
|
1300
2826
|
{
|
|
1301
2827
|
"aria-label": balanceLabels.balanceByNetwork,
|
|
1302
2828
|
size: "medium",
|
|
1303
2829
|
side: "bottom",
|
|
1304
|
-
content: /* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
2830
|
+
content: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
|
|
2831
|
+
/* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
|
|
2832
|
+
/* @__PURE__ */ jsx8("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
1307
2833
|
var _a;
|
|
1308
2834
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
1309
2835
|
const isPaper = isPaperChain(row);
|
|
1310
2836
|
const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
|
|
1311
|
-
return /* @__PURE__ */
|
|
2837
|
+
return /* @__PURE__ */ jsxs7(
|
|
1312
2838
|
"div",
|
|
1313
2839
|
{
|
|
1314
2840
|
role: "listitem",
|
|
1315
2841
|
className: "agg-balance-row flex items-center justify-between self-stretch gap-3 w-full",
|
|
1316
2842
|
children: [
|
|
1317
|
-
/* @__PURE__ */
|
|
1318
|
-
iconUrl ? /* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
2844
|
+
iconUrl ? /* @__PURE__ */ jsx8("span", { className: "overflow-clip flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx8(
|
|
1319
2845
|
"img",
|
|
1320
2846
|
{
|
|
1321
2847
|
src: iconUrl,
|
|
@@ -1323,16 +2849,16 @@ var AvailableBalanceCard = ({
|
|
|
1323
2849
|
"aria-hidden": true,
|
|
1324
2850
|
className: "size-full object-contain"
|
|
1325
2851
|
}
|
|
1326
|
-
) }) : isPaper ? /* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
2852
|
+
) }) : isPaper ? /* @__PURE__ */ jsx8("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary-hover text-agg-primary", children: /* @__PURE__ */ jsx8(Icon, { name: "paper-mode", size: "small", className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx8("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: rowLabel.slice(0, 2).toUpperCase() }),
|
|
2853
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: rowLabel })
|
|
1328
2854
|
] }),
|
|
1329
|
-
/* @__PURE__ */
|
|
2855
|
+
/* @__PURE__ */ jsx8("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
|
|
1330
2856
|
style: "currency",
|
|
1331
2857
|
currency: "USD",
|
|
1332
2858
|
minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
|
|
1333
2859
|
maximumFractionDigits: 2
|
|
1334
2860
|
}) }),
|
|
1335
|
-
/* @__PURE__ */
|
|
2861
|
+
/* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: ((_a = CHAIN_VENUE_MAP[row.key]) != null ? _a : []).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx8(
|
|
1336
2862
|
VenueLogo,
|
|
1337
2863
|
{
|
|
1338
2864
|
venue,
|
|
@@ -1346,8 +2872,8 @@ var AvailableBalanceCard = ({
|
|
|
1346
2872
|
row.key
|
|
1347
2873
|
);
|
|
1348
2874
|
}) }),
|
|
1349
|
-
hasPaperBalance ? /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
2875
|
+
hasPaperBalance ? /* @__PURE__ */ jsx8("div", { className: "agg-balance-paper-warning rounded-agg-lg bg-agg-primary/10 p-3", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
|
|
2876
|
+
/* @__PURE__ */ jsx8(
|
|
1351
2877
|
Icon,
|
|
1352
2878
|
{
|
|
1353
2879
|
name: "paper-mode",
|
|
@@ -1355,11 +2881,11 @@ var AvailableBalanceCard = ({
|
|
|
1355
2881
|
className: "mt-0.5 h-4 w-4 shrink-0 text-agg-primary"
|
|
1356
2882
|
}
|
|
1357
2883
|
),
|
|
1358
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.paperModeWarning })
|
|
1359
2885
|
] }) }) : null,
|
|
1360
|
-
/* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ jsx8("div", { className: "agg-balance-note rounded-agg-lg bg-agg-secondary-hover p-3", children: /* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.networkTooltipDescription }) })
|
|
1361
2887
|
] }),
|
|
1362
|
-
children: /* @__PURE__ */
|
|
2888
|
+
children: /* @__PURE__ */ jsxs7(
|
|
1363
2889
|
"button",
|
|
1364
2890
|
{
|
|
1365
2891
|
type: "button",
|
|
@@ -1369,18 +2895,18 @@ var AvailableBalanceCard = ({
|
|
|
1369
2895
|
(chains.slice(0, 4).length > 0 ? chains.slice(0, 4) : [{ key: "placeholder", label: "", balance: 0, accountCount: 0 }]).map((row) => {
|
|
1370
2896
|
const iconUrl = chainIconUrl(row.label, row.key);
|
|
1371
2897
|
const isPaper = isPaperChain(row);
|
|
1372
|
-
return iconUrl ? /* @__PURE__ */
|
|
2898
|
+
return iconUrl ? /* @__PURE__ */ jsx8(
|
|
1373
2899
|
"span",
|
|
1374
2900
|
{
|
|
1375
2901
|
className: "overflow-clip relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary",
|
|
1376
|
-
children: /* @__PURE__ */
|
|
2902
|
+
children: /* @__PURE__ */ jsx8("img", { src: iconUrl, alt: row.label, className: "size-full object-contain" })
|
|
1377
2903
|
},
|
|
1378
2904
|
`icon-${row.key}`
|
|
1379
|
-
) : isPaper ? /* @__PURE__ */
|
|
2905
|
+
) : isPaper ? /* @__PURE__ */ jsx8(
|
|
1380
2906
|
"span",
|
|
1381
2907
|
{
|
|
1382
2908
|
className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-agg-primary",
|
|
1383
|
-
children: /* @__PURE__ */
|
|
2909
|
+
children: /* @__PURE__ */ jsx8(
|
|
1384
2910
|
Icon,
|
|
1385
2911
|
{
|
|
1386
2912
|
name: "paper-mode",
|
|
@@ -1391,7 +2917,7 @@ var AvailableBalanceCard = ({
|
|
|
1391
2917
|
)
|
|
1392
2918
|
},
|
|
1393
2919
|
`icon-${row.key}`
|
|
1394
|
-
) : /* @__PURE__ */
|
|
2920
|
+
) : /* @__PURE__ */ jsx8(
|
|
1395
2921
|
"span",
|
|
1396
2922
|
{
|
|
1397
2923
|
className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-[10px] leading-3 text-agg-muted-foreground",
|
|
@@ -1400,7 +2926,7 @@ var AvailableBalanceCard = ({
|
|
|
1400
2926
|
`icon-${row.key}`
|
|
1401
2927
|
);
|
|
1402
2928
|
}),
|
|
1403
|
-
chains.length > 4 ? /* @__PURE__ */
|
|
2929
|
+
chains.length > 4 ? /* @__PURE__ */ jsxs7("span", { className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary font-agg-sans text-[10px] leading-3 text-agg-muted-foreground", children: [
|
|
1404
2930
|
"+",
|
|
1405
2931
|
chains.length - 4
|
|
1406
2932
|
] }) : null
|
|
@@ -1417,8 +2943,8 @@ var AvailableBalanceCard = ({
|
|
|
1417
2943
|
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
1418
2944
|
|
|
1419
2945
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
1420
|
-
import { optimizedImageUrl as optimizedImageUrl2, useLabels as
|
|
1421
|
-
import { Fragment as Fragment4, useEffect as
|
|
2946
|
+
import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels7 } from "@agg-build/hooks";
|
|
2947
|
+
import { Fragment as Fragment4, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
1422
2948
|
|
|
1423
2949
|
// src/pages/user-profile/user-profile.constants.ts
|
|
1424
2950
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -1623,7 +3149,7 @@ var ConditionalWrapper = ({
|
|
|
1623
3149
|
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
1624
3150
|
|
|
1625
3151
|
// src/pages/user-profile/components/activity-row.tsx
|
|
1626
|
-
import { Fragment as Fragment2, jsx as
|
|
3152
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1627
3153
|
var shouldOpenInNewTab = (activity) => {
|
|
1628
3154
|
return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
|
|
1629
3155
|
};
|
|
@@ -1640,7 +3166,7 @@ var RowWrapper = ({
|
|
|
1640
3166
|
}) => {
|
|
1641
3167
|
if (href) {
|
|
1642
3168
|
const opensInNewTab = target === "_blank";
|
|
1643
|
-
return /* @__PURE__ */
|
|
3169
|
+
return /* @__PURE__ */ jsx9(
|
|
1644
3170
|
"a",
|
|
1645
3171
|
{
|
|
1646
3172
|
href,
|
|
@@ -1656,7 +3182,7 @@ var RowWrapper = ({
|
|
|
1656
3182
|
}
|
|
1657
3183
|
);
|
|
1658
3184
|
}
|
|
1659
|
-
return /* @__PURE__ */
|
|
3185
|
+
return /* @__PURE__ */ jsx9("button", { type: "button", className, onClick, children });
|
|
1660
3186
|
};
|
|
1661
3187
|
var TRANSFER_ICON = {
|
|
1662
3188
|
withdrawal: "upload",
|
|
@@ -1691,7 +3217,7 @@ var AmountTimeStack = ({
|
|
|
1691
3217
|
timeLabel,
|
|
1692
3218
|
tone,
|
|
1693
3219
|
mobile
|
|
1694
|
-
}) => /* @__PURE__ */
|
|
3220
|
+
}) => /* @__PURE__ */ jsxs8(
|
|
1695
3221
|
"div",
|
|
1696
3222
|
{
|
|
1697
3223
|
className: cn(
|
|
@@ -1699,7 +3225,7 @@ var AmountTimeStack = ({
|
|
|
1699
3225
|
mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
|
|
1700
3226
|
),
|
|
1701
3227
|
children: [
|
|
1702
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsx9(
|
|
1703
3229
|
"p",
|
|
1704
3230
|
{
|
|
1705
3231
|
className: cn(
|
|
@@ -1710,7 +3236,7 @@ var AmountTimeStack = ({
|
|
|
1710
3236
|
children: amountLabel
|
|
1711
3237
|
}
|
|
1712
3238
|
),
|
|
1713
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ jsx9(
|
|
1714
3240
|
"p",
|
|
1715
3241
|
{
|
|
1716
3242
|
className: cn(
|
|
@@ -1727,9 +3253,9 @@ var AmountTimeStack = ({
|
|
|
1727
3253
|
var TradeTypeCell = ({
|
|
1728
3254
|
activity,
|
|
1729
3255
|
tone
|
|
1730
|
-
}) => /* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
/* @__PURE__ */
|
|
3256
|
+
}) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
3257
|
+
/* @__PURE__ */ jsx9(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
|
|
3258
|
+
/* @__PURE__ */ jsx9(
|
|
1733
3259
|
"p",
|
|
1734
3260
|
{
|
|
1735
3261
|
className: cn(
|
|
@@ -1744,8 +3270,8 @@ var TradeTypeCell = ({
|
|
|
1744
3270
|
var TransferTypeCell = ({
|
|
1745
3271
|
activity,
|
|
1746
3272
|
tone
|
|
1747
|
-
}) => /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
3273
|
+
}) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
3274
|
+
/* @__PURE__ */ jsx9(
|
|
1749
3275
|
Icon,
|
|
1750
3276
|
{
|
|
1751
3277
|
name: TRANSFER_ICON[activity.kind],
|
|
@@ -1756,7 +3282,7 @@ var TransferTypeCell = ({
|
|
|
1756
3282
|
)
|
|
1757
3283
|
}
|
|
1758
3284
|
),
|
|
1759
|
-
/* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ jsx9(
|
|
1760
3286
|
"p",
|
|
1761
3287
|
{
|
|
1762
3288
|
className: cn(
|
|
@@ -1771,8 +3297,8 @@ var TransferTypeCell = ({
|
|
|
1771
3297
|
var RedeemTypeCell = ({
|
|
1772
3298
|
activity,
|
|
1773
3299
|
tone
|
|
1774
|
-
}) => /* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
3300
|
+
}) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
3301
|
+
/* @__PURE__ */ jsx9(
|
|
1776
3302
|
Icon,
|
|
1777
3303
|
{
|
|
1778
3304
|
name: "gift-bonus",
|
|
@@ -1783,7 +3309,7 @@ var RedeemTypeCell = ({
|
|
|
1783
3309
|
)
|
|
1784
3310
|
}
|
|
1785
3311
|
),
|
|
1786
|
-
/* @__PURE__ */
|
|
3312
|
+
/* @__PURE__ */ jsx9(
|
|
1787
3313
|
"p",
|
|
1788
3314
|
{
|
|
1789
3315
|
className: cn(
|
|
@@ -1800,7 +3326,7 @@ var OutcomeBadge = ({
|
|
|
1800
3326
|
tone
|
|
1801
3327
|
}) => {
|
|
1802
3328
|
if (!label) return null;
|
|
1803
|
-
return /* @__PURE__ */
|
|
3329
|
+
return /* @__PURE__ */ jsx9("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__ */ jsx9(
|
|
1804
3330
|
"span",
|
|
1805
3331
|
{
|
|
1806
3332
|
className: cn(
|
|
@@ -1814,9 +3340,9 @@ var OutcomeBadge = ({
|
|
|
1814
3340
|
var TradeOutcomeShares = ({
|
|
1815
3341
|
activity,
|
|
1816
3342
|
tone
|
|
1817
|
-
}) => /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
3343
|
+
}) => /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
3344
|
+
/* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone }),
|
|
3345
|
+
/* @__PURE__ */ jsx9(
|
|
1820
3346
|
"span",
|
|
1821
3347
|
{
|
|
1822
3348
|
className: cn(
|
|
@@ -1837,7 +3363,7 @@ var RedeemRow = ({
|
|
|
1837
3363
|
const statusVisual = getStatusVisual(activity);
|
|
1838
3364
|
const activityStatus = resolveActivityStatus(activity);
|
|
1839
3365
|
const shouldShowInlineStatus = activityStatus !== "completed";
|
|
1840
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx9(
|
|
1841
3367
|
RowWrapper,
|
|
1842
3368
|
{
|
|
1843
3369
|
className,
|
|
@@ -1845,23 +3371,23 @@ var RedeemRow = ({
|
|
|
1845
3371
|
target: href ? "_blank" : void 0,
|
|
1846
3372
|
rel: href ? "noopener noreferrer" : void 0,
|
|
1847
3373
|
onClick,
|
|
1848
|
-
children: /* @__PURE__ */
|
|
3374
|
+
children: /* @__PURE__ */ jsx9(
|
|
1849
3375
|
ConditionalWrapper,
|
|
1850
3376
|
{
|
|
1851
3377
|
condition: !!activity.errorMessage,
|
|
1852
|
-
wrapper: (children) => /* @__PURE__ */
|
|
3378
|
+
wrapper: (children) => /* @__PURE__ */ jsx9(
|
|
1853
3379
|
Tooltip,
|
|
1854
3380
|
{
|
|
1855
3381
|
size: "medium",
|
|
1856
|
-
content: /* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
3382
|
+
content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
|
|
3383
|
+
/* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
3384
|
+
/* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1859
3385
|
] }),
|
|
1860
3386
|
sideOffset: 4,
|
|
1861
3387
|
children
|
|
1862
3388
|
}
|
|
1863
3389
|
),
|
|
1864
|
-
children: /* @__PURE__ */
|
|
3390
|
+
children: /* @__PURE__ */ jsxs8(
|
|
1865
3391
|
"div",
|
|
1866
3392
|
{
|
|
1867
3393
|
className: cn(
|
|
@@ -1870,10 +3396,10 @@ var RedeemRow = ({
|
|
|
1870
3396
|
),
|
|
1871
3397
|
"data-status": activityStatus,
|
|
1872
3398
|
children: [
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
/* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
1876
|
-
/* @__PURE__ */
|
|
3399
|
+
/* @__PURE__ */ jsx9(RedeemTypeCell, { activity, tone }),
|
|
3400
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
3401
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
3402
|
+
/* @__PURE__ */ jsx9(
|
|
1877
3403
|
Icon,
|
|
1878
3404
|
{
|
|
1879
3405
|
name: "gift-bonus",
|
|
@@ -1884,7 +3410,7 @@ var RedeemRow = ({
|
|
|
1884
3410
|
)
|
|
1885
3411
|
}
|
|
1886
3412
|
),
|
|
1887
|
-
/* @__PURE__ */
|
|
3413
|
+
/* @__PURE__ */ jsx9(
|
|
1888
3414
|
"p",
|
|
1889
3415
|
{
|
|
1890
3416
|
className: cn(
|
|
@@ -1896,11 +3422,11 @@ var RedeemRow = ({
|
|
|
1896
3422
|
}
|
|
1897
3423
|
)
|
|
1898
3424
|
] }),
|
|
1899
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone })
|
|
1900
3426
|
] }),
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
/* @__PURE__ */
|
|
3427
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
3428
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
3429
|
+
/* @__PURE__ */ jsx9("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx9(
|
|
1904
3430
|
RemoteImage,
|
|
1905
3431
|
{
|
|
1906
3432
|
src: activity.thumbnailSrc,
|
|
@@ -1909,9 +3435,9 @@ var RedeemRow = ({
|
|
|
1909
3435
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
1910
3436
|
}
|
|
1911
3437
|
) }),
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
3438
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
|
|
3439
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3440
|
+
/* @__PURE__ */ jsx9(
|
|
1915
3441
|
"p",
|
|
1916
3442
|
{
|
|
1917
3443
|
className: cn(
|
|
@@ -1921,13 +3447,13 @@ var RedeemRow = ({
|
|
|
1921
3447
|
children: activity.title
|
|
1922
3448
|
}
|
|
1923
3449
|
),
|
|
1924
|
-
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */
|
|
3450
|
+
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx9(
|
|
1925
3451
|
LoadingIcon,
|
|
1926
3452
|
{
|
|
1927
3453
|
size: "small",
|
|
1928
3454
|
className: cn("shrink-0", statusVisual.iconClassName)
|
|
1929
3455
|
}
|
|
1930
|
-
) : /* @__PURE__ */
|
|
3456
|
+
) : /* @__PURE__ */ jsx9(
|
|
1931
3457
|
Icon,
|
|
1932
3458
|
{
|
|
1933
3459
|
name: statusVisual.icon,
|
|
@@ -1936,9 +3462,9 @@ var RedeemRow = ({
|
|
|
1936
3462
|
}
|
|
1937
3463
|
) : null
|
|
1938
3464
|
] }),
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
3465
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
|
|
3466
|
+
/* @__PURE__ */ jsx9("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
|
|
3467
|
+
/* @__PURE__ */ jsx9(
|
|
1942
3468
|
"p",
|
|
1943
3469
|
{
|
|
1944
3470
|
className: cn(
|
|
@@ -1951,7 +3477,7 @@ var RedeemRow = ({
|
|
|
1951
3477
|
] })
|
|
1952
3478
|
] })
|
|
1953
3479
|
] }),
|
|
1954
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ jsx9(
|
|
1955
3481
|
AmountTimeStack,
|
|
1956
3482
|
{
|
|
1957
3483
|
amountLabel: activity.amountLabel,
|
|
@@ -1961,7 +3487,7 @@ var RedeemRow = ({
|
|
|
1961
3487
|
}
|
|
1962
3488
|
)
|
|
1963
3489
|
] }),
|
|
1964
|
-
/* @__PURE__ */
|
|
3490
|
+
/* @__PURE__ */ jsx9(
|
|
1965
3491
|
AmountTimeStack,
|
|
1966
3492
|
{
|
|
1967
3493
|
amountLabel: activity.amountLabel,
|
|
@@ -1984,23 +3510,23 @@ var TradeRow = ({
|
|
|
1984
3510
|
onClick
|
|
1985
3511
|
}) => {
|
|
1986
3512
|
const tone = resolveToneClasses(activity);
|
|
1987
|
-
return /* @__PURE__ */
|
|
3513
|
+
return /* @__PURE__ */ jsx9(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsx9(
|
|
1988
3514
|
ConditionalWrapper,
|
|
1989
3515
|
{
|
|
1990
3516
|
condition: !!activity.errorMessage,
|
|
1991
|
-
wrapper: (children) => /* @__PURE__ */
|
|
3517
|
+
wrapper: (children) => /* @__PURE__ */ jsx9(
|
|
1992
3518
|
Tooltip,
|
|
1993
3519
|
{
|
|
1994
3520
|
size: "medium",
|
|
1995
|
-
content: /* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
3521
|
+
content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
|
|
3522
|
+
/* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
3523
|
+
/* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
1998
3524
|
] }),
|
|
1999
3525
|
sideOffset: 4,
|
|
2000
3526
|
children
|
|
2001
3527
|
}
|
|
2002
3528
|
),
|
|
2003
|
-
children: /* @__PURE__ */
|
|
3529
|
+
children: /* @__PURE__ */ jsxs8(
|
|
2004
3530
|
"div",
|
|
2005
3531
|
{
|
|
2006
3532
|
className: cn(
|
|
@@ -2008,10 +3534,10 @@ var TradeRow = ({
|
|
|
2008
3534
|
"relative z-10"
|
|
2009
3535
|
),
|
|
2010
3536
|
children: [
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
3538
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
3539
|
+
/* @__PURE__ */ jsx9(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
|
|
3540
|
+
/* @__PURE__ */ jsx9(
|
|
2015
3541
|
"p",
|
|
2016
3542
|
{
|
|
2017
3543
|
className: cn(
|
|
@@ -2023,12 +3549,12 @@ var TradeRow = ({
|
|
|
2023
3549
|
}
|
|
2024
3550
|
)
|
|
2025
3551
|
] }),
|
|
2026
|
-
/* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ jsx9("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx9(TradeOutcomeShares, { activity, tone }) })
|
|
2027
3553
|
] }),
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsx9(TradeTypeCell, { activity, tone }),
|
|
3555
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
3556
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
3557
|
+
/* @__PURE__ */ jsx9("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx9(
|
|
2032
3558
|
RemoteImage,
|
|
2033
3559
|
{
|
|
2034
3560
|
src: activity.thumbnailSrc,
|
|
@@ -2037,8 +3563,8 @@ var TradeRow = ({
|
|
|
2037
3563
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
2038
3564
|
}
|
|
2039
3565
|
) }),
|
|
2040
|
-
/* @__PURE__ */
|
|
2041
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
3567
|
+
/* @__PURE__ */ jsx9(
|
|
2042
3568
|
"p",
|
|
2043
3569
|
{
|
|
2044
3570
|
className: cn(
|
|
@@ -2048,10 +3574,10 @@ var TradeRow = ({
|
|
|
2048
3574
|
children: activity.title
|
|
2049
3575
|
}
|
|
2050
3576
|
),
|
|
2051
|
-
/* @__PURE__ */
|
|
3577
|
+
/* @__PURE__ */ jsx9("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx9(TradeOutcomeShares, { activity, tone }) })
|
|
2052
3578
|
] })
|
|
2053
3579
|
] }),
|
|
2054
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx9(
|
|
2055
3581
|
AmountTimeStack,
|
|
2056
3582
|
{
|
|
2057
3583
|
amountLabel: activity.amountLabel,
|
|
@@ -2061,7 +3587,7 @@ var TradeRow = ({
|
|
|
2061
3587
|
}
|
|
2062
3588
|
)
|
|
2063
3589
|
] }),
|
|
2064
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsx9(
|
|
2065
3591
|
AmountTimeStack,
|
|
2066
3592
|
{
|
|
2067
3593
|
amountLabel: activity.amountLabel,
|
|
@@ -2085,7 +3611,7 @@ var TransferRow = ({
|
|
|
2085
3611
|
const transferStatus = resolveActivityStatus(activity);
|
|
2086
3612
|
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
2087
3613
|
const statusVisual = getStatusVisual(activity);
|
|
2088
|
-
return /* @__PURE__ */
|
|
3614
|
+
return /* @__PURE__ */ jsx9(
|
|
2089
3615
|
RowWrapper,
|
|
2090
3616
|
{
|
|
2091
3617
|
className,
|
|
@@ -2093,23 +3619,23 @@ var TransferRow = ({
|
|
|
2093
3619
|
target: href ? "_blank" : void 0,
|
|
2094
3620
|
rel: href ? "noopener noreferrer" : void 0,
|
|
2095
3621
|
onClick,
|
|
2096
|
-
children: /* @__PURE__ */
|
|
3622
|
+
children: /* @__PURE__ */ jsx9(
|
|
2097
3623
|
ConditionalWrapper,
|
|
2098
3624
|
{
|
|
2099
3625
|
condition: !!activity.errorMessage,
|
|
2100
|
-
wrapper: (children) => /* @__PURE__ */
|
|
3626
|
+
wrapper: (children) => /* @__PURE__ */ jsx9(
|
|
2101
3627
|
Tooltip,
|
|
2102
3628
|
{
|
|
2103
3629
|
size: "medium",
|
|
2104
|
-
content: /* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
3630
|
+
content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
|
|
3631
|
+
/* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
|
|
3632
|
+
/* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
|
|
2107
3633
|
] }),
|
|
2108
3634
|
sideOffset: 4,
|
|
2109
3635
|
children
|
|
2110
3636
|
}
|
|
2111
3637
|
),
|
|
2112
|
-
children: /* @__PURE__ */
|
|
3638
|
+
children: /* @__PURE__ */ jsxs8(
|
|
2113
3639
|
"div",
|
|
2114
3640
|
{
|
|
2115
3641
|
className: cn(
|
|
@@ -2117,9 +3643,9 @@ var TransferRow = ({
|
|
|
2117
3643
|
"relative z-10"
|
|
2118
3644
|
),
|
|
2119
3645
|
children: [
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsx9(TransferTypeCell, { activity, tone }),
|
|
3647
|
+
/* @__PURE__ */ jsx9("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
3648
|
+
/* @__PURE__ */ jsx9(
|
|
2123
3649
|
Icon,
|
|
2124
3650
|
{
|
|
2125
3651
|
name: transferIconName,
|
|
@@ -2130,7 +3656,7 @@ var TransferRow = ({
|
|
|
2130
3656
|
)
|
|
2131
3657
|
}
|
|
2132
3658
|
),
|
|
2133
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx9(
|
|
2134
3660
|
"p",
|
|
2135
3661
|
{
|
|
2136
3662
|
className: cn(
|
|
@@ -2142,14 +3668,14 @@ var TransferRow = ({
|
|
|
2142
3668
|
}
|
|
2143
3669
|
)
|
|
2144
3670
|
] }) }),
|
|
2145
|
-
/* @__PURE__ */
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
/* @__PURE__ */
|
|
3671
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
3672
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
3673
|
+
/* @__PURE__ */ jsx9(
|
|
2148
3674
|
"div",
|
|
2149
3675
|
{
|
|
2150
3676
|
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",
|
|
2151
3677
|
"data-status": transferStatus,
|
|
2152
|
-
children: statusVisual.spin ? /* @__PURE__ */
|
|
3678
|
+
children: statusVisual.spin ? /* @__PURE__ */ jsx9(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx9(
|
|
2153
3679
|
Icon,
|
|
2154
3680
|
{
|
|
2155
3681
|
name: statusVisual.icon,
|
|
@@ -2159,8 +3685,8 @@ var TransferRow = ({
|
|
|
2159
3685
|
)
|
|
2160
3686
|
}
|
|
2161
3687
|
),
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
3688
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
3689
|
+
/* @__PURE__ */ jsx9(
|
|
2164
3690
|
"p",
|
|
2165
3691
|
{
|
|
2166
3692
|
className: cn(
|
|
@@ -2170,7 +3696,7 @@ var TransferRow = ({
|
|
|
2170
3696
|
children: activity.title
|
|
2171
3697
|
}
|
|
2172
3698
|
),
|
|
2173
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx9(
|
|
2174
3700
|
"p",
|
|
2175
3701
|
{
|
|
2176
3702
|
className: cn(
|
|
@@ -2182,7 +3708,7 @@ var TransferRow = ({
|
|
|
2182
3708
|
)
|
|
2183
3709
|
] })
|
|
2184
3710
|
] }),
|
|
2185
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx9(
|
|
2186
3712
|
AmountTimeStack,
|
|
2187
3713
|
{
|
|
2188
3714
|
amountLabel: activity.amountLabel,
|
|
@@ -2192,7 +3718,7 @@ var TransferRow = ({
|
|
|
2192
3718
|
}
|
|
2193
3719
|
)
|
|
2194
3720
|
] }),
|
|
2195
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsx9(
|
|
2196
3722
|
AmountTimeStack,
|
|
2197
3723
|
{
|
|
2198
3724
|
amountLabel: activity.amountLabel,
|
|
@@ -2220,10 +3746,10 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
2220
3746
|
"before:bg-agg-secondary-hover before:rounded-agg-xl"
|
|
2221
3747
|
);
|
|
2222
3748
|
if (activity.kind === "trade") {
|
|
2223
|
-
return /* @__PURE__ */
|
|
3749
|
+
return /* @__PURE__ */ jsx9(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
|
|
2224
3750
|
}
|
|
2225
3751
|
if (activity.kind === "redeem") {
|
|
2226
|
-
return /* @__PURE__ */
|
|
3752
|
+
return /* @__PURE__ */ jsx9(
|
|
2227
3753
|
RedeemRow,
|
|
2228
3754
|
{
|
|
2229
3755
|
activity,
|
|
@@ -2233,7 +3759,7 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
2233
3759
|
}
|
|
2234
3760
|
);
|
|
2235
3761
|
}
|
|
2236
|
-
return /* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ jsx9(
|
|
2237
3763
|
TransferRow,
|
|
2238
3764
|
{
|
|
2239
3765
|
activity,
|
|
@@ -2246,19 +3772,19 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
2246
3772
|
ActivityRow.displayName = "ActivityRow";
|
|
2247
3773
|
|
|
2248
3774
|
// src/pages/user-profile/components/empty-state.tsx
|
|
2249
|
-
import { jsx as
|
|
3775
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2250
3776
|
var EmptyState = ({ title, description, className }) => {
|
|
2251
|
-
return /* @__PURE__ */
|
|
3777
|
+
return /* @__PURE__ */ jsx10(
|
|
2252
3778
|
"div",
|
|
2253
3779
|
{
|
|
2254
3780
|
className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
|
|
2255
3781
|
role: "status",
|
|
2256
3782
|
"aria-live": "polite",
|
|
2257
|
-
children: /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2261
|
-
description ? /* @__PURE__ */
|
|
3783
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center gap-5", children: [
|
|
3784
|
+
/* @__PURE__ */ jsx10(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
|
|
3785
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
|
|
3786
|
+
/* @__PURE__ */ jsx10("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
|
|
3787
|
+
description ? /* @__PURE__ */ jsx10("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
|
|
2262
3788
|
] })
|
|
2263
3789
|
] })
|
|
2264
3790
|
}
|
|
@@ -2267,8 +3793,12 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
2267
3793
|
EmptyState.displayName = "EmptyState";
|
|
2268
3794
|
|
|
2269
3795
|
// src/pages/user-profile/components/position-row.tsx
|
|
2270
|
-
import { optimizedImageUrl, useLabels as
|
|
2271
|
-
import { Fragment as Fragment3, jsx as
|
|
3796
|
+
import { optimizedImageUrl, useLabels as useLabels6 } from "@agg-build/hooks";
|
|
3797
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3798
|
+
var floorToTwoDecimals = (value) => {
|
|
3799
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
3800
|
+
return Math.trunc(value * 100) / 100;
|
|
3801
|
+
};
|
|
2272
3802
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
2273
3803
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
2274
3804
|
};
|
|
@@ -2277,25 +3807,36 @@ var toneTextClassName = (tone) => {
|
|
|
2277
3807
|
if (tone === "negative") return "text-agg-error";
|
|
2278
3808
|
return "text-agg-muted-foreground";
|
|
2279
3809
|
};
|
|
2280
|
-
var OutcomePill = ({ label }) => /* @__PURE__ */
|
|
2281
|
-
var ResolutionPill = ({ label }) => /* @__PURE__ */
|
|
3810
|
+
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx11("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__ */ jsx11("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
|
|
3811
|
+
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx11("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__ */ jsx11("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
2282
3812
|
var VenueShares = ({
|
|
2283
3813
|
model,
|
|
3814
|
+
totalSharesLabel,
|
|
2284
3815
|
className,
|
|
2285
3816
|
keyPrefix
|
|
2286
3817
|
}) => {
|
|
2287
|
-
if (model.venueShareBreakdown.length === 0) return null;
|
|
2288
|
-
return /* @__PURE__ */
|
|
2289
|
-
"div",
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
3818
|
+
if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
|
|
3819
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn(className, "gap-2"), children: [
|
|
3820
|
+
model.venueShareBreakdown.length > 0 ? /* @__PURE__ */ jsx11("div", { className: "flex items-center gap-1", children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsx11(
|
|
3821
|
+
Tooltip,
|
|
3822
|
+
{
|
|
3823
|
+
content: /* @__PURE__ */ jsx11("span", { children: row.sharesLabel }),
|
|
3824
|
+
"aria-label": `${row.venue} shares`,
|
|
3825
|
+
side: "top",
|
|
3826
|
+
children: /* @__PURE__ */ jsx11(
|
|
3827
|
+
"span",
|
|
3828
|
+
{
|
|
3829
|
+
tabIndex: 0,
|
|
3830
|
+
className: "cursor-help rounded-agg-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
|
|
3831
|
+
"aria-label": `${row.venue} shares`,
|
|
3832
|
+
children: /* @__PURE__ */ jsx11(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
|
|
3833
|
+
}
|
|
3834
|
+
)
|
|
3835
|
+
},
|
|
3836
|
+
`${keyPrefix}-${row.venue}-${String(index)}`
|
|
3837
|
+
)) }) : null,
|
|
3838
|
+
totalSharesLabel ? /* @__PURE__ */ jsx11("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
|
|
3839
|
+
] });
|
|
2299
3840
|
};
|
|
2300
3841
|
var StatusBadge = ({
|
|
2301
3842
|
status,
|
|
@@ -2303,7 +3844,7 @@ var StatusBadge = ({
|
|
|
2303
3844
|
}) => {
|
|
2304
3845
|
if (status === "lost" || status === "won_claimed") return null;
|
|
2305
3846
|
const isWon = status === "won_unclaimed";
|
|
2306
|
-
return /* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ jsxs10(
|
|
2307
3848
|
"span",
|
|
2308
3849
|
{
|
|
2309
3850
|
className: cn(
|
|
@@ -2312,7 +3853,7 @@ var StatusBadge = ({
|
|
|
2312
3853
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
2313
3854
|
),
|
|
2314
3855
|
children: [
|
|
2315
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsx11(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
2316
3857
|
isWon ? labels.won : labels.open
|
|
2317
3858
|
]
|
|
2318
3859
|
}
|
|
@@ -2325,7 +3866,7 @@ var ResultBadge = ({
|
|
|
2325
3866
|
if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
|
|
2326
3867
|
const isWon = status === "won_claimed";
|
|
2327
3868
|
const isSold = status === "sold";
|
|
2328
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsxs10(
|
|
2329
3870
|
"span",
|
|
2330
3871
|
{
|
|
2331
3872
|
className: cn(
|
|
@@ -2334,7 +3875,7 @@ var ResultBadge = ({
|
|
|
2334
3875
|
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"
|
|
2335
3876
|
),
|
|
2336
3877
|
children: [
|
|
2337
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ jsx11(
|
|
2338
3879
|
Icon,
|
|
2339
3880
|
{
|
|
2340
3881
|
name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
|
|
@@ -2350,27 +3891,27 @@ var ResultBadge = ({
|
|
|
2350
3891
|
var TotalTradedCell = ({
|
|
2351
3892
|
model,
|
|
2352
3893
|
className
|
|
2353
|
-
}) => /* @__PURE__ */
|
|
3894
|
+
}) => /* @__PURE__ */ jsxs10(
|
|
2354
3895
|
"div",
|
|
2355
3896
|
{
|
|
2356
3897
|
className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
2357
3898
|
children: [
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
3900
|
+
/* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
2360
3901
|
]
|
|
2361
3902
|
}
|
|
2362
3903
|
);
|
|
2363
3904
|
var PositionValueCell = ({
|
|
2364
3905
|
value,
|
|
2365
3906
|
className
|
|
2366
|
-
}) => /* @__PURE__ */
|
|
3907
|
+
}) => /* @__PURE__ */ jsxs10(
|
|
2367
3908
|
"div",
|
|
2368
3909
|
{
|
|
2369
3910
|
className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
2370
3911
|
children: [
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
3912
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-baseline gap-1.5", children: [
|
|
3913
|
+
/* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
|
|
3914
|
+
/* @__PURE__ */ jsx11(
|
|
2374
3915
|
"p",
|
|
2375
3916
|
{
|
|
2376
3917
|
className: cn(
|
|
@@ -2381,9 +3922,9 @@ var PositionValueCell = ({
|
|
|
2381
3922
|
}
|
|
2382
3923
|
)
|
|
2383
3924
|
] }),
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
3925
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-baseline gap-1.5", children: [
|
|
3926
|
+
/* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
|
|
3927
|
+
/* @__PURE__ */ jsx11(
|
|
2387
3928
|
"p",
|
|
2388
3929
|
{
|
|
2389
3930
|
className: cn(
|
|
@@ -2405,13 +3946,14 @@ var PositionRow = ({
|
|
|
2405
3946
|
onClaim,
|
|
2406
3947
|
isClaiming = false
|
|
2407
3948
|
}) => {
|
|
2408
|
-
const labels =
|
|
3949
|
+
const labels = useLabels6().userProfile.positions;
|
|
2409
3950
|
const model = toPositionRowViewModel(position, {
|
|
2410
3951
|
avgPrefix: labels.avgPrefix,
|
|
2411
3952
|
nowPrefix: labels.nowPrefix,
|
|
2412
3953
|
finalPrefix: labels.finalPrefix
|
|
2413
3954
|
});
|
|
2414
3955
|
const isClosed = (variant != null ? variant : model.bucket) === "closed";
|
|
3956
|
+
const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
|
|
2415
3957
|
const handleClaim = (event) => {
|
|
2416
3958
|
event.preventDefault();
|
|
2417
3959
|
event.stopPropagation();
|
|
@@ -2446,7 +3988,7 @@ var PositionRow = ({
|
|
|
2446
3988
|
handleDivClick();
|
|
2447
3989
|
}
|
|
2448
3990
|
};
|
|
2449
|
-
return /* @__PURE__ */
|
|
3991
|
+
return /* @__PURE__ */ jsx11(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs10(
|
|
2450
3992
|
"div",
|
|
2451
3993
|
{
|
|
2452
3994
|
className: cn(
|
|
@@ -2454,9 +3996,9 @@ var PositionRow = ({
|
|
|
2454
3996
|
isClosed ? "md:gap-8" : "md:gap-6"
|
|
2455
3997
|
),
|
|
2456
3998
|
children: [
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
/* @__PURE__ */
|
|
3999
|
+
/* @__PURE__ */ jsxs10("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: [
|
|
4000
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
|
|
4001
|
+
/* @__PURE__ */ jsx11("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx11(
|
|
2460
4002
|
RemoteImage,
|
|
2461
4003
|
{
|
|
2462
4004
|
src: optimizedImageUrl(model.thumbnailSrc, 60),
|
|
@@ -2464,14 +4006,15 @@ var PositionRow = ({
|
|
|
2464
4006
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
2465
4007
|
}
|
|
2466
4008
|
) }),
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
/* @__PURE__ */
|
|
4009
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
4010
|
+
/* @__PURE__ */ jsx11("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 }),
|
|
4011
|
+
/* @__PURE__ */ jsxs10("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
|
|
4012
|
+
/* @__PURE__ */ jsx11(OutcomePill, { label: model.selectedOutcomeLabel }),
|
|
4013
|
+
/* @__PURE__ */ jsx11(
|
|
2472
4014
|
VenueShares,
|
|
2473
4015
|
{
|
|
2474
4016
|
model,
|
|
4017
|
+
totalSharesLabel,
|
|
2475
4018
|
keyPrefix: "desktop",
|
|
2476
4019
|
className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
|
|
2477
4020
|
}
|
|
@@ -2479,25 +4022,26 @@ var PositionRow = ({
|
|
|
2479
4022
|
] })
|
|
2480
4023
|
] })
|
|
2481
4024
|
] }),
|
|
2482
|
-
/* @__PURE__ */
|
|
4025
|
+
/* @__PURE__ */ jsx11("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx11(OutcomePill, { label: model.selectedOutcomeLabel }) })
|
|
2483
4026
|
] }),
|
|
2484
|
-
isClosed ? /* @__PURE__ */
|
|
2485
|
-
/* @__PURE__ */
|
|
4027
|
+
isClosed ? /* @__PURE__ */ jsx11("div", { className: "md:hidden", children: /* @__PURE__ */ jsx11(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
|
|
4028
|
+
/* @__PURE__ */ jsx11(
|
|
2486
4029
|
VenueShares,
|
|
2487
4030
|
{
|
|
2488
4031
|
model,
|
|
4032
|
+
totalSharesLabel,
|
|
2489
4033
|
keyPrefix: "mobile",
|
|
2490
4034
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
2491
4035
|
}
|
|
2492
4036
|
),
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2496
|
-
/* @__PURE__ */
|
|
4037
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
|
|
4038
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-5", children: [
|
|
4039
|
+
/* @__PURE__ */ jsx11(TotalTradedCell, { model }),
|
|
4040
|
+
/* @__PURE__ */ jsx11(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
|
|
2497
4041
|
] }),
|
|
2498
|
-
isClosed ? /* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2500
|
-
model.canClaim ? /* @__PURE__ */
|
|
4042
|
+
isClosed ? /* @__PURE__ */ jsx11(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
|
|
4043
|
+
/* @__PURE__ */ jsx11(StatusBadge, { status: model.positionStatus, labels }),
|
|
4044
|
+
model.canClaim ? /* @__PURE__ */ jsxs10(
|
|
2501
4045
|
"button",
|
|
2502
4046
|
{
|
|
2503
4047
|
type: "button",
|
|
@@ -2506,48 +4050,48 @@ var PositionRow = ({
|
|
|
2506
4050
|
disabled: isClaiming,
|
|
2507
4051
|
"aria-busy": isClaiming || void 0,
|
|
2508
4052
|
children: [
|
|
2509
|
-
isClaiming ? /* @__PURE__ */
|
|
4053
|
+
isClaiming ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
2510
4054
|
labels.claim
|
|
2511
4055
|
]
|
|
2512
4056
|
}
|
|
2513
4057
|
) : null
|
|
2514
4058
|
] })
|
|
2515
4059
|
] }),
|
|
2516
|
-
isClosed ? /* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
4060
|
+
isClosed ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
4061
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx11(ResolutionPill, { label: model.resolutionLabel }) }),
|
|
4062
|
+
/* @__PURE__ */ jsx11(
|
|
2519
4063
|
TotalTradedCell,
|
|
2520
4064
|
{
|
|
2521
4065
|
model,
|
|
2522
4066
|
className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
|
|
2523
4067
|
}
|
|
2524
4068
|
),
|
|
2525
|
-
/* @__PURE__ */
|
|
4069
|
+
/* @__PURE__ */ jsx11(
|
|
2526
4070
|
PositionValueCell,
|
|
2527
4071
|
{
|
|
2528
4072
|
value: model.payout,
|
|
2529
4073
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
2530
4074
|
}
|
|
2531
4075
|
),
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
] }) : /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
4076
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx11(ResultBadge, { status: model.positionStatus, labels }) })
|
|
4077
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
4078
|
+
/* @__PURE__ */ jsx11(
|
|
2535
4079
|
TotalTradedCell,
|
|
2536
4080
|
{
|
|
2537
4081
|
model,
|
|
2538
4082
|
className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
|
|
2539
4083
|
}
|
|
2540
4084
|
),
|
|
2541
|
-
/* @__PURE__ */
|
|
4085
|
+
/* @__PURE__ */ jsx11(
|
|
2542
4086
|
PositionValueCell,
|
|
2543
4087
|
{
|
|
2544
4088
|
value: model.currentValue,
|
|
2545
4089
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
2546
4090
|
}
|
|
2547
4091
|
),
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2550
|
-
model.canClaim ? /* @__PURE__ */
|
|
4092
|
+
/* @__PURE__ */ jsxs10("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
4093
|
+
/* @__PURE__ */ jsx11(StatusBadge, { status: model.positionStatus, labels }),
|
|
4094
|
+
model.canClaim ? /* @__PURE__ */ jsxs10(
|
|
2551
4095
|
"button",
|
|
2552
4096
|
{
|
|
2553
4097
|
type: "button",
|
|
@@ -2556,14 +4100,14 @@ var PositionRow = ({
|
|
|
2556
4100
|
disabled: isClaiming,
|
|
2557
4101
|
"aria-busy": isClaiming || void 0,
|
|
2558
4102
|
children: [
|
|
2559
|
-
isClaiming ? /* @__PURE__ */
|
|
4103
|
+
isClaiming ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
2560
4104
|
labels.claim
|
|
2561
4105
|
]
|
|
2562
4106
|
}
|
|
2563
4107
|
) : null
|
|
2564
4108
|
] })
|
|
2565
4109
|
] }),
|
|
2566
|
-
/* @__PURE__ */
|
|
4110
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx11(
|
|
2567
4111
|
Icon,
|
|
2568
4112
|
{
|
|
2569
4113
|
name: "chevron-right",
|
|
@@ -2578,16 +4122,16 @@ var PositionRow = ({
|
|
|
2578
4122
|
PositionRow.displayName = "PositionRow";
|
|
2579
4123
|
|
|
2580
4124
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
2581
|
-
import { Fragment as Fragment5, jsx as
|
|
4125
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2582
4126
|
var tabItems = [
|
|
2583
4127
|
{ value: USER_PROFILE_TAB_POSITIONS, label: "Positions" },
|
|
2584
4128
|
// Open orders is intentionally hidden from the user-profile tab group.
|
|
2585
4129
|
// Restore by re-adding USER_PROFILE_TAB_OPEN_ORDERS here and the renderer below.
|
|
2586
4130
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
|
|
2587
4131
|
];
|
|
2588
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
index < acc.length - 1 ? /* @__PURE__ */
|
|
4132
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx12("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
4133
|
+
/* @__PURE__ */ jsx12("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
4134
|
+
index < acc.length - 1 ? /* @__PURE__ */ jsx12("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
2591
4135
|
] }, index)) });
|
|
2592
4136
|
var PositionsActivity = ({
|
|
2593
4137
|
activePositions = [],
|
|
@@ -2618,9 +4162,9 @@ var PositionsActivity = ({
|
|
|
2618
4162
|
initialPositionFilter = "active",
|
|
2619
4163
|
className
|
|
2620
4164
|
}) => {
|
|
2621
|
-
const positionsLabels =
|
|
4165
|
+
const positionsLabels = useLabels7().userProfile.positions;
|
|
2622
4166
|
const isTabControlled = tab !== void 0;
|
|
2623
|
-
const [internalActiveTab, setInternalActiveTab] =
|
|
4167
|
+
const [internalActiveTab, setInternalActiveTab] = useState10(
|
|
2624
4168
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
2625
4169
|
);
|
|
2626
4170
|
const activeTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -2628,19 +4172,19 @@ var PositionsActivity = ({
|
|
|
2628
4172
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
2629
4173
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
2630
4174
|
};
|
|
2631
|
-
const [positionFilter, setPositionFilter] =
|
|
2632
|
-
const [searchValue, setSearchValue] =
|
|
2633
|
-
const [isSearchFocused, setIsSearchFocused] =
|
|
2634
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] =
|
|
4175
|
+
const [positionFilter, setPositionFilter] = useState10(initialPositionFilter);
|
|
4176
|
+
const [searchValue, setSearchValue] = useState10("");
|
|
4177
|
+
const [isSearchFocused, setIsSearchFocused] = useState10(false);
|
|
4178
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState10(
|
|
2635
4179
|
() => /* @__PURE__ */ new Set()
|
|
2636
4180
|
);
|
|
2637
|
-
const positionsLoadMoreRef =
|
|
2638
|
-
const activitiesLoadMoreRef =
|
|
2639
|
-
const rowsScrollRef =
|
|
4181
|
+
const positionsLoadMoreRef = useRef8(null);
|
|
4182
|
+
const activitiesLoadMoreRef = useRef8(null);
|
|
4183
|
+
const rowsScrollRef = useRef8(null);
|
|
2640
4184
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
2641
4185
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
2642
4186
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
2643
|
-
const positionsForCurrentFilter =
|
|
4187
|
+
const positionsForCurrentFilter = useMemo6(() => {
|
|
2644
4188
|
if (positionFilter === "active") {
|
|
2645
4189
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
2646
4190
|
}
|
|
@@ -2657,7 +4201,7 @@ var PositionsActivity = ({
|
|
|
2657
4201
|
}
|
|
2658
4202
|
return Array.from(byId.values());
|
|
2659
4203
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
2660
|
-
const filteredPositions =
|
|
4204
|
+
const filteredPositions = useMemo6(() => {
|
|
2661
4205
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
2662
4206
|
const q = searchValue.toLowerCase();
|
|
2663
4207
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -2682,7 +4226,7 @@ var PositionsActivity = ({
|
|
|
2682
4226
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
2683
4227
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
2684
4228
|
const filteredActivities = activities;
|
|
2685
|
-
const searchResults =
|
|
4229
|
+
const searchResults = useMemo6(() => {
|
|
2686
4230
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
2687
4231
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
2688
4232
|
id: position.id,
|
|
@@ -2700,11 +4244,11 @@ var PositionsActivity = ({
|
|
|
2700
4244
|
const handleSearchChange = (event) => {
|
|
2701
4245
|
setSearchValue(event.target.value);
|
|
2702
4246
|
};
|
|
2703
|
-
|
|
4247
|
+
useEffect9(() => {
|
|
2704
4248
|
if (isPositionsTab) return;
|
|
2705
4249
|
setIsSearchFocused(false);
|
|
2706
4250
|
}, [isPositionsTab]);
|
|
2707
|
-
|
|
4251
|
+
useEffect9(() => {
|
|
2708
4252
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
2709
4253
|
const target = positionsLoadMoreRef.current;
|
|
2710
4254
|
if (!target || !loadMorePositions) return;
|
|
@@ -2726,7 +4270,7 @@ var PositionsActivity = ({
|
|
|
2726
4270
|
isPositionsTab,
|
|
2727
4271
|
loadMorePositions
|
|
2728
4272
|
]);
|
|
2729
|
-
|
|
4273
|
+
useEffect9(() => {
|
|
2730
4274
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
2731
4275
|
const target = activitiesLoadMoreRef.current;
|
|
2732
4276
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -2748,7 +4292,7 @@ var PositionsActivity = ({
|
|
|
2748
4292
|
isLoadingMoreActivities,
|
|
2749
4293
|
onLoadMoreActivities
|
|
2750
4294
|
]);
|
|
2751
|
-
return /* @__PURE__ */
|
|
4295
|
+
return /* @__PURE__ */ jsxs11(
|
|
2752
4296
|
"div",
|
|
2753
4297
|
{
|
|
2754
4298
|
className: cn(
|
|
@@ -2757,7 +4301,7 @@ var PositionsActivity = ({
|
|
|
2757
4301
|
className
|
|
2758
4302
|
),
|
|
2759
4303
|
children: [
|
|
2760
|
-
/* @__PURE__ */
|
|
4304
|
+
/* @__PURE__ */ jsx12(
|
|
2761
4305
|
Tabs,
|
|
2762
4306
|
{
|
|
2763
4307
|
items: tabItems,
|
|
@@ -2771,7 +4315,7 @@ var PositionsActivity = ({
|
|
|
2771
4315
|
}
|
|
2772
4316
|
}
|
|
2773
4317
|
),
|
|
2774
|
-
/* @__PURE__ */
|
|
4318
|
+
/* @__PURE__ */ jsxs11(
|
|
2775
4319
|
"div",
|
|
2776
4320
|
{
|
|
2777
4321
|
className: cn(
|
|
@@ -2779,12 +4323,12 @@ var PositionsActivity = ({
|
|
|
2779
4323
|
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
2780
4324
|
),
|
|
2781
4325
|
children: [
|
|
2782
|
-
isPositionsTab ? /* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
4326
|
+
isPositionsTab ? /* @__PURE__ */ jsxs11("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
|
|
4327
|
+
/* @__PURE__ */ jsx12("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) => {
|
|
2784
4328
|
const isActive = filter.value === positionFilter;
|
|
2785
|
-
return /* @__PURE__ */
|
|
2786
|
-
idx > 0 ? /* @__PURE__ */
|
|
2787
|
-
/* @__PURE__ */
|
|
4329
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-1 items-stretch", children: [
|
|
4330
|
+
idx > 0 ? /* @__PURE__ */ jsx12("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
4331
|
+
/* @__PURE__ */ jsx12(
|
|
2788
4332
|
"button",
|
|
2789
4333
|
{
|
|
2790
4334
|
type: "button",
|
|
@@ -2799,7 +4343,7 @@ var PositionsActivity = ({
|
|
|
2799
4343
|
)
|
|
2800
4344
|
] }, filter.value);
|
|
2801
4345
|
}) }),
|
|
2802
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsxs11(
|
|
2803
4347
|
"div",
|
|
2804
4348
|
{
|
|
2805
4349
|
className: "agg-position-search relative flex w-full min-w-0 flex-1",
|
|
@@ -2810,9 +4354,9 @@ var PositionsActivity = ({
|
|
|
2810
4354
|
setIsSearchFocused(false);
|
|
2811
4355
|
},
|
|
2812
4356
|
children: [
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx12("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs11("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: [
|
|
4358
|
+
/* @__PURE__ */ jsx12(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
|
|
4359
|
+
/* @__PURE__ */ jsx12(
|
|
2816
4360
|
"input",
|
|
2817
4361
|
{
|
|
2818
4362
|
value: searchValue,
|
|
@@ -2827,7 +4371,7 @@ var PositionsActivity = ({
|
|
|
2827
4371
|
}
|
|
2828
4372
|
)
|
|
2829
4373
|
] }) }),
|
|
2830
|
-
isSearchFocused && searchValue.trim() ? /* @__PURE__ */
|
|
4374
|
+
isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx12("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__ */ jsx12(
|
|
2831
4375
|
"ul",
|
|
2832
4376
|
{
|
|
2833
4377
|
className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
|
|
@@ -2840,9 +4384,9 @@ var PositionsActivity = ({
|
|
|
2840
4384
|
setIsSearchFocused(false);
|
|
2841
4385
|
onPositionClick == null ? void 0 : onPositionClick(item.raw);
|
|
2842
4386
|
};
|
|
2843
|
-
const innerContent = /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
4387
|
+
const innerContent = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
4388
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
4389
|
+
/* @__PURE__ */ jsx12(
|
|
2846
4390
|
"img",
|
|
2847
4391
|
{
|
|
2848
4392
|
src: optimizedImageUrl2(item.thumbnailSrc, 48),
|
|
@@ -2850,16 +4394,16 @@ var PositionsActivity = ({
|
|
|
2850
4394
|
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
2851
4395
|
}
|
|
2852
4396
|
),
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
4397
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
4398
|
+
/* @__PURE__ */ jsx12("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 }),
|
|
4399
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
|
|
4400
|
+
/* @__PURE__ */ jsx12("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 }),
|
|
4401
|
+
/* @__PURE__ */ jsx12("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
|
|
4402
|
+
/* @__PURE__ */ jsx12("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 })
|
|
2859
4403
|
] })
|
|
2860
4404
|
] })
|
|
2861
4405
|
] }),
|
|
2862
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsx12(
|
|
2863
4407
|
Icon,
|
|
2864
4408
|
{
|
|
2865
4409
|
name: "chevron-right",
|
|
@@ -2868,7 +4412,7 @@ var PositionsActivity = ({
|
|
|
2868
4412
|
}
|
|
2869
4413
|
)
|
|
2870
4414
|
] });
|
|
2871
|
-
return /* @__PURE__ */
|
|
4415
|
+
return /* @__PURE__ */ jsx12(
|
|
2872
4416
|
"li",
|
|
2873
4417
|
{
|
|
2874
4418
|
role: "presentation",
|
|
@@ -2876,7 +4420,7 @@ var PositionsActivity = ({
|
|
|
2876
4420
|
"agg-position-search-result-item",
|
|
2877
4421
|
index > 0 && "border-t border-agg-separator"
|
|
2878
4422
|
),
|
|
2879
|
-
children: itemHref ? /* @__PURE__ */
|
|
4423
|
+
children: itemHref ? /* @__PURE__ */ jsx12(
|
|
2880
4424
|
"a",
|
|
2881
4425
|
{
|
|
2882
4426
|
href: itemHref,
|
|
@@ -2891,7 +4435,7 @@ var PositionsActivity = ({
|
|
|
2891
4435
|
},
|
|
2892
4436
|
children: innerContent
|
|
2893
4437
|
}
|
|
2894
|
-
) : /* @__PURE__ */
|
|
4438
|
+
) : /* @__PURE__ */ jsx12(
|
|
2895
4439
|
"button",
|
|
2896
4440
|
{
|
|
2897
4441
|
type: "button",
|
|
@@ -2905,34 +4449,34 @@ var PositionsActivity = ({
|
|
|
2905
4449
|
);
|
|
2906
4450
|
})
|
|
2907
4451
|
}
|
|
2908
|
-
) : /* @__PURE__ */
|
|
4452
|
+
) : /* @__PURE__ */ jsx12("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
|
|
2909
4453
|
]
|
|
2910
4454
|
}
|
|
2911
4455
|
)
|
|
2912
4456
|
] }) : null,
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
/* @__PURE__ */
|
|
2915
|
-
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
] }) : /* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */
|
|
4457
|
+
/* @__PURE__ */ jsxs11("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
|
|
4458
|
+
/* @__PURE__ */ jsxs11("div", { className: "w-full px-4 sm:px-6", children: [
|
|
4459
|
+
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
|
|
4460
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
4461
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
|
|
4462
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
|
|
4463
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
|
|
4464
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
|
|
4465
|
+
/* @__PURE__ */ jsx12("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
4466
|
+
] }) : /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
4467
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
4468
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
|
|
4469
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
|
|
4470
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
|
|
4471
|
+
/* @__PURE__ */ jsx12("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
2928
4472
|
] }) : null,
|
|
2929
|
-
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */
|
|
2930
|
-
/* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2932
|
-
/* @__PURE__ */
|
|
4473
|
+
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
4474
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
|
|
4475
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
4476
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
|
|
2933
4477
|
] }) : null
|
|
2934
4478
|
] }),
|
|
2935
|
-
/* @__PURE__ */
|
|
4479
|
+
/* @__PURE__ */ jsx12(
|
|
2936
4480
|
"div",
|
|
2937
4481
|
{
|
|
2938
4482
|
ref: rowsScrollRef,
|
|
@@ -2944,8 +4488,8 @@ var PositionsActivity = ({
|
|
|
2944
4488
|
"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
|
|
2945
4489
|
"[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
|
|
2946
4490
|
),
|
|
2947
|
-
children: isPositionsTab ? /* @__PURE__ */
|
|
2948
|
-
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */
|
|
4491
|
+
children: isPositionsTab ? /* @__PURE__ */ jsxs11("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
|
|
4492
|
+
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx12(
|
|
2949
4493
|
EmptyState,
|
|
2950
4494
|
{
|
|
2951
4495
|
title: "Unable to load positions",
|
|
@@ -2953,15 +4497,15 @@ var PositionsActivity = ({
|
|
|
2953
4497
|
}
|
|
2954
4498
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
2955
4499
|
var _a;
|
|
2956
|
-
return /* @__PURE__ */
|
|
2957
|
-
index > 0 ? /* @__PURE__ */
|
|
4500
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
4501
|
+
index > 0 ? /* @__PURE__ */ jsx12(
|
|
2958
4502
|
"div",
|
|
2959
4503
|
{
|
|
2960
4504
|
className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
|
|
2961
4505
|
"aria-hidden": true
|
|
2962
4506
|
}
|
|
2963
4507
|
) : null,
|
|
2964
|
-
/* @__PURE__ */
|
|
4508
|
+
/* @__PURE__ */ jsx12(
|
|
2965
4509
|
PositionRow,
|
|
2966
4510
|
{
|
|
2967
4511
|
position,
|
|
@@ -2975,15 +4519,15 @@ var PositionsActivity = ({
|
|
|
2975
4519
|
}
|
|
2976
4520
|
)
|
|
2977
4521
|
] }, position.id);
|
|
2978
|
-
}) : /* @__PURE__ */
|
|
4522
|
+
}) : /* @__PURE__ */ jsx12(
|
|
2979
4523
|
EmptyState,
|
|
2980
4524
|
{
|
|
2981
4525
|
title: "No positions yet",
|
|
2982
4526
|
description: "Your open trades will appear here once you place an order."
|
|
2983
4527
|
}
|
|
2984
4528
|
),
|
|
2985
|
-
isLoadingMorePositions ? /* @__PURE__ */
|
|
2986
|
-
hasMorePositions ? /* @__PURE__ */
|
|
4529
|
+
isLoadingMorePositions ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
|
|
4530
|
+
hasMorePositions ? /* @__PURE__ */ jsx12(
|
|
2987
4531
|
"div",
|
|
2988
4532
|
{
|
|
2989
4533
|
ref: positionsLoadMoreRef,
|
|
@@ -2991,22 +4535,22 @@ var PositionsActivity = ({
|
|
|
2991
4535
|
"aria-hidden": true
|
|
2992
4536
|
}
|
|
2993
4537
|
) : null
|
|
2994
|
-
] }) : /* @__PURE__ */
|
|
2995
|
-
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */
|
|
4538
|
+
] }) : /* @__PURE__ */ jsxs11("div", { className: "agg-activity-list flex flex-col gap-5", children: [
|
|
4539
|
+
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx12(
|
|
2996
4540
|
EmptyState,
|
|
2997
4541
|
{
|
|
2998
4542
|
title: "Unable to load activity",
|
|
2999
4543
|
description: "Please try again in a moment."
|
|
3000
4544
|
}
|
|
3001
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */
|
|
3002
|
-
index > 0 ? /* @__PURE__ */
|
|
4545
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
4546
|
+
index > 0 ? /* @__PURE__ */ jsx12(
|
|
3003
4547
|
"div",
|
|
3004
4548
|
{
|
|
3005
4549
|
className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
|
|
3006
4550
|
"aria-hidden": true
|
|
3007
4551
|
}
|
|
3008
4552
|
) : null,
|
|
3009
|
-
/* @__PURE__ */
|
|
4553
|
+
/* @__PURE__ */ jsx12(
|
|
3010
4554
|
ActivityRow,
|
|
3011
4555
|
{
|
|
3012
4556
|
activity,
|
|
@@ -3014,15 +4558,15 @@ var PositionsActivity = ({
|
|
|
3014
4558
|
onClick: onActivityClick
|
|
3015
4559
|
}
|
|
3016
4560
|
)
|
|
3017
|
-
] }, activity.id)) : /* @__PURE__ */
|
|
4561
|
+
] }, activity.id)) : /* @__PURE__ */ jsx12(
|
|
3018
4562
|
EmptyState,
|
|
3019
4563
|
{
|
|
3020
4564
|
title: "No activity yet",
|
|
3021
4565
|
description: "Your trading activity will appear here."
|
|
3022
4566
|
}
|
|
3023
4567
|
),
|
|
3024
|
-
isLoadingMoreActivities ? /* @__PURE__ */
|
|
3025
|
-
hasMoreActivities ? /* @__PURE__ */
|
|
4568
|
+
isLoadingMoreActivities ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
|
|
4569
|
+
hasMoreActivities ? /* @__PURE__ */ jsx12(
|
|
3026
4570
|
"div",
|
|
3027
4571
|
{
|
|
3028
4572
|
ref: activitiesLoadMoreRef,
|
|
@@ -3044,14 +4588,14 @@ var PositionsActivity = ({
|
|
|
3044
4588
|
PositionsActivity.displayName = "PositionsActivity";
|
|
3045
4589
|
|
|
3046
4590
|
// src/pages/user-profile/components/positions-value-card.tsx
|
|
3047
|
-
import { jsx as
|
|
4591
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3048
4592
|
var PositionsValueCard = ({
|
|
3049
4593
|
label = "Positions Value",
|
|
3050
4594
|
valueLabel,
|
|
3051
4595
|
isLoading = false,
|
|
3052
4596
|
className
|
|
3053
4597
|
}) => {
|
|
3054
|
-
return /* @__PURE__ */
|
|
4598
|
+
return /* @__PURE__ */ jsxs12(
|
|
3055
4599
|
"div",
|
|
3056
4600
|
{
|
|
3057
4601
|
className: cn(
|
|
@@ -3060,8 +4604,8 @@ var PositionsValueCard = ({
|
|
|
3060
4604
|
className
|
|
3061
4605
|
),
|
|
3062
4606
|
children: [
|
|
3063
|
-
/* @__PURE__ */
|
|
3064
|
-
/* @__PURE__ */
|
|
4607
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
4608
|
+
/* @__PURE__ */ jsx13(
|
|
3065
4609
|
"svg",
|
|
3066
4610
|
{
|
|
3067
4611
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3069,7 +4613,7 @@ var PositionsValueCard = ({
|
|
|
3069
4613
|
height: "16",
|
|
3070
4614
|
viewBox: "0 0 16 16",
|
|
3071
4615
|
fill: "none",
|
|
3072
|
-
children: /* @__PURE__ */
|
|
4616
|
+
children: /* @__PURE__ */ jsx13(
|
|
3073
4617
|
"path",
|
|
3074
4618
|
{
|
|
3075
4619
|
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",
|
|
@@ -3078,9 +4622,9 @@ var PositionsValueCard = ({
|
|
|
3078
4622
|
)
|
|
3079
4623
|
}
|
|
3080
4624
|
),
|
|
3081
|
-
/* @__PURE__ */
|
|
4625
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
3082
4626
|
] }),
|
|
3083
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__PURE__ */ jsx13("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx13("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx13(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
|
|
3084
4628
|
]
|
|
3085
4629
|
}
|
|
3086
4630
|
);
|
|
@@ -3088,12 +4632,12 @@ var PositionsValueCard = ({
|
|
|
3088
4632
|
PositionsValueCard.displayName = "PositionsValueCard";
|
|
3089
4633
|
|
|
3090
4634
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
3091
|
-
import { optimizedImageUrl as optimizedImageUrl3, useLabels as
|
|
4635
|
+
import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
3092
4636
|
|
|
3093
4637
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
3094
|
-
import { jsx as
|
|
4638
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3095
4639
|
var DefaultAvatar = ({ className }) => {
|
|
3096
|
-
return /* @__PURE__ */
|
|
4640
|
+
return /* @__PURE__ */ jsxs13(
|
|
3097
4641
|
"svg",
|
|
3098
4642
|
{
|
|
3099
4643
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3104,15 +4648,15 @@ var DefaultAvatar = ({ className }) => {
|
|
|
3104
4648
|
className: cn("shrink-0 text-agg-muted-foreground", className),
|
|
3105
4649
|
"aria-hidden": true,
|
|
3106
4650
|
children: [
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsxs13("g", { clipPath: "url(#clip0_default_avatar)", children: [
|
|
4652
|
+
/* @__PURE__ */ jsx14(
|
|
3109
4653
|
"path",
|
|
3110
4654
|
{
|
|
3111
4655
|
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",
|
|
3112
4656
|
fill: "var(--agg-color-secondary-hover)"
|
|
3113
4657
|
}
|
|
3114
4658
|
),
|
|
3115
|
-
/* @__PURE__ */
|
|
4659
|
+
/* @__PURE__ */ jsx14(
|
|
3116
4660
|
"path",
|
|
3117
4661
|
{
|
|
3118
4662
|
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",
|
|
@@ -3120,7 +4664,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
3120
4664
|
fillOpacity: "0.12"
|
|
3121
4665
|
}
|
|
3122
4666
|
),
|
|
3123
|
-
/* @__PURE__ */
|
|
4667
|
+
/* @__PURE__ */ jsx14(
|
|
3124
4668
|
"path",
|
|
3125
4669
|
{
|
|
3126
4670
|
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",
|
|
@@ -3129,7 +4673,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
3129
4673
|
}
|
|
3130
4674
|
)
|
|
3131
4675
|
] }),
|
|
3132
|
-
/* @__PURE__ */
|
|
4676
|
+
/* @__PURE__ */ jsx14("defs", { children: /* @__PURE__ */ jsx14("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx14("rect", { width: "120", height: "120", fill: "white" }) }) })
|
|
3133
4677
|
]
|
|
3134
4678
|
}
|
|
3135
4679
|
);
|
|
@@ -3137,7 +4681,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
3137
4681
|
DefaultAvatar.displayName = "DefaultAvatar";
|
|
3138
4682
|
|
|
3139
4683
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
3140
|
-
import { jsx as
|
|
4684
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3141
4685
|
var UserInfoCard = ({
|
|
3142
4686
|
user,
|
|
3143
4687
|
onEditProfile,
|
|
@@ -3147,10 +4691,10 @@ var UserInfoCard = ({
|
|
|
3147
4691
|
className
|
|
3148
4692
|
}) => {
|
|
3149
4693
|
var _a;
|
|
3150
|
-
const labels =
|
|
4694
|
+
const labels = useLabels8();
|
|
3151
4695
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
3152
4696
|
const hasWallets = wallets.length > 0;
|
|
3153
|
-
return /* @__PURE__ */
|
|
4697
|
+
return /* @__PURE__ */ jsxs14(
|
|
3154
4698
|
"div",
|
|
3155
4699
|
{
|
|
3156
4700
|
className: cn(
|
|
@@ -3159,26 +4703,26 @@ var UserInfoCard = ({
|
|
|
3159
4703
|
className
|
|
3160
4704
|
),
|
|
3161
4705
|
children: [
|
|
3162
|
-
/* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsxs14("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
|
|
4707
|
+
/* @__PURE__ */ jsx15("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx15(
|
|
3164
4708
|
RemoteImage,
|
|
3165
4709
|
{
|
|
3166
4710
|
src: optimizedImageUrl3(user.avatarUrl, 120),
|
|
3167
4711
|
alt: user.username,
|
|
3168
4712
|
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
3169
4713
|
}
|
|
3170
|
-
) : /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3173
|
-
/* @__PURE__ */
|
|
3174
|
-
/* @__PURE__ */
|
|
3175
|
-
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */
|
|
4714
|
+
) : /* @__PURE__ */ jsx15(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
|
|
4715
|
+
/* @__PURE__ */ jsxs14("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
|
|
4716
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
|
|
4717
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4718
|
+
/* @__PURE__ */ jsx15("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
|
|
4719
|
+
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx15("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
|
|
3176
4720
|
const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
|
|
3177
|
-
const iconNode = /* @__PURE__ */
|
|
4721
|
+
const iconNode = /* @__PURE__ */ jsx15("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__ */ jsx15(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
|
|
3178
4722
|
if (!social.handle) {
|
|
3179
|
-
return /* @__PURE__ */
|
|
4723
|
+
return /* @__PURE__ */ jsx15("span", { children: iconNode }, `${social.platform}-icon`);
|
|
3180
4724
|
}
|
|
3181
|
-
return /* @__PURE__ */
|
|
4725
|
+
return /* @__PURE__ */ jsx15(
|
|
3182
4726
|
"a",
|
|
3183
4727
|
{
|
|
3184
4728
|
href: social.handle,
|
|
@@ -3191,55 +4735,55 @@ var UserInfoCard = ({
|
|
|
3191
4735
|
);
|
|
3192
4736
|
}) }) : null
|
|
3193
4737
|
] }),
|
|
3194
|
-
onEditProfile ? /* @__PURE__ */
|
|
4738
|
+
onEditProfile ? /* @__PURE__ */ jsxs14(
|
|
3195
4739
|
"button",
|
|
3196
4740
|
{
|
|
3197
4741
|
type: "button",
|
|
3198
4742
|
onClick: onEditProfile,
|
|
3199
4743
|
className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
|
|
3200
4744
|
children: [
|
|
3201
|
-
/* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
4745
|
+
/* @__PURE__ */ jsx15(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
4746
|
+
/* @__PURE__ */ jsx15("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
|
|
3203
4747
|
]
|
|
3204
4748
|
}
|
|
3205
4749
|
) : null
|
|
3206
4750
|
] }),
|
|
3207
|
-
hasWallets || !!user.socialHandle ? /* @__PURE__ */
|
|
4751
|
+
hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs14("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
|
|
3208
4752
|
wallets.map((wallet, idx) => {
|
|
3209
4753
|
const chainLower = wallet.chain.toLowerCase();
|
|
3210
4754
|
const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
|
|
3211
|
-
return /* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ jsxs14(
|
|
3212
4756
|
"div",
|
|
3213
4757
|
{
|
|
3214
4758
|
className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
|
|
3215
4759
|
children: [
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
4760
|
+
/* @__PURE__ */ jsx15("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx15(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
|
|
4761
|
+
/* @__PURE__ */ jsx15("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 })
|
|
3218
4762
|
]
|
|
3219
4763
|
},
|
|
3220
4764
|
`wallet-${idx}`
|
|
3221
4765
|
);
|
|
3222
4766
|
}),
|
|
3223
|
-
user.socialHandle ? /* @__PURE__ */
|
|
4767
|
+
user.socialHandle ? /* @__PURE__ */ jsx15("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx15("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
|
|
3224
4768
|
] }) : null
|
|
3225
4769
|
] })
|
|
3226
4770
|
] }),
|
|
3227
|
-
(onDeposit || onWithdraw) && /* @__PURE__ */
|
|
3228
|
-
onDeposit ? /* @__PURE__ */
|
|
4771
|
+
(onDeposit || onWithdraw) && /* @__PURE__ */ jsxs14("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
|
|
4772
|
+
onDeposit ? /* @__PURE__ */ jsx15(
|
|
3229
4773
|
ConditionalWrapper,
|
|
3230
4774
|
{
|
|
3231
4775
|
condition: isDepositBlocked,
|
|
3232
|
-
wrapper: (children) => /* @__PURE__ */
|
|
4776
|
+
wrapper: (children) => /* @__PURE__ */ jsx15(
|
|
3233
4777
|
Tooltip,
|
|
3234
4778
|
{
|
|
3235
|
-
content: /* @__PURE__ */
|
|
4779
|
+
content: /* @__PURE__ */ jsx15("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
3236
4780
|
size: "small",
|
|
3237
4781
|
side: "bottom",
|
|
3238
4782
|
sideOffset: 4,
|
|
3239
4783
|
children
|
|
3240
4784
|
}
|
|
3241
4785
|
),
|
|
3242
|
-
children: /* @__PURE__ */
|
|
4786
|
+
children: /* @__PURE__ */ jsx15(
|
|
3243
4787
|
Button,
|
|
3244
4788
|
__spreadProps(__spreadValues({
|
|
3245
4789
|
variant: "primary",
|
|
@@ -3251,7 +4795,7 @@ var UserInfoCard = ({
|
|
|
3251
4795
|
)
|
|
3252
4796
|
}
|
|
3253
4797
|
) : null,
|
|
3254
|
-
onWithdraw ? /* @__PURE__ */
|
|
4798
|
+
onWithdraw ? /* @__PURE__ */ jsx15(
|
|
3255
4799
|
Button,
|
|
3256
4800
|
{
|
|
3257
4801
|
variant: "secondary",
|
|
@@ -3261,15 +4805,15 @@ var UserInfoCard = ({
|
|
|
3261
4805
|
children: labels.auth.withdraw
|
|
3262
4806
|
}
|
|
3263
4807
|
) : null,
|
|
3264
|
-
onEditProfile ? /* @__PURE__ */
|
|
4808
|
+
onEditProfile ? /* @__PURE__ */ jsxs14(
|
|
3265
4809
|
"button",
|
|
3266
4810
|
{
|
|
3267
4811
|
type: "button",
|
|
3268
4812
|
onClick: onEditProfile,
|
|
3269
4813
|
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",
|
|
3270
4814
|
children: [
|
|
3271
|
-
/* @__PURE__ */
|
|
3272
|
-
/* @__PURE__ */
|
|
4815
|
+
/* @__PURE__ */ jsx15(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
4816
|
+
/* @__PURE__ */ jsx15("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
|
|
3273
4817
|
]
|
|
3274
4818
|
}
|
|
3275
4819
|
) : null
|
|
@@ -3302,7 +4846,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
3302
4846
|
};
|
|
3303
4847
|
|
|
3304
4848
|
// src/pages/user-profile/index.tsx
|
|
3305
|
-
import { jsx as
|
|
4849
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3306
4850
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
3307
4851
|
style: "currency",
|
|
3308
4852
|
currency: "USD",
|
|
@@ -3708,35 +5252,35 @@ var UserProfilePage = ({
|
|
|
3708
5252
|
classNames,
|
|
3709
5253
|
onError
|
|
3710
5254
|
}) => {
|
|
3711
|
-
const [isHydrated, setIsHydrated] =
|
|
3712
|
-
|
|
5255
|
+
const [isHydrated, setIsHydrated] = useState11(false);
|
|
5256
|
+
useEffect10(() => {
|
|
3713
5257
|
setIsHydrated(true);
|
|
3714
5258
|
}, []);
|
|
3715
5259
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
3716
5260
|
const { isDepositBlocked } = useGeoBlock();
|
|
3717
5261
|
const balanceState = useAggBalance();
|
|
3718
5262
|
const client = useAggClient();
|
|
3719
|
-
const labels =
|
|
5263
|
+
const labels = useLabels9();
|
|
3720
5264
|
const {
|
|
3721
5265
|
trading: { executionMode: configuredExecutionMode }
|
|
3722
|
-
} =
|
|
5266
|
+
} = useSdkUiConfig5();
|
|
3723
5267
|
const queryClient = useQueryClient();
|
|
3724
|
-
const [internalCancellingIds, setInternalCancellingIds] =
|
|
5268
|
+
const [internalCancellingIds, setInternalCancellingIds] = useState11({});
|
|
3725
5269
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
3726
5270
|
onClaim,
|
|
3727
5271
|
onClaimResult,
|
|
3728
5272
|
onClaimSubmitError,
|
|
3729
5273
|
externalClaimingKeys: claimingPositionKeys
|
|
3730
5274
|
});
|
|
3731
|
-
const [profileUser, setProfileUser] =
|
|
5275
|
+
const [profileUser, setProfileUser] = useState11(void 0);
|
|
3732
5276
|
const shouldUseHookData = !user;
|
|
3733
|
-
const connectedVenues =
|
|
5277
|
+
const connectedVenues = useMemo7(() => {
|
|
3734
5278
|
var _a;
|
|
3735
5279
|
if (!shouldUseHookData) return [];
|
|
3736
5280
|
const fromBalance = (_a = balanceState.connectedVenues) != null ? _a : [];
|
|
3737
5281
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
3738
5282
|
}, [balanceState, shouldUseHookData]);
|
|
3739
|
-
const [positionFilter, setPositionFilter] =
|
|
5283
|
+
const [positionFilter, setPositionFilter] = useState11(initialPositionFilter);
|
|
3740
5284
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
3741
5285
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
3742
5286
|
const activePositionsQuery = useExecutionPositions({
|
|
@@ -3751,14 +5295,14 @@ var UserProfilePage = ({
|
|
|
3751
5295
|
limit: 25,
|
|
3752
5296
|
mode: queryExecutionMode
|
|
3753
5297
|
});
|
|
3754
|
-
const handlePositionFilterChange =
|
|
5298
|
+
const handlePositionFilterChange = useCallback5(
|
|
3755
5299
|
(filter) => {
|
|
3756
5300
|
setPositionFilter(filter);
|
|
3757
5301
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
3758
5302
|
},
|
|
3759
5303
|
[onPositionFilterChangeProp]
|
|
3760
5304
|
);
|
|
3761
|
-
|
|
5305
|
+
useEffect10(() => {
|
|
3762
5306
|
setPositionFilter(initialPositionFilter);
|
|
3763
5307
|
}, [initialPositionFilter]);
|
|
3764
5308
|
const ordersQuery = useExecutionOrders({
|
|
@@ -3770,7 +5314,7 @@ var UserProfilePage = ({
|
|
|
3770
5314
|
enabled: shouldUseHookData && isAuthenticated,
|
|
3771
5315
|
limit: 25
|
|
3772
5316
|
});
|
|
3773
|
-
const handleCancelOrder =
|
|
5317
|
+
const handleCancelOrder = useCallback5(
|
|
3774
5318
|
(order) => __async(null, null, function* () {
|
|
3775
5319
|
if (onCancelOrder) {
|
|
3776
5320
|
onCancelOrder(order);
|
|
@@ -3790,7 +5334,7 @@ var UserProfilePage = ({
|
|
|
3790
5334
|
}),
|
|
3791
5335
|
[client, onCancelOrder, queryClient]
|
|
3792
5336
|
);
|
|
3793
|
-
const handleClaimPosition =
|
|
5337
|
+
const handleClaimPosition = useCallback5(
|
|
3794
5338
|
(position) => {
|
|
3795
5339
|
var _a, _b;
|
|
3796
5340
|
return startClaim({
|
|
@@ -3801,7 +5345,7 @@ var UserProfilePage = ({
|
|
|
3801
5345
|
},
|
|
3802
5346
|
[startClaim]
|
|
3803
5347
|
);
|
|
3804
|
-
|
|
5348
|
+
useEffect10(() => {
|
|
3805
5349
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
3806
5350
|
setProfileUser(void 0);
|
|
3807
5351
|
return;
|
|
@@ -3820,7 +5364,7 @@ var UserProfilePage = ({
|
|
|
3820
5364
|
isActive = false;
|
|
3821
5365
|
};
|
|
3822
5366
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
3823
|
-
const resolvedUser =
|
|
5367
|
+
const resolvedUser = useMemo7(() => {
|
|
3824
5368
|
var _a, _b, _c, _d, _e, _f;
|
|
3825
5369
|
if (user) return user;
|
|
3826
5370
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -3854,7 +5398,7 @@ var UserProfilePage = ({
|
|
|
3854
5398
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
3855
5399
|
};
|
|
3856
5400
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
3857
|
-
const _resolvedVenueBalances =
|
|
5401
|
+
const _resolvedVenueBalances = useMemo7(() => {
|
|
3858
5402
|
if (_venueBalances) return _venueBalances;
|
|
3859
5403
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
3860
5404
|
chain: item.label,
|
|
@@ -3862,7 +5406,7 @@ var UserProfilePage = ({
|
|
|
3862
5406
|
balanceLabel: formatUsd(item.balance)
|
|
3863
5407
|
}));
|
|
3864
5408
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
3865
|
-
const positionsValueLabel =
|
|
5409
|
+
const positionsValueLabel = useMemo7(() => {
|
|
3866
5410
|
var _a;
|
|
3867
5411
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
3868
5412
|
const managed = balanceState.managedBalances;
|
|
@@ -3870,13 +5414,13 @@ var UserProfilePage = ({
|
|
|
3870
5414
|
const positionsValueTotal = positions.reduce((sum, p) => sum + (Number(p.balance) || 0), 0);
|
|
3871
5415
|
return formatUsd(positionsValueTotal);
|
|
3872
5416
|
}, [balance, balanceState]);
|
|
3873
|
-
const availableBalanceLabel =
|
|
5417
|
+
const availableBalanceLabel = useMemo7(() => {
|
|
3874
5418
|
var _a;
|
|
3875
5419
|
return formatUsd((_a = balanceState.totalBalance) != null ? _a : 0);
|
|
3876
5420
|
}, [balanceState.totalBalance]);
|
|
3877
5421
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
3878
5422
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
3879
|
-
const resolvedActivities =
|
|
5423
|
+
const resolvedActivities = useMemo7(() => {
|
|
3880
5424
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
3881
5425
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
3882
5426
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -4025,7 +5569,7 @@ var UserProfilePage = ({
|
|
|
4025
5569
|
};
|
|
4026
5570
|
});
|
|
4027
5571
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
4028
|
-
const resolvedOpenOrders =
|
|
5572
|
+
const resolvedOpenOrders = useMemo7(() => {
|
|
4029
5573
|
if (openOrders) return openOrders;
|
|
4030
5574
|
return ordersQuery.orders.filter((order) => isOpenOrderStatus(order.status)).map((order) => {
|
|
4031
5575
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -4042,7 +5586,7 @@ var UserProfilePage = ({
|
|
|
4042
5586
|
};
|
|
4043
5587
|
});
|
|
4044
5588
|
}, [openOrders, ordersQuery.orders]);
|
|
4045
|
-
const adaptPositionGroups =
|
|
5589
|
+
const adaptPositionGroups = useCallback5(
|
|
4046
5590
|
(groups) => {
|
|
4047
5591
|
return groups.flatMap((group) => {
|
|
4048
5592
|
var _a, _b, _c, _d;
|
|
@@ -4112,15 +5656,15 @@ var UserProfilePage = ({
|
|
|
4112
5656
|
},
|
|
4113
5657
|
[]
|
|
4114
5658
|
);
|
|
4115
|
-
const resolvedActivePositions =
|
|
5659
|
+
const resolvedActivePositions = useMemo7(() => {
|
|
4116
5660
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
4117
5661
|
return source.filter(shouldIncludeByShares);
|
|
4118
5662
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
4119
|
-
const resolvedClosedPositions =
|
|
5663
|
+
const resolvedClosedPositions = useMemo7(() => {
|
|
4120
5664
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
4121
5665
|
return source.filter(shouldIncludeByShares);
|
|
4122
5666
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
4123
|
-
return /* @__PURE__ */
|
|
5667
|
+
return /* @__PURE__ */ jsx16(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx16(
|
|
4124
5668
|
"section",
|
|
4125
5669
|
{
|
|
4126
5670
|
className: cn(
|
|
@@ -4128,7 +5672,7 @@ var UserProfilePage = ({
|
|
|
4128
5672
|
"w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
|
|
4129
5673
|
classNames == null ? void 0 : classNames.root
|
|
4130
5674
|
),
|
|
4131
|
-
children: /* @__PURE__ */
|
|
5675
|
+
children: /* @__PURE__ */ jsxs15(
|
|
4132
5676
|
"div",
|
|
4133
5677
|
{
|
|
4134
5678
|
className: cn(
|
|
@@ -4138,8 +5682,8 @@ var UserProfilePage = ({
|
|
|
4138
5682
|
classNames == null ? void 0 : classNames.topRow
|
|
4139
5683
|
),
|
|
4140
5684
|
children: [
|
|
4141
|
-
/* @__PURE__ */
|
|
4142
|
-
/* @__PURE__ */
|
|
5685
|
+
/* @__PURE__ */ jsxs15("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: [
|
|
5686
|
+
/* @__PURE__ */ jsx16(
|
|
4143
5687
|
"div",
|
|
4144
5688
|
{
|
|
4145
5689
|
className: cn(
|
|
@@ -4147,7 +5691,7 @@ var UserProfilePage = ({
|
|
|
4147
5691
|
"flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
|
|
4148
5692
|
classNames == null ? void 0 : classNames.leftColumn
|
|
4149
5693
|
),
|
|
4150
|
-
children: /* @__PURE__ */
|
|
5694
|
+
children: /* @__PURE__ */ jsx16(
|
|
4151
5695
|
UserInfoCard,
|
|
4152
5696
|
{
|
|
4153
5697
|
user: resolvedUser,
|
|
@@ -4160,7 +5704,7 @@ var UserProfilePage = ({
|
|
|
4160
5704
|
)
|
|
4161
5705
|
}
|
|
4162
5706
|
),
|
|
4163
|
-
/* @__PURE__ */
|
|
5707
|
+
/* @__PURE__ */ jsxs15(
|
|
4164
5708
|
"div",
|
|
4165
5709
|
{
|
|
4166
5710
|
className: cn(
|
|
@@ -4168,14 +5712,14 @@ var UserProfilePage = ({
|
|
|
4168
5712
|
classNames == null ? void 0 : classNames.rightColumn
|
|
4169
5713
|
),
|
|
4170
5714
|
children: [
|
|
4171
|
-
/* @__PURE__ */
|
|
5715
|
+
/* @__PURE__ */ jsx16(
|
|
4172
5716
|
PositionsValueCard,
|
|
4173
5717
|
{
|
|
4174
5718
|
valueLabel: positionsValueLabel,
|
|
4175
5719
|
isLoading: isPositionsValueLoading
|
|
4176
5720
|
}
|
|
4177
5721
|
),
|
|
4178
|
-
/* @__PURE__ */
|
|
5722
|
+
/* @__PURE__ */ jsx16(
|
|
4179
5723
|
AvailableBalanceCard,
|
|
4180
5724
|
{
|
|
4181
5725
|
valueLabel: availableBalanceLabel,
|
|
@@ -4193,7 +5737,7 @@ var UserProfilePage = ({
|
|
|
4193
5737
|
}
|
|
4194
5738
|
)
|
|
4195
5739
|
] }),
|
|
4196
|
-
/* @__PURE__ */
|
|
5740
|
+
/* @__PURE__ */ jsx16(
|
|
4197
5741
|
PositionsActivity,
|
|
4198
5742
|
{
|
|
4199
5743
|
tab,
|