@agg-market/ui 6.0.0 → 8.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/README.md +17 -2
- package/dist/{chunk-G6YKGVQR.mjs → chunk-JE4MV5RL.mjs} +18 -60
- package/dist/{chunk-2ICOSP7N.mjs → chunk-KRCRD4AJ.mjs} +11 -14
- package/dist/{chunk-5ZKPBMRK.mjs → chunk-SBLIHCN2.mjs} +21 -24
- package/dist/{chunk-LMOJKJOY.mjs → chunk-TLFRGJ5B.mjs} +334 -217
- package/dist/chunk-WKY3IN52.mjs +4907 -0
- package/dist/events.js +3364 -2660
- package/dist/events.mjs +2 -5
- package/dist/index.js +2693 -1764
- package/dist/index.mjs +610 -38
- package/dist/modals.js +1356 -815
- package/dist/modals.mjs +2 -4
- package/dist/pages.js +3023 -2248
- package/dist/pages.mjs +4 -7
- package/dist/primitives.js +1072 -355
- package/dist/primitives.mjs +38 -30
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1153 -558
- package/dist/trading.mjs +2 -4
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +31 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +31 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +83 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +83 -0
- package/dist/types/auth/connect-button-view/index.d.mts +7 -0
- package/dist/types/auth/connect-button-view/index.d.ts +7 -0
- package/dist/types/auth/index.d.mts +1 -1
- package/dist/types/auth/index.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/primitives/chart/chart-type-switch.d.mts +10 -0
- package/dist/types/primitives/chart/chart-type-switch.d.ts +10 -0
- package/dist/types/primitives/chart/index.d.mts +7 -1
- package/dist/types/primitives/chart/index.d.ts +7 -1
- package/dist/types/primitives/icon/index.d.mts +9 -1
- package/dist/types/primitives/icon/index.d.ts +9 -1
- package/dist/types/primitives/icon/registry.d.mts +32 -0
- package/dist/types/primitives/icon/registry.d.ts +32 -0
- package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/google.d.mts +5 -0
- package/dist/types/primitives/icon/svg/google.d.ts +5 -0
- package/dist/types/primitives/icon/svg/image.d.mts +5 -0
- package/dist/types/primitives/icon/svg/image.d.ts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
- package/dist/types/primitives/index.d.mts +2 -0
- package/dist/types/primitives/index.d.ts +2 -0
- package/dist/types/primitives/inline-alert/index.d.mts +16 -0
- package/dist/types/primitives/inline-alert/index.d.ts +16 -0
- package/dist/types/primitives/remote-image/index.d.mts +6 -0
- package/dist/types/primitives/remote-image/index.d.ts +6 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.mts +16 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.ts +16 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +1 -1
- package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +1 -1
- package/dist/types/trading/types.d.mts +26 -26
- package/dist/types/trading/types.d.ts +26 -26
- package/package.json +3 -15
- package/dist/auth.d.mts +0 -1
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -2290
- package/dist/auth.mjs +0 -8
- package/dist/chunk-ADGL6RFX.mjs +0 -214
- package/dist/chunk-CN7GI2RJ.mjs +0 -585
- package/dist/chunk-HI4EEDN5.mjs +0 -1880
- package/dist/chunk-INRG3D4M.mjs +0 -450
- package/dist/chunk-JE3Z52FD.mjs +0 -345
- package/dist/chunk-MHCHR65A.mjs +0 -165
- package/dist/chunk-PASXFYKQ.mjs +0 -81
- package/dist/chunk-UBBOLLOS.mjs +0 -999
- package/dist/types/auth/connect-button/connect-button.constants.d.mts +0 -10
- package/dist/types/auth/connect-button/connect-button.constants.d.ts +0 -10
- package/dist/types/auth/connect-button/connect-button.types.d.mts +0 -33
- package/dist/types/auth/connect-button/connect-button.types.d.ts +0 -33
- package/dist/types/auth/connect-button/index.d.mts +0 -7
- package/dist/types/auth/connect-button/index.d.ts +0 -7
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Badge,
|
|
3
|
-
|
|
4
|
-
StateMessage,
|
|
5
|
-
SwitchButton,
|
|
6
|
-
Typography
|
|
7
|
-
} from "./chunk-CN7GI2RJ.mjs";
|
|
8
|
-
import {
|
|
3
|
+
Button,
|
|
9
4
|
Card,
|
|
5
|
+
Icon,
|
|
6
|
+
LineChart,
|
|
10
7
|
MarketDetailsOderbookSkeleton,
|
|
8
|
+
RemoteImage,
|
|
11
9
|
Skeleton,
|
|
10
|
+
StateMessage,
|
|
11
|
+
SwitchButton,
|
|
12
12
|
Tabs,
|
|
13
|
+
Typography,
|
|
14
|
+
VenueLogo,
|
|
15
|
+
__objRest,
|
|
16
|
+
__spreadProps,
|
|
17
|
+
__spreadValues,
|
|
13
18
|
baseCardClassName,
|
|
19
|
+
cn,
|
|
14
20
|
detailsBaseCardClassName,
|
|
15
21
|
eventListItemDetailsTimeRanges,
|
|
16
22
|
fallbackLineColors,
|
|
17
23
|
getMarketDetailsTabs,
|
|
24
|
+
getMotionClassName,
|
|
18
25
|
lineColorByVenue,
|
|
19
26
|
marketDetailsBaseCardClassName,
|
|
20
27
|
marketDetailsDefaultIsOpened,
|
|
21
|
-
orderBookRowLimitDefault
|
|
22
|
-
} from "./chunk-UBBOLLOS.mjs";
|
|
23
|
-
import {
|
|
24
|
-
Button,
|
|
25
|
-
Icon,
|
|
26
|
-
VenueLogo,
|
|
27
|
-
__objRest,
|
|
28
|
-
__spreadProps,
|
|
29
|
-
__spreadValues,
|
|
30
|
-
cn,
|
|
31
|
-
getMotionClassName,
|
|
28
|
+
orderBookRowLimitDefault,
|
|
32
29
|
toDate
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WKY3IN52.mjs";
|
|
34
31
|
|
|
35
32
|
// src/events/item/index.tsx
|
|
36
33
|
import dayjs from "dayjs";
|
|
@@ -313,7 +310,7 @@ var EventListItemContent = ({
|
|
|
313
310
|
children: [
|
|
314
311
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
|
|
315
312
|
resolvedImage ? /* @__PURE__ */ jsx(
|
|
316
|
-
|
|
313
|
+
RemoteImage,
|
|
317
314
|
{
|
|
318
315
|
src: resolvedImage,
|
|
319
316
|
alt: "",
|
|
@@ -475,8 +472,88 @@ var EventListItem = (props) => {
|
|
|
475
472
|
EventListItem.displayName = "EventListItem";
|
|
476
473
|
|
|
477
474
|
// src/events/item-details/index.tsx
|
|
478
|
-
import { useEffect, useMemo as
|
|
479
|
-
import { useEvent as useEvent2, useLabels as
|
|
475
|
+
import { useEffect, useMemo as useMemo3, useState } from "react";
|
|
476
|
+
import { useEvent as useEvent2, useLabels as useLabels3, usePriceHistory, useSdkUiConfig as useSdkUiConfig2 } from "@agg-market/hooks";
|
|
477
|
+
|
|
478
|
+
// src/primitives/chart/chart-type-switch.tsx
|
|
479
|
+
import { useLabels as useLabels2 } from "@agg-market/hooks";
|
|
480
|
+
import { useMemo as useMemo2 } from "react";
|
|
481
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
482
|
+
var ChartTypeSwitch = ({
|
|
483
|
+
value,
|
|
484
|
+
onValueChange,
|
|
485
|
+
className
|
|
486
|
+
}) => {
|
|
487
|
+
const labels = useLabels2();
|
|
488
|
+
const options = useMemo2(
|
|
489
|
+
() => [
|
|
490
|
+
{
|
|
491
|
+
value: "line",
|
|
492
|
+
iconName: "chart-line",
|
|
493
|
+
ariaLabel: labels.common.lineChartType
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
value: "candlestick",
|
|
497
|
+
iconName: "chart-candlestick",
|
|
498
|
+
ariaLabel: labels.common.candlestickChartType
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
[labels]
|
|
502
|
+
);
|
|
503
|
+
const handleKeyDown = (event, index) => {
|
|
504
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
event.preventDefault();
|
|
508
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
509
|
+
const nextIndex = (index + direction + options.length) % options.length;
|
|
510
|
+
const nextOption = options[nextIndex];
|
|
511
|
+
if (!nextOption || nextOption.value === value) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
onValueChange(nextOption.value);
|
|
515
|
+
};
|
|
516
|
+
return /* @__PURE__ */ jsx2(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: cn("inline-flex items-center gap-2", className),
|
|
520
|
+
role: "tablist",
|
|
521
|
+
"aria-label": labels.common.chartTypeSwitchAria,
|
|
522
|
+
children: options.map((option, index) => {
|
|
523
|
+
const isActive = option.value === value;
|
|
524
|
+
return /* @__PURE__ */ jsx2(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
type: "button",
|
|
528
|
+
role: "tab",
|
|
529
|
+
"aria-selected": isActive,
|
|
530
|
+
"aria-label": option.ariaLabel,
|
|
531
|
+
tabIndex: isActive ? 0 : -1,
|
|
532
|
+
className: cn(
|
|
533
|
+
"cursor-pointer hover:text-agg-foreground",
|
|
534
|
+
"inline-flex size-5 items-center justify-center rounded-agg-sm bg-transparent p-0",
|
|
535
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-background",
|
|
536
|
+
"transition-colors duration-200 ease-in-out",
|
|
537
|
+
isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
538
|
+
),
|
|
539
|
+
onClick: () => {
|
|
540
|
+
if (isActive) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
onValueChange(option.value);
|
|
544
|
+
},
|
|
545
|
+
onKeyDown: (event) => {
|
|
546
|
+
handleKeyDown(event, index);
|
|
547
|
+
},
|
|
548
|
+
children: /* @__PURE__ */ jsx2(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
|
|
549
|
+
},
|
|
550
|
+
option.value
|
|
551
|
+
);
|
|
552
|
+
})
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
};
|
|
556
|
+
ChartTypeSwitch.displayName = "ChartTypeSwitch";
|
|
480
557
|
|
|
481
558
|
// src/events/item-details/event-list-item-details.utils.ts
|
|
482
559
|
import dayjs2 from "dayjs";
|
|
@@ -604,13 +681,13 @@ var resolveSeriesColor = (venue, index) => {
|
|
|
604
681
|
};
|
|
605
682
|
|
|
606
683
|
// src/events/item-details/index.tsx
|
|
607
|
-
import { jsx as
|
|
684
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
608
685
|
var EventListItemDetailsLoadingState = ({
|
|
609
686
|
classNames,
|
|
610
687
|
ariaLabel
|
|
611
688
|
}) => {
|
|
612
|
-
const labels =
|
|
613
|
-
return /* @__PURE__ */
|
|
689
|
+
const labels = useLabels3();
|
|
690
|
+
return /* @__PURE__ */ jsx3(
|
|
614
691
|
Skeleton,
|
|
615
692
|
{
|
|
616
693
|
view: "event-list-item-details",
|
|
@@ -623,16 +700,16 @@ var EventListItemDetailsUnavailableState = ({
|
|
|
623
700
|
classNames,
|
|
624
701
|
ariaLabel
|
|
625
702
|
}) => {
|
|
626
|
-
const labels =
|
|
627
|
-
return /* @__PURE__ */
|
|
703
|
+
const labels = useLabels3();
|
|
704
|
+
return /* @__PURE__ */ jsx3(
|
|
628
705
|
Card,
|
|
629
706
|
{
|
|
630
707
|
className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
631
708
|
role: "status",
|
|
632
709
|
"aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.unavailableAria,
|
|
633
710
|
children: /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ jsx3(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
|
|
712
|
+
/* @__PURE__ */ jsx3(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
|
|
636
713
|
] })
|
|
637
714
|
}
|
|
638
715
|
);
|
|
@@ -641,8 +718,8 @@ var EventListItemDetailsNotFoundState = ({
|
|
|
641
718
|
classNames,
|
|
642
719
|
ariaLabel
|
|
643
720
|
}) => {
|
|
644
|
-
const labels =
|
|
645
|
-
return /* @__PURE__ */
|
|
721
|
+
const labels = useLabels3();
|
|
722
|
+
return /* @__PURE__ */ jsx3(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx3(
|
|
646
723
|
StateMessage,
|
|
647
724
|
{
|
|
648
725
|
ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
|
|
@@ -687,12 +764,13 @@ var EventListItemDetailsGraphSection = ({
|
|
|
687
764
|
showVenueLogo,
|
|
688
765
|
venueInfo,
|
|
689
766
|
formatPercent,
|
|
690
|
-
selectedTimeRange
|
|
767
|
+
selectedTimeRange,
|
|
768
|
+
selectedChartType
|
|
691
769
|
}) => {
|
|
692
|
-
const labels =
|
|
770
|
+
const labels = useLabels3();
|
|
693
771
|
const [selectedVenue, setSelectedVenue] = useState(null);
|
|
694
772
|
const [activeProbabilityMode, setActiveProbabilityMode] = useState("yes");
|
|
695
|
-
const probabilityModeConfigs =
|
|
773
|
+
const probabilityModeConfigs = useMemo3(() => {
|
|
696
774
|
if (isDateOutcomeMarket) {
|
|
697
775
|
return {
|
|
698
776
|
yes: {
|
|
@@ -720,7 +798,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
720
798
|
}
|
|
721
799
|
};
|
|
722
800
|
}, [isDateOutcomeMarket, selectedOutcomeLabel, switchLabels]);
|
|
723
|
-
const selectedOutcomesByMode =
|
|
801
|
+
const selectedOutcomesByMode = useMemo3(() => {
|
|
724
802
|
return {
|
|
725
803
|
yes: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.yes.sourceOutcomeLabel),
|
|
726
804
|
no: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.no.sourceOutcomeLabel)
|
|
@@ -737,7 +815,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
737
815
|
const nextMode = selectedOutcomeLabel === probabilityModeConfigs.no.sourceOutcomeLabel ? "no" : "yes";
|
|
738
816
|
setActiveProbabilityMode(nextMode);
|
|
739
817
|
}, [isDateOutcomeMarket, probabilityModeConfigs.no.sourceOutcomeLabel, selectedOutcomeLabel]);
|
|
740
|
-
const normalizedVenueDataByMode =
|
|
818
|
+
const normalizedVenueDataByMode = useMemo3(() => {
|
|
741
819
|
const buildModeData = (mode) => {
|
|
742
820
|
const modeConfig = probabilityModeConfigs[mode];
|
|
743
821
|
return selectedOutcomesByMode[mode].map((outcomeByVenue, index) => {
|
|
@@ -758,7 +836,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
758
836
|
no: buildModeData("no")
|
|
759
837
|
};
|
|
760
838
|
}, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
|
|
761
|
-
const allOutcomesForHistory =
|
|
839
|
+
const allOutcomesForHistory = useMemo3(() => {
|
|
762
840
|
const outcomeByModeAndId = /* @__PURE__ */ new Map();
|
|
763
841
|
probabilityModeOrder.forEach((mode) => {
|
|
764
842
|
selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
|
|
@@ -770,10 +848,10 @@ var EventListItemDetailsGraphSection = ({
|
|
|
770
848
|
});
|
|
771
849
|
return [...outcomeByModeAndId.values()];
|
|
772
850
|
}, [selectedOutcomesByMode]);
|
|
773
|
-
const priceHistoryGroups =
|
|
851
|
+
const priceHistoryGroups = useMemo3(() => {
|
|
774
852
|
return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
|
|
775
853
|
}, [allOutcomesForHistory, canonicalMarketId]);
|
|
776
|
-
const timeWindow =
|
|
854
|
+
const timeWindow = useMemo3(() => {
|
|
777
855
|
return getTimeWindowByRange(selectedTimeRange);
|
|
778
856
|
}, [selectedTimeRange]);
|
|
779
857
|
const {
|
|
@@ -786,7 +864,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
786
864
|
}, timeWindow), {
|
|
787
865
|
enabled: priceHistoryGroups.length > 0
|
|
788
866
|
}));
|
|
789
|
-
const priceHistoryByVenue =
|
|
867
|
+
const priceHistoryByVenue = useMemo3(() => {
|
|
790
868
|
const historyByVenue = /* @__PURE__ */ new Map();
|
|
791
869
|
if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
|
|
792
870
|
return historyByVenue;
|
|
@@ -802,7 +880,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
802
880
|
});
|
|
803
881
|
return historyByVenue;
|
|
804
882
|
}, [priceHistoryData]);
|
|
805
|
-
const chartSeriesByMode =
|
|
883
|
+
const chartSeriesByMode = useMemo3(() => {
|
|
806
884
|
const buildSeries = (mode) => {
|
|
807
885
|
const modeConfig = probabilityModeConfigs[mode];
|
|
808
886
|
const chartSeries = [];
|
|
@@ -819,10 +897,19 @@ var EventListItemDetailsGraphSection = ({
|
|
|
819
897
|
const probability = normalizeProbability(point.price);
|
|
820
898
|
if (probability == null || !Number.isFinite(point.timestamp))
|
|
821
899
|
return null;
|
|
822
|
-
|
|
900
|
+
const open = normalizeProbability(point.open);
|
|
901
|
+
const high = normalizeProbability(point.high);
|
|
902
|
+
const low = normalizeProbability(point.low);
|
|
903
|
+
const close = normalizeProbability(point.close);
|
|
904
|
+
const transformedPoint = {
|
|
823
905
|
time: point.timestamp,
|
|
824
|
-
value: clampProbability(modeConfig.transformProbability(probability)) * 100
|
|
906
|
+
value: clampProbability(modeConfig.transformProbability(probability)) * 100,
|
|
907
|
+
open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
|
|
908
|
+
high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
|
|
909
|
+
low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
|
|
910
|
+
close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
|
|
825
911
|
};
|
|
912
|
+
return transformedPoint;
|
|
826
913
|
}).filter((point) => point != null);
|
|
827
914
|
if (points.length === 0)
|
|
828
915
|
return;
|
|
@@ -842,13 +929,13 @@ var EventListItemDetailsGraphSection = ({
|
|
|
842
929
|
no: buildSeries("no")
|
|
843
930
|
};
|
|
844
931
|
}, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
|
|
845
|
-
const visibleChartSeries =
|
|
932
|
+
const visibleChartSeries = useMemo3(() => {
|
|
846
933
|
const modeSeries = chartSeriesByMode[activeProbabilityMode];
|
|
847
934
|
if (!selectedVenue)
|
|
848
935
|
return modeSeries;
|
|
849
936
|
return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
|
|
850
937
|
}, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
|
|
851
|
-
const segmentedDisplayItems =
|
|
938
|
+
const segmentedDisplayItems = useMemo3(() => {
|
|
852
939
|
return probabilityModeOrder.map((mode) => {
|
|
853
940
|
const averageProbability = resolveAverageProbability(
|
|
854
941
|
normalizedVenueDataByMode[mode].map((venueData) => venueData.probability)
|
|
@@ -889,14 +976,14 @@ var EventListItemDetailsGraphSection = ({
|
|
|
889
976
|
void Promise.all(priceHistoryResults.map((result) => result.refetch()));
|
|
890
977
|
};
|
|
891
978
|
if (priceHistoryError) {
|
|
892
|
-
return /* @__PURE__ */
|
|
979
|
+
return /* @__PURE__ */ jsx3(
|
|
893
980
|
"div",
|
|
894
981
|
{
|
|
895
982
|
className: cn(
|
|
896
983
|
"w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
|
|
897
984
|
classNames == null ? void 0 : classNames.chart
|
|
898
985
|
),
|
|
899
|
-
children: /* @__PURE__ */
|
|
986
|
+
children: /* @__PURE__ */ jsx3(
|
|
900
987
|
StateMessage,
|
|
901
988
|
{
|
|
902
989
|
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
@@ -911,13 +998,14 @@ var EventListItemDetailsGraphSection = ({
|
|
|
911
998
|
}
|
|
912
999
|
);
|
|
913
1000
|
}
|
|
914
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ jsx3(
|
|
915
1002
|
LineChart,
|
|
916
1003
|
{
|
|
917
1004
|
classNames: { root: classNames == null ? void 0 : classNames.chart },
|
|
918
1005
|
series: visibleChartSeries,
|
|
919
1006
|
height: 300,
|
|
920
1007
|
isLoading: isPriceHistoryLoading,
|
|
1008
|
+
chartType: selectedChartType,
|
|
921
1009
|
showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
|
|
922
1010
|
renderSeriesControls: () => {
|
|
923
1011
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -925,7 +1013,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
925
1013
|
{
|
|
926
1014
|
className: cn("flex flex-row items-center justify-between gap-4", classNames == null ? void 0 : classNames.summary),
|
|
927
1015
|
children: [
|
|
928
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ jsx3(
|
|
929
1017
|
"div",
|
|
930
1018
|
{
|
|
931
1019
|
className: cn(
|
|
@@ -936,7 +1024,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
936
1024
|
var _a;
|
|
937
1025
|
const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
|
|
938
1026
|
const isActiveVenue = selectedVenue === venueData.venue;
|
|
939
|
-
return /* @__PURE__ */
|
|
1027
|
+
return /* @__PURE__ */ jsx3(
|
|
940
1028
|
"button",
|
|
941
1029
|
{
|
|
942
1030
|
type: "button",
|
|
@@ -945,12 +1033,12 @@ var EventListItemDetailsGraphSection = ({
|
|
|
945
1033
|
className: cn(
|
|
946
1034
|
"rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover"
|
|
947
1035
|
),
|
|
948
|
-
children: /* @__PURE__ */
|
|
1036
|
+
children: /* @__PURE__ */ jsx3(
|
|
949
1037
|
Badge,
|
|
950
1038
|
{
|
|
951
1039
|
text,
|
|
952
1040
|
size: "large",
|
|
953
|
-
prefix: showVenueLogo ? /* @__PURE__ */
|
|
1041
|
+
prefix: showVenueLogo ? /* @__PURE__ */ jsx3(
|
|
954
1042
|
VenueLogo,
|
|
955
1043
|
{
|
|
956
1044
|
venue: venueData.venue,
|
|
@@ -975,7 +1063,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
975
1063
|
})
|
|
976
1064
|
}
|
|
977
1065
|
),
|
|
978
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ jsx3(
|
|
979
1067
|
SwitchButton,
|
|
980
1068
|
{
|
|
981
1069
|
ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
|
|
@@ -1009,15 +1097,15 @@ var EventListItemDetailsContent = ({
|
|
|
1009
1097
|
}) => {
|
|
1010
1098
|
var _a, _b;
|
|
1011
1099
|
const config = useSdkUiConfig2();
|
|
1012
|
-
const labels =
|
|
1013
|
-
const venueMarkets =
|
|
1100
|
+
const labels = useLabels3();
|
|
1101
|
+
const venueMarkets = useMemo3(() => {
|
|
1014
1102
|
var _a2, _b2, _c;
|
|
1015
1103
|
return (_c = (_b2 = (_a2 = event.markets) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.venueMarkets) != null ? _c : [];
|
|
1016
1104
|
}, [event.markets]);
|
|
1017
|
-
const primaryVenueMarket =
|
|
1105
|
+
const primaryVenueMarket = useMemo3(() => {
|
|
1018
1106
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
1019
1107
|
}, [venueMarkets]);
|
|
1020
|
-
const outcomeLabels =
|
|
1108
|
+
const outcomeLabels = useMemo3(() => {
|
|
1021
1109
|
return resolveOutcomeLabels(venueMarkets);
|
|
1022
1110
|
}, [venueMarkets]);
|
|
1023
1111
|
const [selectedOutcomeLabel, setSelectedOutcomeLabel] = useState(() => {
|
|
@@ -1026,6 +1114,7 @@ var EventListItemDetailsContent = ({
|
|
|
1026
1114
|
const [selectedTimeRange, setSelectedTimeRange] = useState(() => {
|
|
1027
1115
|
return getDefaultSelectedTimeRange(defaultTimeRange);
|
|
1028
1116
|
});
|
|
1117
|
+
const [selectedChartType, setSelectedChartType] = useState("line");
|
|
1029
1118
|
useEffect(() => {
|
|
1030
1119
|
setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
|
|
1031
1120
|
}, [defaultTimeRange]);
|
|
@@ -1033,7 +1122,7 @@ var EventListItemDetailsContent = ({
|
|
|
1033
1122
|
const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
|
|
1034
1123
|
const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
|
|
1035
1124
|
const outcomeSelectorLabels = outcomeLabels;
|
|
1036
|
-
const probabilityByLabel =
|
|
1125
|
+
const probabilityByLabel = useMemo3(() => {
|
|
1037
1126
|
return new Map(
|
|
1038
1127
|
outcomeLabels.map((label) => {
|
|
1039
1128
|
const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
|
|
@@ -1046,7 +1135,7 @@ var EventListItemDetailsContent = ({
|
|
|
1046
1135
|
})
|
|
1047
1136
|
);
|
|
1048
1137
|
}, [outcomeLabels, venueMarkets]);
|
|
1049
|
-
const mainOutcomeLabel =
|
|
1138
|
+
const mainOutcomeLabel = useMemo3(() => {
|
|
1050
1139
|
if (outcomeLabels.length === 0)
|
|
1051
1140
|
return void 0;
|
|
1052
1141
|
return [...outcomeLabels].sort((left, right) => {
|
|
@@ -1067,7 +1156,7 @@ var EventListItemDetailsContent = ({
|
|
|
1067
1156
|
const fallbackOutcomeLabel = isDateOutcomeMarket ? resolveDefaultOutcomeLabel(outcomeLabels) : mainOutcomeLabel != null ? mainOutcomeLabel : resolveDefaultOutcomeLabel(outcomeLabels);
|
|
1068
1157
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
1069
1158
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
1070
|
-
const switchLabels =
|
|
1159
|
+
const switchLabels = useMemo3(() => {
|
|
1071
1160
|
var _a2, _b2;
|
|
1072
1161
|
if (isDateOutcomeMarket) {
|
|
1073
1162
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
@@ -1088,7 +1177,7 @@ var EventListItemDetailsContent = ({
|
|
|
1088
1177
|
outcomeLabels,
|
|
1089
1178
|
probabilityByLabel
|
|
1090
1179
|
]);
|
|
1091
|
-
const volumeLabel =
|
|
1180
|
+
const volumeLabel = useMemo3(() => {
|
|
1092
1181
|
var _a2;
|
|
1093
1182
|
const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a2 = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a2 : void 0;
|
|
1094
1183
|
if (typeof resolvedVolume !== "number")
|
|
@@ -1096,7 +1185,7 @@ var EventListItemDetailsContent = ({
|
|
|
1096
1185
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
1097
1186
|
}, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
|
|
1098
1187
|
if (!primaryVenueMarket || !selectedOutcomeLabel) {
|
|
1099
|
-
return /* @__PURE__ */
|
|
1188
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
|
|
1100
1189
|
}
|
|
1101
1190
|
return /* @__PURE__ */ jsxs2(
|
|
1102
1191
|
Card,
|
|
@@ -1113,8 +1202,8 @@ var EventListItemDetailsContent = ({
|
|
|
1113
1202
|
classNames == null ? void 0 : classNames.header
|
|
1114
1203
|
),
|
|
1115
1204
|
children: [
|
|
1116
|
-
resolvedImage ? /* @__PURE__ */
|
|
1117
|
-
|
|
1205
|
+
resolvedImage ? /* @__PURE__ */ jsx3(
|
|
1206
|
+
RemoteImage,
|
|
1118
1207
|
{
|
|
1119
1208
|
src: resolvedImage,
|
|
1120
1209
|
alt: "",
|
|
@@ -1122,7 +1211,7 @@ var EventListItemDetailsContent = ({
|
|
|
1122
1211
|
}
|
|
1123
1212
|
) : null,
|
|
1124
1213
|
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
|
|
1125
|
-
/* @__PURE__ */
|
|
1214
|
+
/* @__PURE__ */ jsx3(
|
|
1126
1215
|
Typography,
|
|
1127
1216
|
{
|
|
1128
1217
|
variant: "body-strong",
|
|
@@ -1134,7 +1223,7 @@ var EventListItemDetailsContent = ({
|
|
|
1134
1223
|
children: resolvedTitle
|
|
1135
1224
|
}
|
|
1136
1225
|
),
|
|
1137
|
-
outcomeSelectorLabels.length > 2 ? /* @__PURE__ */
|
|
1226
|
+
outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ jsx3(
|
|
1138
1227
|
"div",
|
|
1139
1228
|
{
|
|
1140
1229
|
className: cn(
|
|
@@ -1144,7 +1233,7 @@ var EventListItemDetailsContent = ({
|
|
|
1144
1233
|
children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
|
|
1145
1234
|
const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
|
|
1146
1235
|
const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
|
|
1147
|
-
return /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsx3(
|
|
1148
1237
|
Button,
|
|
1149
1238
|
{
|
|
1150
1239
|
size: "small",
|
|
@@ -1167,12 +1256,12 @@ var EventListItemDetailsContent = ({
|
|
|
1167
1256
|
]
|
|
1168
1257
|
}
|
|
1169
1258
|
),
|
|
1170
|
-
detailsStats && detailsStats.length > 0 ? /* @__PURE__ */
|
|
1259
|
+
detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ jsx3("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
|
|
1171
1260
|
const deltaClassName = statItem.deltaTone === "positive" ? "text-agg-success!" : statItem.deltaTone === "negative" ? "text-agg-error!" : "text-agg-muted-foreground";
|
|
1172
1261
|
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1", children: [
|
|
1173
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsx3(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
|
|
1174
1263
|
/* @__PURE__ */ jsxs2("div", { className: "flex items-baseline gap-1", children: [
|
|
1175
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ jsx3(
|
|
1176
1265
|
Typography,
|
|
1177
1266
|
{
|
|
1178
1267
|
variant: "body",
|
|
@@ -1180,11 +1269,11 @@ var EventListItemDetailsContent = ({
|
|
|
1180
1269
|
children: statItem.value
|
|
1181
1270
|
}
|
|
1182
1271
|
),
|
|
1183
|
-
statItem.delta ? /* @__PURE__ */
|
|
1272
|
+
statItem.delta ? /* @__PURE__ */ jsx3(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
|
|
1184
1273
|
] })
|
|
1185
1274
|
] }, `${statItem.label}-${statItem.value}`);
|
|
1186
1275
|
}) }) : null,
|
|
1187
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ jsx3(
|
|
1188
1277
|
EventListItemDetailsGraphSection,
|
|
1189
1278
|
{
|
|
1190
1279
|
venueMarkets,
|
|
@@ -1197,31 +1286,36 @@ var EventListItemDetailsContent = ({
|
|
|
1197
1286
|
showVenueLogo,
|
|
1198
1287
|
venueInfo,
|
|
1199
1288
|
formatPercent: config.formatPercent,
|
|
1200
|
-
selectedTimeRange
|
|
1289
|
+
selectedTimeRange,
|
|
1290
|
+
selectedChartType
|
|
1201
1291
|
}
|
|
1202
1292
|
),
|
|
1203
1293
|
/* @__PURE__ */ jsxs2("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1294
|
+
/* @__PURE__ */ jsx3(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
|
|
1295
|
+
/* @__PURE__ */ jsxs2("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
|
|
1296
|
+
/* @__PURE__ */ jsx3(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
|
|
1297
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
|
|
1298
|
+
eventListItemDetailsTimeRanges.map((timeRange) => {
|
|
1299
|
+
const isActive = timeRange === selectedTimeRange;
|
|
1300
|
+
return /* @__PURE__ */ jsx3(
|
|
1301
|
+
Button,
|
|
1302
|
+
{
|
|
1303
|
+
size: "small",
|
|
1304
|
+
variant: "tertiary",
|
|
1305
|
+
className: cn(
|
|
1306
|
+
"h-auto min-w-0 rounded-none px-0 py-0 text-agg-xs leading-agg-4 md:text-agg-sm md:leading-agg-5",
|
|
1307
|
+
"border-0 bg-transparent shadow-none",
|
|
1308
|
+
"hover:text-agg-foreground!",
|
|
1309
|
+
isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
|
|
1310
|
+
),
|
|
1311
|
+
"aria-pressed": isActive,
|
|
1312
|
+
onClick: () => setSelectedTimeRange(timeRange),
|
|
1313
|
+
children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
|
|
1314
|
+
},
|
|
1315
|
+
timeRange
|
|
1316
|
+
);
|
|
1317
|
+
})
|
|
1318
|
+
] })
|
|
1225
1319
|
] })
|
|
1226
1320
|
]
|
|
1227
1321
|
}
|
|
@@ -1241,11 +1335,11 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
1241
1335
|
} = useEvent2(eventId, {
|
|
1242
1336
|
enabled: !!eventId
|
|
1243
1337
|
});
|
|
1244
|
-
const resolvedEvent =
|
|
1338
|
+
const resolvedEvent = useMemo3(() => {
|
|
1245
1339
|
return resolveEventListItemEvent(fetchedEvent);
|
|
1246
1340
|
}, [fetchedEvent]);
|
|
1247
1341
|
if (!eventId) {
|
|
1248
|
-
return /* @__PURE__ */
|
|
1342
|
+
return /* @__PURE__ */ jsx3(
|
|
1249
1343
|
EventListItemDetailsUnavailableState,
|
|
1250
1344
|
{
|
|
1251
1345
|
classNames: rest.classNames,
|
|
@@ -1254,16 +1348,16 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
1254
1348
|
);
|
|
1255
1349
|
}
|
|
1256
1350
|
if (isLoading) {
|
|
1257
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
1258
1352
|
}
|
|
1259
1353
|
if (isErrorWithStatus(error, 404)) {
|
|
1260
|
-
return /* @__PURE__ */
|
|
1354
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
1261
1355
|
}
|
|
1262
1356
|
if (!fetchedEvent && !isError) {
|
|
1263
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
|
|
1264
1358
|
}
|
|
1265
1359
|
if (!resolvedEvent) {
|
|
1266
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ jsx3(
|
|
1267
1361
|
EventListItemDetailsUnavailableState,
|
|
1268
1362
|
{
|
|
1269
1363
|
classNames: rest.classNames,
|
|
@@ -1271,15 +1365,15 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
1271
1365
|
}
|
|
1272
1366
|
);
|
|
1273
1367
|
}
|
|
1274
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
|
|
1275
1369
|
};
|
|
1276
1370
|
var EventListItemDetails = (props) => {
|
|
1277
1371
|
if (props.isLoading) {
|
|
1278
|
-
return /* @__PURE__ */
|
|
1372
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
|
|
1279
1373
|
}
|
|
1280
1374
|
if ("event" in props && props.event) {
|
|
1281
1375
|
const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
|
|
1282
|
-
return /* @__PURE__ */
|
|
1376
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsContent, __spreadValues({ event }, rest));
|
|
1283
1377
|
}
|
|
1284
1378
|
if ("eventId" in props && typeof props.eventId === "string") {
|
|
1285
1379
|
const {
|
|
@@ -1304,9 +1398,9 @@ var EventListItemDetails = (props) => {
|
|
|
1304
1398
|
ariaLabel: ariaLabelOverride,
|
|
1305
1399
|
defaultTimeRange: defaultTimeRangeOverride
|
|
1306
1400
|
};
|
|
1307
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsx3(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
|
|
1308
1402
|
}
|
|
1309
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsx3(
|
|
1310
1404
|
EventListItemDetailsUnavailableState,
|
|
1311
1405
|
{
|
|
1312
1406
|
classNames: props.classNames,
|
|
@@ -1317,10 +1411,10 @@ var EventListItemDetails = (props) => {
|
|
|
1317
1411
|
EventListItemDetails.displayName = "EventListItemDetails";
|
|
1318
1412
|
|
|
1319
1413
|
// src/events/market-details/index.tsx
|
|
1320
|
-
import { useEffect as useEffect2, useId, useMemo as
|
|
1414
|
+
import { useEffect as useEffect2, useId, useMemo as useMemo4, useState as useState2 } from "react";
|
|
1321
1415
|
import {
|
|
1322
1416
|
useEvent as useEvent3,
|
|
1323
|
-
useLabels as
|
|
1417
|
+
useLabels as useLabels4,
|
|
1324
1418
|
useOrderBook,
|
|
1325
1419
|
usePriceHistory as usePriceHistory2,
|
|
1326
1420
|
useSdkUiConfig as useSdkUiConfig3
|
|
@@ -1556,14 +1650,14 @@ var buildMarketDetailsModel = ({
|
|
|
1556
1650
|
};
|
|
1557
1651
|
|
|
1558
1652
|
// src/events/market-details/index.tsx
|
|
1559
|
-
import { Fragment, jsx as
|
|
1653
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1560
1654
|
var MarketDetailsLoadingState = ({
|
|
1561
1655
|
isOpened = marketDetailsDefaultIsOpened,
|
|
1562
1656
|
ariaLabel,
|
|
1563
1657
|
classNames
|
|
1564
1658
|
}) => {
|
|
1565
|
-
const labels =
|
|
1566
|
-
return /* @__PURE__ */
|
|
1659
|
+
const labels = useLabels4();
|
|
1660
|
+
return /* @__PURE__ */ jsx4(
|
|
1567
1661
|
Skeleton,
|
|
1568
1662
|
{
|
|
1569
1663
|
view: isOpened ? "market-details-detailed" : "market-details-minified",
|
|
@@ -1576,16 +1670,16 @@ var MarketDetailsUnavailableState = ({
|
|
|
1576
1670
|
ariaLabel,
|
|
1577
1671
|
classNames
|
|
1578
1672
|
}) => {
|
|
1579
|
-
const labels =
|
|
1580
|
-
return /* @__PURE__ */
|
|
1673
|
+
const labels = useLabels4();
|
|
1674
|
+
return /* @__PURE__ */ jsx4(
|
|
1581
1675
|
Card,
|
|
1582
1676
|
{
|
|
1583
1677
|
className: cn(marketDetailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
1584
1678
|
role: "status",
|
|
1585
1679
|
"aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
|
|
1586
1680
|
children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 p-5", children: [
|
|
1587
|
-
/* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
|
|
1682
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
|
|
1589
1683
|
] })
|
|
1590
1684
|
}
|
|
1591
1685
|
);
|
|
@@ -1594,8 +1688,8 @@ var MarketDetailsNotFoundState = ({
|
|
|
1594
1688
|
ariaLabel,
|
|
1595
1689
|
classNames
|
|
1596
1690
|
}) => {
|
|
1597
|
-
const labels =
|
|
1598
|
-
return /* @__PURE__ */
|
|
1691
|
+
const labels = useLabels4();
|
|
1692
|
+
return /* @__PURE__ */ jsx4(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx4(
|
|
1599
1693
|
StateMessage,
|
|
1600
1694
|
{
|
|
1601
1695
|
ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
|
|
@@ -1612,7 +1706,7 @@ var OrderBookRows = ({
|
|
|
1612
1706
|
formatCurrency,
|
|
1613
1707
|
visibleRows
|
|
1614
1708
|
}) => {
|
|
1615
|
-
const labels =
|
|
1709
|
+
const labels = useLabels4();
|
|
1616
1710
|
const isAsks = title === labels.marketDetails.asks;
|
|
1617
1711
|
const priceClassName = isAsks ? "text-agg-orderbook-ask" : "text-agg-orderbook-bid";
|
|
1618
1712
|
const barClassName = isAsks ? "bg-agg-orderbook-ask/10" : "bg-agg-orderbook-bid/10";
|
|
@@ -1622,8 +1716,8 @@ var OrderBookRows = ({
|
|
|
1622
1716
|
const orderBookRowGapPx = 8;
|
|
1623
1717
|
const orderBookVisibleHeightPx = maxVisibleRows * orderBookRowHeightPx + Math.max(0, maxVisibleRows - 1) * (orderBookDividerHeightPx + orderBookRowGapPx);
|
|
1624
1718
|
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "caption-caps", children: title }),
|
|
1720
|
+
/* @__PURE__ */ jsx4(
|
|
1627
1721
|
"div",
|
|
1628
1722
|
{
|
|
1629
1723
|
className: "overflow-y-auto pr-1 flex flex-col gap-2",
|
|
@@ -1633,8 +1727,8 @@ var OrderBookRows = ({
|
|
|
1633
1727
|
children: rows.map((row, index) => /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
1634
1728
|
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2 md:grid-cols-[88px_1fr_1fr_minmax(120px,220px)] md:gap-6", children: [
|
|
1635
1729
|
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 md:gap-3", children: [
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: row.venue, size: "small" }),
|
|
1731
|
+
/* @__PURE__ */ jsx4(
|
|
1638
1732
|
"span",
|
|
1639
1733
|
{
|
|
1640
1734
|
className: cn(
|
|
@@ -1645,9 +1739,9 @@ var OrderBookRows = ({
|
|
|
1645
1739
|
}
|
|
1646
1740
|
)
|
|
1647
1741
|
] }),
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatNumber(row.size) }),
|
|
1743
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatCurrency(row.total) }),
|
|
1744
|
+
/* @__PURE__ */ jsx4("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx4(
|
|
1651
1745
|
"div",
|
|
1652
1746
|
{
|
|
1653
1747
|
"aria-hidden": "true",
|
|
@@ -1658,7 +1752,7 @@ var OrderBookRows = ({
|
|
|
1658
1752
|
}
|
|
1659
1753
|
) })
|
|
1660
1754
|
] }),
|
|
1661
|
-
index < rows.length - 1 ? /* @__PURE__ */
|
|
1755
|
+
index < rows.length - 1 ? /* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }) : null
|
|
1662
1756
|
] }, row.id))
|
|
1663
1757
|
}
|
|
1664
1758
|
)
|
|
@@ -1696,9 +1790,9 @@ var MarketDetailsContent = ({
|
|
|
1696
1790
|
otherContent
|
|
1697
1791
|
}) => {
|
|
1698
1792
|
const config = useSdkUiConfig3();
|
|
1699
|
-
const labels =
|
|
1793
|
+
const labels = useLabels4();
|
|
1700
1794
|
const detailsContentId = useId();
|
|
1701
|
-
const model =
|
|
1795
|
+
const model = useMemo4(() => {
|
|
1702
1796
|
return buildMarketDetailsModel({
|
|
1703
1797
|
event,
|
|
1704
1798
|
marketId,
|
|
@@ -1708,10 +1802,10 @@ var MarketDetailsContent = ({
|
|
|
1708
1802
|
labels
|
|
1709
1803
|
});
|
|
1710
1804
|
}, [config.formatCompactCurrency, event, image, labels, marketId, title]);
|
|
1711
|
-
const resolvedMarket =
|
|
1805
|
+
const resolvedMarket = useMemo4(() => {
|
|
1712
1806
|
return resolveMarket(event, marketId);
|
|
1713
1807
|
}, [event, marketId]);
|
|
1714
|
-
const marketDetailsTabs =
|
|
1808
|
+
const marketDetailsTabs = useMemo4(() => {
|
|
1715
1809
|
return getMarketDetailsTabs(labels);
|
|
1716
1810
|
}, [labels]);
|
|
1717
1811
|
const [selectedTab, setSelectedTab] = useState2(
|
|
@@ -1722,6 +1816,7 @@ var MarketDetailsContent = ({
|
|
|
1722
1816
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
1723
1817
|
}, [defaultTab]);
|
|
1724
1818
|
const [selectedTimeRange, setSelectedTimeRange] = useState2(defaultTimeRange);
|
|
1819
|
+
const [selectedChartType, setSelectedChartType] = useState2("line");
|
|
1725
1820
|
useEffect2(() => {
|
|
1726
1821
|
setSelectedTimeRange(defaultTimeRange);
|
|
1727
1822
|
}, [defaultTimeRange]);
|
|
@@ -1738,17 +1833,17 @@ var MarketDetailsContent = ({
|
|
|
1738
1833
|
resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel)
|
|
1739
1834
|
);
|
|
1740
1835
|
}, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
|
|
1741
|
-
const headerOutcomeItems =
|
|
1836
|
+
const headerOutcomeItems = useMemo4(() => {
|
|
1742
1837
|
if (!model)
|
|
1743
1838
|
return [];
|
|
1744
1839
|
return resolveHeaderOutcomeItems(model.market.venueMarkets, selectedOutcomeLabel);
|
|
1745
1840
|
}, [model, selectedOutcomeLabel]);
|
|
1746
|
-
const headlineProbability =
|
|
1841
|
+
const headlineProbability = useMemo4(() => {
|
|
1747
1842
|
if (!model || !selectedOutcomeLabel)
|
|
1748
1843
|
return void 0;
|
|
1749
1844
|
return model.probabilityByLabel.get(selectedOutcomeLabel);
|
|
1750
1845
|
}, [model, selectedOutcomeLabel]);
|
|
1751
|
-
const outcomesByLabel =
|
|
1846
|
+
const outcomesByLabel = useMemo4(() => {
|
|
1752
1847
|
const outcomesByLabelMap = /* @__PURE__ */ new Map();
|
|
1753
1848
|
if (!model) {
|
|
1754
1849
|
return outcomesByLabelMap;
|
|
@@ -1761,16 +1856,16 @@ var MarketDetailsContent = ({
|
|
|
1761
1856
|
});
|
|
1762
1857
|
return outcomesByLabelMap;
|
|
1763
1858
|
}, [headerOutcomeItems, model]);
|
|
1764
|
-
const selectedOutcomesByVenue =
|
|
1859
|
+
const selectedOutcomesByVenue = useMemo4(() => {
|
|
1765
1860
|
var _a;
|
|
1766
1861
|
if (!selectedOutcomeLabel)
|
|
1767
1862
|
return [];
|
|
1768
1863
|
return (_a = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a : [];
|
|
1769
1864
|
}, [outcomesByLabel, selectedOutcomeLabel]);
|
|
1770
|
-
const timeWindow =
|
|
1865
|
+
const timeWindow = useMemo4(() => {
|
|
1771
1866
|
return getTimeWindowByRange(selectedTimeRange);
|
|
1772
1867
|
}, [selectedTimeRange]);
|
|
1773
|
-
const graphOutcomes =
|
|
1868
|
+
const graphOutcomes = useMemo4(() => {
|
|
1774
1869
|
const uniqueOutcomesByVenueAndId = /* @__PURE__ */ new Map();
|
|
1775
1870
|
outcomesByLabel.forEach((outcomes) => {
|
|
1776
1871
|
outcomes.forEach((outcomeByVenue) => {
|
|
@@ -1783,7 +1878,7 @@ var MarketDetailsContent = ({
|
|
|
1783
1878
|
return [...uniqueOutcomesByVenueAndId.values()];
|
|
1784
1879
|
}, [outcomesByLabel]);
|
|
1785
1880
|
const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
|
|
1786
|
-
const priceHistoryGroups =
|
|
1881
|
+
const priceHistoryGroups = useMemo4(() => {
|
|
1787
1882
|
return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
|
|
1788
1883
|
}, [canonicalMarketIdForHistory, graphOutcomes]);
|
|
1789
1884
|
const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = usePriceHistory2(__spreadProps(__spreadValues({
|
|
@@ -1791,7 +1886,7 @@ var MarketDetailsContent = ({
|
|
|
1791
1886
|
}, timeWindow), {
|
|
1792
1887
|
enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
|
|
1793
1888
|
}));
|
|
1794
|
-
const orderBookInputs =
|
|
1889
|
+
const orderBookInputs = useMemo4(() => {
|
|
1795
1890
|
return selectedOutcomesByVenue.map(({ market, outcome }) => ({
|
|
1796
1891
|
market,
|
|
1797
1892
|
outcome,
|
|
@@ -1807,19 +1902,19 @@ var MarketDetailsContent = ({
|
|
|
1807
1902
|
orderbooks: orderBookInputs,
|
|
1808
1903
|
enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0
|
|
1809
1904
|
});
|
|
1810
|
-
const askRows =
|
|
1905
|
+
const askRows = useMemo4(() => {
|
|
1811
1906
|
return resolveOrderBookRows({
|
|
1812
1907
|
data: orderBookData,
|
|
1813
1908
|
side: "asks"
|
|
1814
1909
|
});
|
|
1815
1910
|
}, [orderBookData]);
|
|
1816
|
-
const bidRows =
|
|
1911
|
+
const bidRows = useMemo4(() => {
|
|
1817
1912
|
return resolveOrderBookRows({
|
|
1818
1913
|
data: orderBookData,
|
|
1819
1914
|
side: "bids"
|
|
1820
1915
|
});
|
|
1821
1916
|
}, [orderBookData]);
|
|
1822
|
-
const priceHistoryByVenue =
|
|
1917
|
+
const priceHistoryByVenue = useMemo4(() => {
|
|
1823
1918
|
const historyByVenue = /* @__PURE__ */ new Map();
|
|
1824
1919
|
if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
|
|
1825
1920
|
return historyByVenue;
|
|
@@ -1835,7 +1930,7 @@ var MarketDetailsContent = ({
|
|
|
1835
1930
|
});
|
|
1836
1931
|
return historyByVenue;
|
|
1837
1932
|
}, [priceHistoryData]);
|
|
1838
|
-
const graphSeriesByOutcomeLabel =
|
|
1933
|
+
const graphSeriesByOutcomeLabel = useMemo4(() => {
|
|
1839
1934
|
const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
|
|
1840
1935
|
const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
|
|
1841
1936
|
var _a, _b;
|
|
@@ -1863,7 +1958,11 @@ var MarketDetailsContent = ({
|
|
|
1863
1958
|
return;
|
|
1864
1959
|
const points = matchingHistory.points.map((point) => ({
|
|
1865
1960
|
time: point.timestamp,
|
|
1866
|
-
value: point.price * 100
|
|
1961
|
+
value: point.price * 100,
|
|
1962
|
+
open: point.open == null ? void 0 : point.open * 100,
|
|
1963
|
+
high: point.high == null ? void 0 : point.high * 100,
|
|
1964
|
+
low: point.low == null ? void 0 : point.low * 100,
|
|
1965
|
+
close: point.close == null ? void 0 : point.close * 100
|
|
1867
1966
|
})).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
|
|
1868
1967
|
if (points.length === 0)
|
|
1869
1968
|
return;
|
|
@@ -1878,7 +1977,7 @@ var MarketDetailsContent = ({
|
|
|
1878
1977
|
});
|
|
1879
1978
|
return seriesByOutcomeLabel;
|
|
1880
1979
|
}, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
|
|
1881
|
-
const graphSeries =
|
|
1980
|
+
const graphSeries = useMemo4(() => {
|
|
1882
1981
|
var _a;
|
|
1883
1982
|
if (!selectedOutcomeLabel)
|
|
1884
1983
|
return [];
|
|
@@ -1887,7 +1986,7 @@ var MarketDetailsContent = ({
|
|
|
1887
1986
|
return seriesForOutcomeLabel;
|
|
1888
1987
|
return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
|
|
1889
1988
|
}, [graphSeriesByOutcomeLabel, selectedGraphVenue, selectedOutcomeLabel]);
|
|
1890
|
-
const otherRows =
|
|
1989
|
+
const otherRows = useMemo4(() => {
|
|
1891
1990
|
if (!model)
|
|
1892
1991
|
return [];
|
|
1893
1992
|
return resolveOtherTabRows(model.market, labels);
|
|
@@ -1941,10 +2040,10 @@ var MarketDetailsContent = ({
|
|
|
1941
2040
|
setSelectedGraphVenue(null);
|
|
1942
2041
|
}, [selectedGraphVenue, selectedOutcomesByVenue]);
|
|
1943
2042
|
if (marketId && !resolvedMarket) {
|
|
1944
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ jsx4(MarketDetailsNotFoundState, { ariaLabel, classNames });
|
|
1945
2044
|
}
|
|
1946
2045
|
if (!model) {
|
|
1947
|
-
return /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ jsx4(MarketDetailsUnavailableState, { ariaLabel, classNames });
|
|
1948
2047
|
}
|
|
1949
2048
|
return /* @__PURE__ */ jsxs3(
|
|
1950
2049
|
Card,
|
|
@@ -1973,8 +2072,8 @@ var MarketDetailsContent = ({
|
|
|
1973
2072
|
onKeyDown: handleToggleExpanded,
|
|
1974
2073
|
children: [
|
|
1975
2074
|
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
|
|
1976
|
-
model.image ? /* @__PURE__ */
|
|
1977
|
-
|
|
2075
|
+
model.image ? /* @__PURE__ */ jsx4(
|
|
2076
|
+
RemoteImage,
|
|
1978
2077
|
{
|
|
1979
2078
|
src: model.image,
|
|
1980
2079
|
alt: "",
|
|
@@ -1982,12 +2081,12 @@ var MarketDetailsContent = ({
|
|
|
1982
2081
|
}
|
|
1983
2082
|
) : null,
|
|
1984
2083
|
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col", children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx4(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
|
|
2085
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx4(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
|
|
1987
2086
|
] })
|
|
1988
2087
|
] }),
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ jsx4(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
|
|
2089
|
+
/* @__PURE__ */ jsx4(
|
|
1991
2090
|
"div",
|
|
1992
2091
|
{
|
|
1993
2092
|
className: "flex gap-2",
|
|
@@ -1998,7 +2097,7 @@ var MarketDetailsContent = ({
|
|
|
1998
2097
|
children: headerOutcomeItems.map((item) => {
|
|
1999
2098
|
const isPositive = item.tone === "positive";
|
|
2000
2099
|
const isActiveOutcome = item.label === selectedOutcomeLabel;
|
|
2001
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ jsx4(
|
|
2002
2101
|
"button",
|
|
2003
2102
|
{
|
|
2004
2103
|
type: "button",
|
|
@@ -2016,7 +2115,7 @@ var MarketDetailsContent = ({
|
|
|
2016
2115
|
setSelectedOutcomeLabel(item.label);
|
|
2017
2116
|
},
|
|
2018
2117
|
children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-2", children: [
|
|
2019
|
-
/* @__PURE__ */
|
|
2118
|
+
/* @__PURE__ */ jsx4(
|
|
2020
2119
|
VenueLogo,
|
|
2021
2120
|
{
|
|
2022
2121
|
venue: isPositive ? "polymarket" : "probable",
|
|
@@ -2024,7 +2123,7 @@ var MarketDetailsContent = ({
|
|
|
2024
2123
|
color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
|
|
2025
2124
|
}
|
|
2026
2125
|
),
|
|
2027
|
-
/* @__PURE__ */
|
|
2126
|
+
/* @__PURE__ */ jsx4(
|
|
2028
2127
|
Typography,
|
|
2029
2128
|
{
|
|
2030
2129
|
variant: isActiveOutcome ? "body-strong" : "body",
|
|
@@ -2045,7 +2144,7 @@ var MarketDetailsContent = ({
|
|
|
2045
2144
|
]
|
|
2046
2145
|
}
|
|
2047
2146
|
),
|
|
2048
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsx4(
|
|
2049
2148
|
"div",
|
|
2050
2149
|
{
|
|
2051
2150
|
id: detailsContentId,
|
|
@@ -2056,7 +2155,7 @@ var MarketDetailsContent = ({
|
|
|
2056
2155
|
),
|
|
2057
2156
|
"aria-hidden": !isOpened,
|
|
2058
2157
|
children: /* @__PURE__ */ jsxs3("div", { className: "min-h-0", children: [
|
|
2059
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
|
|
2060
2159
|
/* @__PURE__ */ jsxs3(
|
|
2061
2160
|
"div",
|
|
2062
2161
|
{
|
|
@@ -2071,7 +2170,7 @@ var MarketDetailsContent = ({
|
|
|
2071
2170
|
) : "translate-y-5 opacity-0"
|
|
2072
2171
|
),
|
|
2073
2172
|
children: [
|
|
2074
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsx4("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ jsx4(
|
|
2075
2174
|
Tabs,
|
|
2076
2175
|
{
|
|
2077
2176
|
ariaLabel: labels.marketDetails.tabsAria,
|
|
@@ -2082,9 +2181,9 @@ var MarketDetailsContent = ({
|
|
|
2082
2181
|
className: "w-full px-5"
|
|
2083
2182
|
}
|
|
2084
2183
|
) }),
|
|
2085
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
|
|
2086
2185
|
/* @__PURE__ */ jsxs3("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
|
|
2087
|
-
selectedTab === "order-book" ? /* @__PURE__ */
|
|
2186
|
+
selectedTab === "order-book" ? /* @__PURE__ */ jsx4("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ jsx4(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ jsx4(
|
|
2088
2187
|
StateMessage,
|
|
2089
2188
|
{
|
|
2090
2189
|
ariaLabel: labels.marketDetails.orderBookUnavailableAria,
|
|
@@ -2095,7 +2194,7 @@ var MarketDetailsContent = ({
|
|
|
2095
2194
|
onAction: handleRetryOrderBook,
|
|
2096
2195
|
className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
|
|
2097
2196
|
}
|
|
2098
|
-
) : hasNoOrderBook ? /* @__PURE__ */
|
|
2197
|
+
) : hasNoOrderBook ? /* @__PURE__ */ jsx4(
|
|
2099
2198
|
StateMessage,
|
|
2100
2199
|
{
|
|
2101
2200
|
ariaLabel: labels.marketDetails.orderBookEmptyAria,
|
|
@@ -2104,7 +2203,7 @@ var MarketDetailsContent = ({
|
|
|
2104
2203
|
className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
|
|
2105
2204
|
}
|
|
2106
2205
|
) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
2107
|
-
/* @__PURE__ */
|
|
2206
|
+
/* @__PURE__ */ jsx4(
|
|
2108
2207
|
OrderBookRows,
|
|
2109
2208
|
{
|
|
2110
2209
|
rows: askRows,
|
|
@@ -2114,7 +2213,7 @@ var MarketDetailsContent = ({
|
|
|
2114
2213
|
visibleRows: orderBookDepth
|
|
2115
2214
|
}
|
|
2116
2215
|
),
|
|
2117
|
-
/* @__PURE__ */
|
|
2216
|
+
/* @__PURE__ */ jsx4(
|
|
2118
2217
|
OrderBookRows,
|
|
2119
2218
|
{
|
|
2120
2219
|
rows: bidRows,
|
|
@@ -2126,17 +2225,18 @@ var MarketDetailsContent = ({
|
|
|
2126
2225
|
)
|
|
2127
2226
|
] }) }) : null,
|
|
2128
2227
|
selectedTab === "graph" ? /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
|
|
2129
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsx4(
|
|
2130
2229
|
LineChart,
|
|
2131
2230
|
{
|
|
2132
2231
|
series: graphSeries,
|
|
2133
2232
|
height: 260,
|
|
2134
2233
|
isLoading: isPriceHistoryLoading,
|
|
2234
|
+
chartType: selectedChartType,
|
|
2135
2235
|
classNames: { root: "w-full" },
|
|
2136
2236
|
showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
|
|
2137
2237
|
renderSeriesControls: () => {
|
|
2138
2238
|
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
|
|
2139
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
|
|
2140
2240
|
const probability = formatProbabilityPercent(item.outcome.price);
|
|
2141
2241
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
2142
2242
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -2156,14 +2256,14 @@ var MarketDetailsContent = ({
|
|
|
2156
2256
|
handleGraphVenueToggle(item.venue);
|
|
2157
2257
|
},
|
|
2158
2258
|
children: [
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2259
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: item.venue, size: "small" }),
|
|
2260
|
+
/* @__PURE__ */ jsx4("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
|
|
2161
2261
|
]
|
|
2162
2262
|
},
|
|
2163
2263
|
`${item.market.id}-${item.outcome.id}`
|
|
2164
2264
|
);
|
|
2165
2265
|
}) }),
|
|
2166
|
-
/* @__PURE__ */
|
|
2266
|
+
/* @__PURE__ */ jsx4(
|
|
2167
2267
|
SwitchButton,
|
|
2168
2268
|
{
|
|
2169
2269
|
ariaLabel: labels.marketDetails.outcomeSelectorAria,
|
|
@@ -2189,39 +2289,56 @@ var MarketDetailsContent = ({
|
|
|
2189
2289
|
classNames == null ? void 0 : classNames.footer
|
|
2190
2290
|
),
|
|
2191
2291
|
children: [
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2292
|
+
/* @__PURE__ */ jsx4("span", { children: typeof model.market.volume === "number" ? `${config.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
|
|
2293
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
|
|
2294
|
+
/* @__PURE__ */ jsx4(
|
|
2295
|
+
ChartTypeSwitch,
|
|
2296
|
+
{
|
|
2297
|
+
className: "shrink-0",
|
|
2298
|
+
value: selectedChartType,
|
|
2299
|
+
onValueChange: setSelectedChartType
|
|
2300
|
+
}
|
|
2301
|
+
),
|
|
2302
|
+
/* @__PURE__ */ jsx4(
|
|
2303
|
+
"span",
|
|
2197
2304
|
{
|
|
2198
|
-
|
|
2199
|
-
className:
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2305
|
+
"aria-hidden": "true",
|
|
2306
|
+
className: "hidden h-4 w-px bg-agg-separator md:block"
|
|
2307
|
+
}
|
|
2308
|
+
),
|
|
2309
|
+
eventListItemDetailsTimeRanges.map((timeRange) => {
|
|
2310
|
+
const isActive = selectedTimeRange === timeRange;
|
|
2311
|
+
return /* @__PURE__ */ jsx4(
|
|
2312
|
+
"button",
|
|
2313
|
+
{
|
|
2314
|
+
type: "button",
|
|
2315
|
+
className: cn(
|
|
2316
|
+
"cursor-pointer text-agg-sm leading-agg-5",
|
|
2317
|
+
isActive ? "font-agg-bold text-agg-foreground" : "font-agg-normal text-agg-muted-foreground"
|
|
2318
|
+
),
|
|
2319
|
+
"aria-pressed": isActive,
|
|
2320
|
+
onClick: (e) => {
|
|
2321
|
+
e.preventDefault();
|
|
2322
|
+
e.stopPropagation();
|
|
2323
|
+
setSelectedTimeRange(timeRange);
|
|
2324
|
+
},
|
|
2325
|
+
children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
|
|
2208
2326
|
},
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
}) })
|
|
2327
|
+
timeRange
|
|
2328
|
+
);
|
|
2329
|
+
})
|
|
2330
|
+
] })
|
|
2214
2331
|
]
|
|
2215
2332
|
}
|
|
2216
2333
|
)
|
|
2217
2334
|
] }) : null,
|
|
2218
|
-
selectedTab === "other" ? /* @__PURE__ */
|
|
2335
|
+
selectedTab === "other" ? /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ jsx4("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ jsxs3(
|
|
2219
2336
|
"div",
|
|
2220
2337
|
{
|
|
2221
2338
|
className: "flex items-center justify-between rounded-agg-xl bg-agg-secondary-hover px-4 py-3",
|
|
2222
2339
|
children: [
|
|
2223
|
-
/* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
|
|
2341
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body", className: "text-right", children: row.value })
|
|
2225
2342
|
]
|
|
2226
2343
|
},
|
|
2227
2344
|
row.label
|
|
@@ -2264,7 +2381,7 @@ var MarketDetails = (props) => {
|
|
|
2264
2381
|
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
2265
2382
|
});
|
|
2266
2383
|
if (props.isLoading) {
|
|
2267
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx4(
|
|
2268
2385
|
MarketDetailsLoadingState,
|
|
2269
2386
|
{
|
|
2270
2387
|
isOpened: resolvedIsOpened,
|
|
@@ -2274,7 +2391,7 @@ var MarketDetails = (props) => {
|
|
|
2274
2391
|
);
|
|
2275
2392
|
}
|
|
2276
2393
|
if ("event" in props && props.event) {
|
|
2277
|
-
return /* @__PURE__ */
|
|
2394
|
+
return /* @__PURE__ */ jsx4(
|
|
2278
2395
|
MarketDetailsContent,
|
|
2279
2396
|
__spreadProps(__spreadValues({}, props), {
|
|
2280
2397
|
isOpened: resolvedIsOpened,
|
|
@@ -2284,7 +2401,7 @@ var MarketDetails = (props) => {
|
|
|
2284
2401
|
);
|
|
2285
2402
|
}
|
|
2286
2403
|
if (isFetchingEvent) {
|
|
2287
|
-
return /* @__PURE__ */
|
|
2404
|
+
return /* @__PURE__ */ jsx4(
|
|
2288
2405
|
MarketDetailsLoadingState,
|
|
2289
2406
|
{
|
|
2290
2407
|
isOpened: resolvedIsOpened,
|
|
@@ -2295,11 +2412,11 @@ var MarketDetails = (props) => {
|
|
|
2295
2412
|
}
|
|
2296
2413
|
if (!fetchedEvent) {
|
|
2297
2414
|
if (isErrorWithStatus(eventError, 404)) {
|
|
2298
|
-
return /* @__PURE__ */
|
|
2415
|
+
return /* @__PURE__ */ jsx4(MarketDetailsNotFoundState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
|
|
2299
2416
|
}
|
|
2300
|
-
return /* @__PURE__ */
|
|
2417
|
+
return /* @__PURE__ */ jsx4(MarketDetailsUnavailableState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
|
|
2301
2418
|
}
|
|
2302
|
-
return /* @__PURE__ */
|
|
2419
|
+
return /* @__PURE__ */ jsx4(
|
|
2303
2420
|
MarketDetailsContent,
|
|
2304
2421
|
__spreadProps(__spreadValues({}, props), {
|
|
2305
2422
|
isOpened: resolvedIsOpened,
|
|
@@ -2311,8 +2428,8 @@ var MarketDetails = (props) => {
|
|
|
2311
2428
|
MarketDetails.displayName = "MarketDetails";
|
|
2312
2429
|
|
|
2313
2430
|
// src/events/list/index.tsx
|
|
2314
|
-
import { useCallback, useEffect as useEffect3, useMemo as
|
|
2315
|
-
import { useEvents, useLabels as
|
|
2431
|
+
import { useCallback, useEffect as useEffect3, useMemo as useMemo5, useRef, useState as useState3 } from "react";
|
|
2432
|
+
import { useEvents, useLabels as useLabels5 } from "@agg-market/hooks";
|
|
2316
2433
|
|
|
2317
2434
|
// src/events/list/event-list.constants.ts
|
|
2318
2435
|
var POLYMARKET_VENUE = "polymarket";
|
|
@@ -2363,14 +2480,14 @@ var resolveTabVenus = (tab) => {
|
|
|
2363
2480
|
};
|
|
2364
2481
|
|
|
2365
2482
|
// src/events/list/index.tsx
|
|
2366
|
-
import { jsx as
|
|
2483
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2367
2484
|
var renderTabIcon = (tab, isActive) => {
|
|
2368
2485
|
if (tab.venueLogo) {
|
|
2369
|
-
return /* @__PURE__ */
|
|
2486
|
+
return /* @__PURE__ */ jsx5(VenueLogo, { venue: tab.venueLogo, size: "small" });
|
|
2370
2487
|
}
|
|
2371
2488
|
if (!tab.iconName)
|
|
2372
2489
|
return null;
|
|
2373
|
-
return /* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ jsx5(
|
|
2374
2491
|
Icon,
|
|
2375
2492
|
{
|
|
2376
2493
|
name: tab.iconName,
|
|
@@ -2415,21 +2532,21 @@ var EventList = ({
|
|
|
2415
2532
|
categoryIds
|
|
2416
2533
|
}) => {
|
|
2417
2534
|
var _a, _b;
|
|
2418
|
-
const labels =
|
|
2419
|
-
const defaultEventListTabs =
|
|
2535
|
+
const labels = useLabels5();
|
|
2536
|
+
const defaultEventListTabs = useMemo5(() => {
|
|
2420
2537
|
return getDefaultEventListTabs(labels);
|
|
2421
2538
|
}, [labels]);
|
|
2422
2539
|
const [activeTabValue, setActiveTabValue] = useState3(
|
|
2423
2540
|
(_b = (_a = defaultEventListTabs[0]) == null ? void 0 : _a.value) != null ? _b : "matched"
|
|
2424
2541
|
);
|
|
2425
2542
|
const [_shouldUseSelectOverflow, setShouldUseSelectOverflow] = useState3(false);
|
|
2426
|
-
const activeTab =
|
|
2543
|
+
const activeTab = useMemo5(() => {
|
|
2427
2544
|
return defaultEventListTabs.find((tab) => tab.value === activeTabValue);
|
|
2428
2545
|
}, [activeTabValue]);
|
|
2429
|
-
const venues =
|
|
2546
|
+
const venues = useMemo5(() => {
|
|
2430
2547
|
return resolveTabVenus(activeTab);
|
|
2431
2548
|
}, [activeTab]);
|
|
2432
|
-
const resolvedMaxVisibleItems =
|
|
2549
|
+
const resolvedMaxVisibleItems = useMemo5(() => {
|
|
2433
2550
|
if (!Number.isFinite(maxVisibleItems))
|
|
2434
2551
|
return void 0;
|
|
2435
2552
|
return Math.max(1, Math.floor(maxVisibleItems));
|
|
@@ -2442,16 +2559,16 @@ var EventList = ({
|
|
|
2442
2559
|
categoryIds,
|
|
2443
2560
|
limit: requestLimit
|
|
2444
2561
|
});
|
|
2445
|
-
const filteredEvents =
|
|
2562
|
+
const filteredEvents = useMemo5(() => {
|
|
2446
2563
|
return filterEventsByTabValue(events, activeTabValue);
|
|
2447
2564
|
}, [events, activeTabValue]);
|
|
2448
|
-
const tileEvents =
|
|
2565
|
+
const tileEvents = useMemo5(() => {
|
|
2449
2566
|
const normalizedEvents = filteredEvents.map((event) => mapEventToEventListItemEvent(event)).filter((event) => event != null);
|
|
2450
2567
|
if (resolvedMaxVisibleItems == null)
|
|
2451
2568
|
return normalizedEvents;
|
|
2452
2569
|
return normalizedEvents.slice(0, resolvedMaxVisibleItems);
|
|
2453
2570
|
}, [filteredEvents, resolvedMaxVisibleItems]);
|
|
2454
|
-
const tabsItems =
|
|
2571
|
+
const tabsItems = useMemo5(() => {
|
|
2455
2572
|
return defaultEventListTabs.map((tab) => {
|
|
2456
2573
|
const isActive = tab.value === activeTabValue;
|
|
2457
2574
|
return {
|
|
@@ -2540,7 +2657,7 @@ var EventList = ({
|
|
|
2540
2657
|
"md:[grid-template-columns:repeat(var(--agg-event-list-columns),minmax(0,1fr))]"
|
|
2541
2658
|
);
|
|
2542
2659
|
if (shouldRenderLoadingState) {
|
|
2543
|
-
return /* @__PURE__ */
|
|
2660
|
+
return /* @__PURE__ */ jsx5(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
|
|
2544
2661
|
}
|
|
2545
2662
|
return /* @__PURE__ */ jsxs4("section", { className: "flex w-full flex-col gap-5", children: [
|
|
2546
2663
|
/* @__PURE__ */ jsxs4(
|
|
@@ -2549,8 +2666,8 @@ var EventList = ({
|
|
|
2549
2666
|
ref: headerRef,
|
|
2550
2667
|
className: "flex flex-col sm:flex-row w-full flex-nowrap items-start sm:items-center justify-between gap-2 sm:gap-4",
|
|
2551
2668
|
children: [
|
|
2552
|
-
/* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ jsx5("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ jsx5(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
|
|
2670
|
+
/* @__PURE__ */ jsx5(
|
|
2554
2671
|
Tabs,
|
|
2555
2672
|
{
|
|
2556
2673
|
ariaLabel: labels.eventList.tabsAria(title),
|
|
@@ -2563,7 +2680,7 @@ var EventList = ({
|
|
|
2563
2680
|
}
|
|
2564
2681
|
),
|
|
2565
2682
|
/* @__PURE__ */ jsxs4("div", { className: gridClassName, style: gridStyle, children: [
|
|
2566
|
-
tileEvents.map((event) => /* @__PURE__ */
|
|
2683
|
+
tileEvents.map((event) => /* @__PURE__ */ jsx5(
|
|
2567
2684
|
EventListItem,
|
|
2568
2685
|
{
|
|
2569
2686
|
event,
|
|
@@ -2574,7 +2691,7 @@ var EventList = ({
|
|
|
2574
2691
|
},
|
|
2575
2692
|
event.id
|
|
2576
2693
|
)),
|
|
2577
|
-
Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */
|
|
2694
|
+
Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx5(
|
|
2578
2695
|
EventListItem,
|
|
2579
2696
|
{
|
|
2580
2697
|
isLoading: true,
|
|
@@ -2584,7 +2701,7 @@ var EventList = ({
|
|
|
2584
2701
|
},
|
|
2585
2702
|
`loading-${index}`
|
|
2586
2703
|
)),
|
|
2587
|
-
!isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */
|
|
2704
|
+
!isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ jsx5(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none", children: /* @__PURE__ */ jsx5(
|
|
2588
2705
|
StateMessage,
|
|
2589
2706
|
{
|
|
2590
2707
|
ariaLabel: labels.eventList.emptyAria,
|
|
@@ -2593,7 +2710,7 @@ var EventList = ({
|
|
|
2593
2710
|
className: "min-h-[320px]"
|
|
2594
2711
|
}
|
|
2595
2712
|
) }) : null,
|
|
2596
|
-
isError ? /* @__PURE__ */
|
|
2713
|
+
isError ? /* @__PURE__ */ jsx5(
|
|
2597
2714
|
Typography,
|
|
2598
2715
|
{
|
|
2599
2716
|
variant: "body",
|
|
@@ -2602,7 +2719,7 @@ var EventList = ({
|
|
|
2602
2719
|
}
|
|
2603
2720
|
) : null
|
|
2604
2721
|
] }),
|
|
2605
|
-
shouldPaginate && hasNextPage ? /* @__PURE__ */
|
|
2722
|
+
shouldPaginate && hasNextPage ? /* @__PURE__ */ jsx5("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
|
|
2606
2723
|
] });
|
|
2607
2724
|
};
|
|
2608
2725
|
EventList.displayName = "EventList";
|