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