@agg-market/ui 9.0.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-N7U7QCSB.mjs → chunk-55YYUTBK.mjs} +807 -358
- package/dist/{chunk-3U4VHAP6.mjs → chunk-5G4T5R2H.mjs} +6 -2
- package/dist/{chunk-6CRY27SQ.mjs → chunk-GYOCLZGH.mjs} +538 -418
- package/dist/{chunk-HJ4UPYM7.mjs → chunk-RYQSVETG.mjs} +201 -165
- package/dist/{chunk-3G7C6WEC.mjs → chunk-XP7DREIX.mjs} +47 -15
- package/dist/events.js +575 -429
- package/dist/events.mjs +6 -4
- package/dist/index.js +1577 -948
- package/dist/index.mjs +10 -6
- package/dist/modals.js +1185 -374
- package/dist/modals.mjs +4 -2
- package/dist/pages.js +1400 -1010
- package/dist/pages.mjs +4 -4
- package/dist/primitives.js +46 -14
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +20 -4
- package/dist/trading.mjs +2 -2
- package/dist/types/events/item/event-list-item.types.d.mts +1 -2
- package/dist/types/events/item/event-list-item.types.d.ts +1 -2
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +1 -4
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +1 -4
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +42 -3
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +42 -3
- package/dist/types/events/list/event-list.types.d.mts +2 -1
- package/dist/types/events/list/event-list.types.d.ts +2 -1
- package/dist/types/events/list/index.d.mts +1 -1
- package/dist/types/events/list/index.d.ts +1 -1
- package/dist/types/events/market-details/index.d.mts +6 -2
- package/dist/types/events/market-details/index.d.ts +6 -2
- package/dist/types/events/market-details/market-details.types.d.mts +33 -9
- package/dist/types/events/market-details/market-details.types.d.ts +33 -9
- package/dist/types/events/market-details/market-details.utils.d.mts +15 -10
- package/dist/types/events/market-details/market-details.utils.d.ts +15 -10
- package/dist/types/modals/index.d.mts +1 -0
- package/dist/types/modals/index.d.ts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
- package/dist/types/pages/home/home.constants.d.mts +1 -3
- package/dist/types/pages/home/home.constants.d.ts +1 -3
- package/dist/types/pages/home/home.types.d.mts +0 -2
- package/dist/types/pages/home/home.types.d.ts +0 -2
- package/dist/types/pages/home/home.utils.d.mts +4 -0
- package/dist/types/pages/home/home.utils.d.ts +4 -0
- package/dist/types/pages/home/index.d.mts +1 -1
- package/dist/types/pages/home/index.d.ts +1 -1
- package/dist/types/primitives/chart/index.d.mts +9 -1
- package/dist/types/primitives/chart/index.d.ts +9 -1
- package/dist/types/primitives/venue-logo/index.d.mts +1 -1
- package/dist/types/primitives/venue-logo/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -3,15 +3,16 @@ import {
|
|
|
3
3
|
EventListItemDetails,
|
|
4
4
|
MarketDetails,
|
|
5
5
|
isErrorWithStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GYOCLZGH.mjs";
|
|
7
7
|
import {
|
|
8
8
|
PlaceOrder,
|
|
9
9
|
Settlement
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5G4T5R2H.mjs";
|
|
11
11
|
import {
|
|
12
12
|
Button,
|
|
13
13
|
Card,
|
|
14
14
|
Icon,
|
|
15
|
+
Modal,
|
|
15
16
|
RemoteImage,
|
|
16
17
|
StateMessage,
|
|
17
18
|
Tabs,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
__spreadProps,
|
|
21
22
|
__spreadValues,
|
|
22
23
|
cn
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-XP7DREIX.mjs";
|
|
24
25
|
|
|
25
26
|
// src/pages/home/index.tsx
|
|
26
27
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -30,51 +31,6 @@ import { useCategories, useLabels } from "@agg-market/hooks";
|
|
|
30
31
|
var ALL_CATEGORIES_TAB_VALUE = "trending";
|
|
31
32
|
var DEFAULT_CATEGORIES_LIMIT = 100;
|
|
32
33
|
var DEFAULT_ALL_CATEGORY_TAB_LABEL = "Trending";
|
|
33
|
-
var CATEGORY_TAB_NAME_ORDER = [
|
|
34
|
-
"crypto",
|
|
35
|
-
"economy",
|
|
36
|
-
"entertainment",
|
|
37
|
-
"finance",
|
|
38
|
-
"geopolitics",
|
|
39
|
-
"health",
|
|
40
|
-
"mentions",
|
|
41
|
-
"politics",
|
|
42
|
-
"science",
|
|
43
|
-
"sports",
|
|
44
|
-
"technology",
|
|
45
|
-
"weather",
|
|
46
|
-
"world"
|
|
47
|
-
];
|
|
48
|
-
var getDefaultHomePageTabs = (allCategoryTabLabel) => {
|
|
49
|
-
return [
|
|
50
|
-
{
|
|
51
|
-
value: ALL_CATEGORIES_TAB_VALUE,
|
|
52
|
-
label: allCategoryTabLabel,
|
|
53
|
-
iconName: "arrow-trend-up"
|
|
54
|
-
},
|
|
55
|
-
{ value: "crypto", label: "crypto", categoryIds: ["crypto"] },
|
|
56
|
-
{ value: "economy", label: "economy", categoryIds: ["economy"] },
|
|
57
|
-
{
|
|
58
|
-
value: "entertainment",
|
|
59
|
-
label: "entertainment",
|
|
60
|
-
categoryIds: ["entertainment"]
|
|
61
|
-
},
|
|
62
|
-
{ value: "finance", label: "finance", categoryIds: ["finance"] },
|
|
63
|
-
{
|
|
64
|
-
value: "geopolitics",
|
|
65
|
-
label: "geopolitics",
|
|
66
|
-
categoryIds: ["geopolitics"]
|
|
67
|
-
},
|
|
68
|
-
{ value: "health", label: "health", categoryIds: ["health"] },
|
|
69
|
-
{ value: "mentions", label: "mentions", categoryIds: ["mentions"] },
|
|
70
|
-
{ value: "politics", label: "politics", categoryIds: ["politics"] },
|
|
71
|
-
{ value: "science", label: "science", categoryIds: ["science"] },
|
|
72
|
-
{ value: "sports", label: "sports", categoryIds: ["sports"] },
|
|
73
|
-
{ value: "technology", label: "technology", categoryIds: ["technology"] },
|
|
74
|
-
{ value: "weather", label: "weather", categoryIds: ["weather"] },
|
|
75
|
-
{ value: "world", label: "world", categoryIds: ["world"] }
|
|
76
|
-
];
|
|
77
|
-
};
|
|
78
34
|
var getDefaultEventSectionItems = (labels) => {
|
|
79
35
|
return [
|
|
80
36
|
{
|
|
@@ -95,31 +51,7 @@ var getDefaultEventSectionItems = (labels) => {
|
|
|
95
51
|
};
|
|
96
52
|
|
|
97
53
|
// src/pages/home/home.utils.ts
|
|
98
|
-
var categoryOrderMap = CATEGORY_TAB_NAME_ORDER.reduce(
|
|
99
|
-
(accumulator, name, index) => {
|
|
100
|
-
accumulator.set(name, index);
|
|
101
|
-
return accumulator;
|
|
102
|
-
},
|
|
103
|
-
/* @__PURE__ */ new Map()
|
|
104
|
-
);
|
|
105
|
-
var normalizeCategoryName = (name) => {
|
|
106
|
-
return name.trim().toLowerCase();
|
|
107
|
-
};
|
|
108
54
|
var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
|
|
109
|
-
const sortedCategories = [...categories].sort((left, right) => {
|
|
110
|
-
const leftName = normalizeCategoryName(left.name);
|
|
111
|
-
const rightName = normalizeCategoryName(right.name);
|
|
112
|
-
const leftOrder = categoryOrderMap.get(leftName);
|
|
113
|
-
const rightOrder = categoryOrderMap.get(rightName);
|
|
114
|
-
if (leftOrder != null && rightOrder != null) {
|
|
115
|
-
return leftOrder - rightOrder;
|
|
116
|
-
}
|
|
117
|
-
if (leftOrder != null)
|
|
118
|
-
return -1;
|
|
119
|
-
if (rightOrder != null)
|
|
120
|
-
return 1;
|
|
121
|
-
return leftName.localeCompare(rightName);
|
|
122
|
-
});
|
|
123
55
|
const seenCategoryIds = /* @__PURE__ */ new Set();
|
|
124
56
|
const tabs = [
|
|
125
57
|
{
|
|
@@ -128,13 +60,13 @@ var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
|
|
|
128
60
|
iconName: "arrow-trend-up"
|
|
129
61
|
}
|
|
130
62
|
];
|
|
131
|
-
for (const category of
|
|
63
|
+
for (const category of categories) {
|
|
132
64
|
if (seenCategoryIds.has(category.id))
|
|
133
65
|
continue;
|
|
134
66
|
seenCategoryIds.add(category.id);
|
|
135
67
|
tabs.push({
|
|
136
68
|
value: category.id,
|
|
137
|
-
label:
|
|
69
|
+
label: category.name.trim().toLowerCase(),
|
|
138
70
|
categoryIds: [category.id]
|
|
139
71
|
});
|
|
140
72
|
}
|
|
@@ -147,7 +79,7 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
|
147
79
|
if (hasDefaultTab)
|
|
148
80
|
return defaultActiveTab;
|
|
149
81
|
}
|
|
150
|
-
return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b :
|
|
82
|
+
return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
|
|
151
83
|
};
|
|
152
84
|
|
|
153
85
|
// src/pages/home/index.tsx
|
|
@@ -158,17 +90,15 @@ var HomePage = ({
|
|
|
158
90
|
onTabChange,
|
|
159
91
|
eventSectionItems,
|
|
160
92
|
classNames,
|
|
161
|
-
useCategoriesTabs = true,
|
|
162
93
|
categoriesLimit = DEFAULT_CATEGORIES_LIMIT,
|
|
163
94
|
allCategoryTabLabel = DEFAULT_ALL_CATEGORY_TAB_LABEL
|
|
164
95
|
}) => {
|
|
165
96
|
const labels = useLabels();
|
|
166
97
|
const hasCustomTabs = !!tabs && tabs.length > 0;
|
|
167
|
-
const shouldUseCategoriesTabs = !hasCustomTabs && useCategoriesTabs;
|
|
168
98
|
const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
|
|
169
|
-
const { categories } = useCategories({
|
|
99
|
+
const { categories, isLoading: isCategoriesLoading } = useCategories({
|
|
170
100
|
limit: categoriesLimit,
|
|
171
|
-
enabled:
|
|
101
|
+
enabled: !hasCustomTabs
|
|
172
102
|
});
|
|
173
103
|
const categoryTabs = useMemo(() => {
|
|
174
104
|
return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
|
|
@@ -176,10 +106,8 @@ var HomePage = ({
|
|
|
176
106
|
const resolvedTabs = useMemo(() => {
|
|
177
107
|
if (hasCustomTabs && tabs)
|
|
178
108
|
return tabs;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return getDefaultHomePageTabs(resolvedAllCategoryTabLabel);
|
|
182
|
-
}, [categoryTabs, hasCustomTabs, resolvedAllCategoryTabLabel, shouldUseCategoriesTabs, tabs]);
|
|
109
|
+
return categoryTabs;
|
|
110
|
+
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
183
111
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
184
112
|
const [activeTabValue, setActiveTabValue] = useState(() => {
|
|
185
113
|
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
@@ -214,22 +142,20 @@ var HomePage = ({
|
|
|
214
142
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
215
143
|
}, [activeTabValue, resolvedTabs]);
|
|
216
144
|
const resolvedSectionItems = useMemo(() => {
|
|
217
|
-
var _a, _b, _c, _d
|
|
145
|
+
var _a, _b, _c, _d;
|
|
218
146
|
if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
|
|
219
147
|
return resolvedEventSectionItems;
|
|
220
148
|
}
|
|
221
149
|
const maxItemsPerRow = (_b = (_a = resolvedEventSectionItems[0]) == null ? void 0 : _a.maxItemsPerRow) != null ? _b : 3;
|
|
222
|
-
const
|
|
223
|
-
const firstSectionLimit = (_d = resolvedEventSectionItems[0]) == null ? void 0 : _d.limit;
|
|
150
|
+
const firstSectionLimit = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.limit;
|
|
224
151
|
const limit = firstSectionLimit && Number.isFinite(firstSectionLimit) ? Math.max(9, Math.floor(firstSectionLimit)) : 9;
|
|
225
152
|
return [
|
|
226
153
|
{
|
|
227
154
|
id: `${activeTabValue}-markets`,
|
|
228
|
-
title: (
|
|
155
|
+
title: (_d = activeTab == null ? void 0 : activeTab.label) != null ? _d : activeTabValue,
|
|
229
156
|
maxItemsPerRow,
|
|
230
157
|
limit,
|
|
231
158
|
maxVisibleItems: void 0,
|
|
232
|
-
showVenueLogo,
|
|
233
159
|
search: activeTab == null ? void 0 : activeTab.search,
|
|
234
160
|
categoryIds: activeTab == null ? void 0 : activeTab.categoryIds
|
|
235
161
|
}
|
|
@@ -239,6 +165,18 @@ var HomePage = ({
|
|
|
239
165
|
setActiveTabValue(value);
|
|
240
166
|
onTabChange == null ? void 0 : onTabChange(value);
|
|
241
167
|
};
|
|
168
|
+
if (!hasCustomTabs && isCategoriesLoading) {
|
|
169
|
+
return /* @__PURE__ */ jsx("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx(
|
|
170
|
+
"header",
|
|
171
|
+
{
|
|
172
|
+
className: cn(
|
|
173
|
+
"w-full bg-agg-secondary border-b border-agg-separator",
|
|
174
|
+
classNames == null ? void 0 : classNames.header
|
|
175
|
+
),
|
|
176
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("w-full px-4 md:px-10 h-10", classNames == null ? void 0 : classNames.tabs) })
|
|
177
|
+
}
|
|
178
|
+
) });
|
|
179
|
+
}
|
|
242
180
|
return /* @__PURE__ */ jsxs("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
|
|
243
181
|
/* @__PURE__ */ jsx(
|
|
244
182
|
"header",
|
|
@@ -273,7 +211,6 @@ var HomePage = ({
|
|
|
273
211
|
maxItemsPerRow: eventSectionItem.maxItemsPerRow,
|
|
274
212
|
limit: eventSectionItem.limit,
|
|
275
213
|
maxVisibleItems: eventSectionItem.maxVisibleItems,
|
|
276
|
-
showVenueLogo: eventSectionItem.showVenueLogo,
|
|
277
214
|
search: (_b = eventSectionItem.search) != null ? _b : activeTab == null ? void 0 : activeTab.search,
|
|
278
215
|
categoryIds: (_c = eventSectionItem.categoryIds) != null ? _c : activeTab == null ? void 0 : activeTab.categoryIds
|
|
279
216
|
},
|
|
@@ -290,7 +227,7 @@ HomePage.displayName = "HomePage";
|
|
|
290
227
|
import { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
291
228
|
import { useVenueEvent, useLabels as useLabels2 } from "@agg-market/hooks";
|
|
292
229
|
import dayjs from "dayjs";
|
|
293
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
230
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
294
231
|
var getMarketDateValue = (market, fallbackIndex) => {
|
|
295
232
|
var _a, _b, _c;
|
|
296
233
|
const candidateDate = (_c = (_b = (_a = market.endDate) != null ? _a : market.startDate) != null ? _b : market.creationDate) != null ? _c : null;
|
|
@@ -346,6 +283,69 @@ var resolveInitialExpandedMarketId = (detailedMarkets, defaultExpandedMarketId)
|
|
|
346
283
|
}
|
|
347
284
|
return (_b = (_a = detailedMarkets[0]) == null ? void 0 : _a.id) != null ? _b : null;
|
|
348
285
|
};
|
|
286
|
+
var EventMarketPageMobileTrade = ({
|
|
287
|
+
placeOrder,
|
|
288
|
+
classNames
|
|
289
|
+
}) => {
|
|
290
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
291
|
+
const handleOpen = () => {
|
|
292
|
+
setIsOpen(true);
|
|
293
|
+
};
|
|
294
|
+
const handleOpenChange = (nextOpen) => {
|
|
295
|
+
setIsOpen(nextOpen);
|
|
296
|
+
};
|
|
297
|
+
const handleClose = () => {
|
|
298
|
+
setIsOpen(false);
|
|
299
|
+
};
|
|
300
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
301
|
+
/* @__PURE__ */ jsx2(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: cn(
|
|
305
|
+
"fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
|
|
306
|
+
classNames == null ? void 0 : classNames.mobileTradeCta
|
|
307
|
+
),
|
|
308
|
+
children: /* @__PURE__ */ jsx2(
|
|
309
|
+
Button,
|
|
310
|
+
{
|
|
311
|
+
size: "large",
|
|
312
|
+
className: "min-w-[168px] shadow-agg-modal",
|
|
313
|
+
"aria-label": placeOrder.actionLabel,
|
|
314
|
+
"data-testid": "event-market-page-mobile-trade-cta",
|
|
315
|
+
onClick: (e) => {
|
|
316
|
+
e.stopPropagation();
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
handleOpen();
|
|
319
|
+
},
|
|
320
|
+
children: placeOrder.actionLabel
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ jsx2(Modal, { open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsx2(
|
|
326
|
+
Modal.Container,
|
|
327
|
+
{
|
|
328
|
+
"aria-label": placeOrder.title,
|
|
329
|
+
maxWidth: "420px",
|
|
330
|
+
classNames: {
|
|
331
|
+
content: "items-end p-0 sm:items-center sm:p-4",
|
|
332
|
+
container: cn(
|
|
333
|
+
"w-full max-w-[420px] border-0 bg-transparent shadow-none",
|
|
334
|
+
classNames == null ? void 0 : classNames.mobileTradeModal
|
|
335
|
+
)
|
|
336
|
+
},
|
|
337
|
+
children: /* @__PURE__ */ jsx2(
|
|
338
|
+
PlaceOrder,
|
|
339
|
+
__spreadProps(__spreadValues({}, placeOrder), {
|
|
340
|
+
isDismissible: true,
|
|
341
|
+
className: cn("w-full rounded-t-agg-2xl sm:rounded-agg-xl", classNames == null ? void 0 : classNames.mobileTrade),
|
|
342
|
+
onClose: handleClose
|
|
343
|
+
})
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
) })
|
|
347
|
+
] });
|
|
348
|
+
};
|
|
349
349
|
var EventMarketPageUnavailableState = ({
|
|
350
350
|
ariaLabel
|
|
351
351
|
}) => {
|
|
@@ -395,46 +395,66 @@ var EventMarketPageLoadingState = ({
|
|
|
395
395
|
}
|
|
396
396
|
]
|
|
397
397
|
};
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
398
|
+
return /* @__PURE__ */ jsxs2("section", { className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root), children: [
|
|
399
|
+
/* @__PURE__ */ jsxs2(
|
|
400
|
+
"div",
|
|
401
|
+
{
|
|
402
|
+
className: cn(
|
|
403
|
+
"mx-auto flex w-full max-w-[1200px] flex-col gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
|
|
404
|
+
classNames == null ? void 0 : classNames.content
|
|
405
|
+
),
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ jsxs2("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
|
|
408
|
+
/* @__PURE__ */ jsx2(
|
|
409
|
+
EventListItemDetails,
|
|
410
|
+
{
|
|
411
|
+
isLoading: true,
|
|
412
|
+
classNames: {
|
|
413
|
+
root: classNames == null ? void 0 : classNames.hero
|
|
414
|
+
}
|
|
413
415
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
),
|
|
417
|
+
/* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
|
|
418
|
+
/* @__PURE__ */ jsx2(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
|
|
419
|
+
/* @__PURE__ */ jsx2(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
|
|
420
|
+
/* @__PURE__ */ jsx2(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
|
|
421
|
+
] }),
|
|
422
|
+
/* @__PURE__ */ jsx2("div", { className: "md:hidden", children: /* @__PURE__ */ jsx2(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
|
|
423
|
+
/* @__PURE__ */ jsx2("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx2(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) })
|
|
420
424
|
] }),
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
placeOrder ? /* @__PURE__ */ jsx2(
|
|
426
|
+
"aside",
|
|
427
|
+
{
|
|
428
|
+
className: cn(
|
|
429
|
+
"hidden w-full shrink-0 lg:sticky lg:top-6 lg:block lg:w-[343px]",
|
|
430
|
+
classNames == null ? void 0 : classNames.sidebar
|
|
431
|
+
),
|
|
432
|
+
children: /* @__PURE__ */ jsx2(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.trade }))
|
|
433
|
+
}
|
|
434
|
+
) : null
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
placeOrder ? /* @__PURE__ */ jsx2(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: cn(
|
|
442
|
+
"fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
|
|
443
|
+
classNames == null ? void 0 : classNames.mobileTradeCta
|
|
444
|
+
),
|
|
445
|
+
children: /* @__PURE__ */ jsx2(
|
|
446
|
+
Button,
|
|
427
447
|
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
children:
|
|
448
|
+
size: "large",
|
|
449
|
+
className: "min-w-[168px] shadow-agg-modal",
|
|
450
|
+
"aria-label": placeOrder.actionLabel,
|
|
451
|
+
disabled: true,
|
|
452
|
+
children: placeOrder.actionLabel
|
|
433
453
|
}
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
) : null
|
|
457
|
+
] });
|
|
438
458
|
};
|
|
439
459
|
var EventMarketPageContent = ({
|
|
440
460
|
event,
|
|
@@ -487,49 +507,65 @@ var EventMarketPageContent = ({
|
|
|
487
507
|
if (!heroEvent || !event.venueMarkets.length) {
|
|
488
508
|
return /* @__PURE__ */ jsx2(EventMarketPageUnavailableState, { ariaLabel });
|
|
489
509
|
}
|
|
490
|
-
return /* @__PURE__ */
|
|
491
|
-
"
|
|
510
|
+
return /* @__PURE__ */ jsxs2(
|
|
511
|
+
"section",
|
|
492
512
|
{
|
|
493
|
-
className: cn(
|
|
494
|
-
|
|
495
|
-
classNames == null ? void 0 : classNames.content
|
|
496
|
-
),
|
|
513
|
+
className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root),
|
|
514
|
+
"aria-label": ariaLabel != null ? ariaLabel : event.title,
|
|
497
515
|
children: [
|
|
498
|
-
/* @__PURE__ */ jsxs2(
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
516
|
+
/* @__PURE__ */ jsxs2(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: cn(
|
|
520
|
+
"mx-auto flex w-full max-w-[1200px] flex-row gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
|
|
521
|
+
classNames == null ? void 0 : classNames.content
|
|
522
|
+
),
|
|
523
|
+
children: [
|
|
524
|
+
/* @__PURE__ */ jsxs2("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
|
|
525
|
+
/* @__PURE__ */ jsx2(
|
|
526
|
+
EventListItemDetails,
|
|
527
|
+
{
|
|
528
|
+
event: heroEvent,
|
|
529
|
+
defaultTimeRange: heroDefaultTimeRange,
|
|
530
|
+
classNames: {
|
|
531
|
+
root: classNames == null ? void 0 : classNames.hero
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
detailedMarkets.length > 0 ? /* @__PURE__ */ jsx2("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: detailedMarkets.map((market) => {
|
|
536
|
+
const isOpened = resolvedExpandedMarketId === market.id;
|
|
537
|
+
return /* @__PURE__ */ jsx2(
|
|
538
|
+
MarketDetails,
|
|
539
|
+
{
|
|
540
|
+
venueMarkets: [market],
|
|
541
|
+
isOpened,
|
|
542
|
+
defaultTab: "order-book",
|
|
543
|
+
ariaLabel: market.endDate && dayjs(market.endDate).isValid() ? labels.eventMarketPage.marketDetailsAriaByDate(
|
|
544
|
+
dayjs(market.endDate).format("MMM D, YYYY")
|
|
545
|
+
) : labels.eventMarketPage.marketDetailsAriaByQuestion(market.question),
|
|
546
|
+
onOpenChange: (nextIsOpened) => handleExpandedMarketChange(market.id, nextIsOpened)
|
|
547
|
+
},
|
|
548
|
+
market.id
|
|
549
|
+
);
|
|
550
|
+
}) }) : null,
|
|
551
|
+
settlement ? /* @__PURE__ */ jsx2("div", { className: "md:hidden", children: /* @__PURE__ */ jsx2(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null,
|
|
552
|
+
settlement ? /* @__PURE__ */ jsx2("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx2(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null
|
|
553
|
+
] }),
|
|
554
|
+
placeOrder ? /* @__PURE__ */ jsx2(
|
|
555
|
+
"aside",
|
|
556
|
+
{
|
|
557
|
+
className: cn("hidden w-full lg:block lg:max-w-[360px]", classNames == null ? void 0 : classNames.sidebar),
|
|
558
|
+
"data-testid": "event-market-page-desktop-trade",
|
|
559
|
+
children: /* @__PURE__ */ jsx2(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { className: classNames == null ? void 0 : classNames.trade }))
|
|
560
|
+
}
|
|
561
|
+
) : null
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
placeOrder ? /* @__PURE__ */ jsx2(EventMarketPageMobileTrade, { placeOrder, classNames }) : null
|
|
530
566
|
]
|
|
531
567
|
}
|
|
532
|
-
)
|
|
568
|
+
);
|
|
533
569
|
};
|
|
534
570
|
var EventMarketPage = (props) => {
|
|
535
571
|
var _a;
|
|
@@ -758,7 +758,7 @@ var SwitchButton = ({
|
|
|
758
758
|
"div",
|
|
759
759
|
{
|
|
760
760
|
className: cn(
|
|
761
|
-
"group/agg-switch",
|
|
761
|
+
"group/agg-switch min-w-fit",
|
|
762
762
|
"inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
|
|
763
763
|
getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
|
|
764
764
|
"cursor-pointer hover:bg-agg-tertiary",
|
|
@@ -804,6 +804,7 @@ var SwitchButton = ({
|
|
|
804
804
|
tabIndex: isActive ? 0 : -1,
|
|
805
805
|
disabled: option.disabled,
|
|
806
806
|
className: cn(
|
|
807
|
+
"whitespace-nowrap",
|
|
807
808
|
"relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
|
|
808
809
|
getMotionClassName(
|
|
809
810
|
enableAnimations,
|
|
@@ -1079,11 +1080,12 @@ var LineChart = ({
|
|
|
1079
1080
|
liveCandle: liveForming,
|
|
1080
1081
|
lineData,
|
|
1081
1082
|
lineValue,
|
|
1082
|
-
live
|
|
1083
|
+
live
|
|
1083
1084
|
}) => {
|
|
1084
1085
|
var _a, _b;
|
|
1085
1086
|
const labels = useLabels6();
|
|
1086
|
-
const { theme } = useSdkUiConfig5();
|
|
1087
|
+
const { theme, enableGradients, enableLiveUpdates } = useSdkUiConfig5();
|
|
1088
|
+
const isLive = enableLiveUpdates && (live != null ? live : true);
|
|
1087
1089
|
const normalizedSeries = useMemo2(() => {
|
|
1088
1090
|
return normalizeSeries(series);
|
|
1089
1091
|
}, [series]);
|
|
@@ -1106,7 +1108,19 @@ var LineChart = ({
|
|
|
1106
1108
|
if (!primarySeries) {
|
|
1107
1109
|
return [];
|
|
1108
1110
|
}
|
|
1109
|
-
|
|
1111
|
+
const points = toLivelinePoints(primarySeries.points);
|
|
1112
|
+
if (points.length < 3) {
|
|
1113
|
+
return [
|
|
1114
|
+
...points,
|
|
1115
|
+
...points.map((point) => __spreadProps(__spreadValues({}, point), {
|
|
1116
|
+
time: point.time + 1500
|
|
1117
|
+
})),
|
|
1118
|
+
...points.map((point) => __spreadProps(__spreadValues({}, point), {
|
|
1119
|
+
time: point.time + 3e3
|
|
1120
|
+
}))
|
|
1121
|
+
];
|
|
1122
|
+
}
|
|
1123
|
+
return points;
|
|
1110
1124
|
}, [primarySeries]);
|
|
1111
1125
|
const primaryCandles = useMemo2(() => {
|
|
1112
1126
|
if (!primarySeries) {
|
|
@@ -1140,7 +1154,7 @@ var LineChart = ({
|
|
|
1140
1154
|
const timeFormatter = useMemo2(() => {
|
|
1141
1155
|
return resolveTimeFormatter(windowSeconds);
|
|
1142
1156
|
}, [windowSeconds]);
|
|
1143
|
-
const seriesControls = showSeriesControls
|
|
1157
|
+
const seriesControls = showSeriesControls ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
|
|
1144
1158
|
series: normalizedSeries,
|
|
1145
1159
|
activeSeriesId,
|
|
1146
1160
|
handleSeriesChange
|
|
@@ -1173,9 +1187,10 @@ var LineChart = ({
|
|
|
1173
1187
|
series: livelineSeries,
|
|
1174
1188
|
color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
|
|
1175
1189
|
theme: livelineTheme,
|
|
1190
|
+
fill: enableGradients,
|
|
1176
1191
|
grid: true,
|
|
1177
|
-
momentum:
|
|
1178
|
-
pulse:
|
|
1192
|
+
momentum: isLive,
|
|
1193
|
+
pulse: isLive,
|
|
1179
1194
|
window: windowSeconds,
|
|
1180
1195
|
mode: chartType === "candlestick" ? "candle" : "line",
|
|
1181
1196
|
candles: chartType === "candlestick" ? primaryCandles : void 0,
|
|
@@ -1191,7 +1206,8 @@ var LineChart = ({
|
|
|
1191
1206
|
bottom: 28,
|
|
1192
1207
|
left: 12
|
|
1193
1208
|
},
|
|
1194
|
-
loading: isLoading
|
|
1209
|
+
loading: isLoading,
|
|
1210
|
+
lineWidth: 1
|
|
1195
1211
|
}
|
|
1196
1212
|
)
|
|
1197
1213
|
}
|
|
@@ -3093,7 +3109,7 @@ var NumberValue = ({
|
|
|
3093
3109
|
NumberValue.displayName = "NumberValue";
|
|
3094
3110
|
|
|
3095
3111
|
// src/primitives/venue-logo/index.tsx
|
|
3096
|
-
import { useLabels as useLabels8 } from "@agg-market/hooks";
|
|
3112
|
+
import { useAggUiConfig, useLabels as useLabels8 } from "@agg-market/hooks";
|
|
3097
3113
|
|
|
3098
3114
|
// src/primitives/remote-image/index.tsx
|
|
3099
3115
|
import { useRef, useState as useState3 } from "react";
|
|
@@ -3495,9 +3511,12 @@ var VenueLogo = ({
|
|
|
3495
3511
|
title
|
|
3496
3512
|
}) => {
|
|
3497
3513
|
var _a;
|
|
3514
|
+
const { showVenueLogo = true } = useAggUiConfig();
|
|
3498
3515
|
const labels = useLabels8();
|
|
3499
3516
|
const sizeClass = sizeClasses2[size];
|
|
3500
3517
|
const resolvedLabel = (_a = ariaLabel != null ? ariaLabel : labels.venues[venue]) != null ? _a : venueLogoLabels[venue];
|
|
3518
|
+
if (!showVenueLogo)
|
|
3519
|
+
return null;
|
|
3501
3520
|
if (variant === "logo") {
|
|
3502
3521
|
return /* @__PURE__ */ jsx74(
|
|
3503
3522
|
RemoteImage,
|
|
@@ -3571,9 +3590,9 @@ function Badge({
|
|
|
3571
3590
|
)
|
|
3572
3591
|
}, onClick && { onClick }), {
|
|
3573
3592
|
children: [
|
|
3574
|
-
prefix ? /* @__PURE__ */ jsx75("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
|
|
3593
|
+
prefix ? /* @__PURE__ */ jsx75("span", { className: cn(classNames == null ? void 0 : classNames.prefix, "empty:hidden"), children: prefix }) : null,
|
|
3575
3594
|
/* @__PURE__ */ jsx75("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
|
|
3576
|
-
suffix ? /* @__PURE__ */ jsx75("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
|
|
3595
|
+
suffix ? /* @__PURE__ */ jsx75("span", { className: cn(classNames == null ? void 0 : classNames.suffix, "empty:hidden"), children: suffix }) : null
|
|
3577
3596
|
]
|
|
3578
3597
|
})
|
|
3579
3598
|
);
|
|
@@ -4079,7 +4098,11 @@ var StateMessage = ({
|
|
|
4079
4098
|
size: "large",
|
|
4080
4099
|
className: "text-agg-base leading-agg-6",
|
|
4081
4100
|
"aria-label": actionLabel,
|
|
4082
|
-
onClick:
|
|
4101
|
+
onClick: (e) => {
|
|
4102
|
+
e.stopPropagation();
|
|
4103
|
+
e.preventDefault();
|
|
4104
|
+
onAction == null ? void 0 : onAction();
|
|
4105
|
+
},
|
|
4083
4106
|
children: actionLabel
|
|
4084
4107
|
}
|
|
4085
4108
|
) : null
|
|
@@ -4131,7 +4154,7 @@ var getTabButtonClassName = ({
|
|
|
4131
4154
|
return cn(
|
|
4132
4155
|
"cursor-pointer disabled:cursor-not-allowed",
|
|
4133
4156
|
"relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
|
|
4134
|
-
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
|
|
4157
|
+
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-agg-bold",
|
|
4135
4158
|
getMotionClassName(
|
|
4136
4159
|
enableAnimations,
|
|
4137
4160
|
"transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
|
|
@@ -4557,8 +4580,17 @@ var Tabs = ({
|
|
|
4557
4580
|
)
|
|
4558
4581
|
}
|
|
4559
4582
|
) }) : null,
|
|
4560
|
-
item.icon ? /* @__PURE__ */ jsx80("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
4561
|
-
/* @__PURE__ */ jsx80(
|
|
4583
|
+
item.icon ? /* @__PURE__ */ jsx80("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center empty:hidden", children: item.icon }) : null,
|
|
4584
|
+
/* @__PURE__ */ jsx80(
|
|
4585
|
+
"span",
|
|
4586
|
+
{
|
|
4587
|
+
className: cn(
|
|
4588
|
+
"relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase"
|
|
4589
|
+
),
|
|
4590
|
+
"data-text": item.label,
|
|
4591
|
+
children: item.label
|
|
4592
|
+
}
|
|
4593
|
+
)
|
|
4562
4594
|
]
|
|
4563
4595
|
},
|
|
4564
4596
|
item.value
|