@maestro_io/maestro-web-sdk 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MaestroEventDelegate.js +60 -0
- package/dist/components/atoms/BaseButton/BaseButton.js +11 -0
- package/dist/components/atoms/BaseButton/index.js +2 -0
- package/dist/components/atoms/Image/index.js +30 -0
- package/dist/components/atoms/Rive/index.d.ts +1 -0
- package/dist/components/atoms/Rive/index.js +53 -0
- package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +9 -0
- package/dist/components/atoms/SvgIcon/BetsIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/CollapseIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/ExpandIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/FantasyIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/FlameIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/Icon.js +42 -0
- package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +10 -0
- package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +11 -0
- package/dist/components/atoms/SvgIcon/PlayIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/StatsIcon.js +12 -0
- package/dist/components/atoms/SvgIcon/TimesIcon.js +6 -0
- package/dist/components/atoms/SvgIcon/WarningIcon.js +8 -0
- package/dist/components/atoms/SvgIcon/index.js +2 -0
- package/dist/components/core/App/App.js +41 -0
- package/dist/components/core/App/index.js +2 -0
- package/dist/components/core/OverlayContainer.js +58 -0
- package/dist/components/core/PanelManager/PanelManager.js +80 -0
- package/dist/components/core/PanelManager/index.js +2 -0
- package/dist/components/core/ScrollableContainer/FocusableItem.js +38 -0
- package/dist/components/core/ScrollableContainer/ScrollableContainer.js +166 -0
- package/dist/components/core/ScrollableContainer/index.js +2 -0
- package/dist/components/molecules/ActionButton/ActionButton.d.ts +1 -0
- package/dist/components/molecules/ActionButton/ActionButton.js +10 -0
- package/dist/components/molecules/ActionButton/index.js +2 -0
- package/dist/components/molecules/Overlay/Overlay.js +139 -0
- package/dist/components/molecules/Overlay/index.js +2 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +1 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.js +40 -0
- package/dist/components/molecules/PanelNavButton/index.js +2 -0
- package/dist/components/molecules/SegmentButton/SegmentButton.js +10 -0
- package/dist/components/molecules/SegmentButton/index.js +2 -0
- package/dist/components/molecules/WatchButton/WatchButton.js +15 -0
- package/dist/components/molecules/WatchButton/index.js +2 -0
- package/dist/components/organisms/PanelNavigation/PanelNavigation.js +71 -0
- package/dist/components/organisms/PanelNavigation/index.js +2 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +2 -2
- package/dist/components/organisms/SegmentController/SegmentController.js +68 -0
- package/dist/components/organisms/SegmentController/index.d.ts +1 -1
- package/dist/components/organisms/SegmentController/index.js +2 -0
- package/dist/external/AxiosNetworkClient.js +83 -0
- package/dist/external/LocalStorageCacheManager.js +213 -0
- package/dist/external/ReactRenderer.d.ts +2 -2
- package/dist/external/ReactRenderer.js +86 -0
- package/dist/external/mocks/MockExternalNetworkClient.js +161 -0
- package/dist/external/ports/cacheManager.js +1 -0
- package/dist/external/ports/networkClient.js +1 -0
- package/dist/external/ports/renderer.js +1 -0
- package/dist/external/spatial-navigation/index.d.ts +3 -4
- package/dist/external/spatial-navigation/index.js +3 -0
- package/dist/external/spatial-navigation/measureLayout.js +30 -0
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +2 -4
- package/dist/external/spatial-navigation/spatialNavigation.js +864 -0
- package/dist/external/spatial-navigation/utils.js +6 -0
- package/dist/external/spatial-navigation/visualDebugger.js +76 -0
- package/dist/external/spatial-navigation/withFocusable.d.ts +1 -0
- package/dist/external/spatial-navigation/withFocusable.js +245 -0
- package/dist/helpers/Observable.js +37 -0
- package/dist/helpers/deliver-focus.js +12 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +192 -0
- package/dist/interfaces/IMaestroEvent.js +6 -0
- package/dist/interfaces/IMaestroEventDelegate.js +1 -0
- package/dist/interfaces/IMaestroManager.js +1 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IModel.js +1 -0
- package/dist/models/IPanel.js +53 -0
- package/dist/models/ITheme.js +20 -0
- package/dist/models/IWinningBet.js +1 -0
- package/dist/modules/bets/interfaces/IBets.js +1 -0
- package/dist/modules/bets/mocks.js +572 -0
- package/dist/modules/bets/view/BetsView.js +116 -0
- package/dist/modules/bets/view/HotProps/HotPropsView.d.ts +7 -6
- package/dist/modules/bets/view/HotProps/HotPropsView.js +139 -0
- package/dist/modules/bets/view/SixPack/SixPackView.d.ts +2 -2
- package/dist/modules/bets/view/SixPack/SixPackView.js +103 -0
- package/dist/modules/bets/view/TabLoadFailureView.d.ts +1 -0
- package/dist/modules/bets/view/TabLoadFailureView.js +12 -0
- package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +6 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +7 -6
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +122 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +34 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +22 -0
- package/dist/modules/bets/view/UserBets/Boost/Boost.js +6 -0
- package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +9 -0
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +13 -0
- package/dist/modules/bets/view/UserBets/Straight/Straight.js +6 -0
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +13 -0
- package/dist/modules/bets/view/UserBets/UserBetsView.js +114 -0
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +1 -0
- package/dist/modules/bets/view/components/Bet/Bet.js +32 -0
- package/dist/modules/bets/view/components/BetPill/BetPill.js +6 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCard.js +15 -0
- package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +20 -0
- package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +14 -0
- package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +16 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +2 -2
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +63 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/index.d.ts +1 -1
- package/dist/modules/bets/view/components/PromoCodeBanner/index.js +1 -0
- package/dist/modules/bets/view-model/BetsViewModel.js +767 -0
- package/dist/modules/key-plays/constants.js +292 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +4 -4
- package/dist/modules/key-plays/interfaces/IKeyPlays.js +14 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +1 -0
- package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +13 -0
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +0 -4
- package/dist/modules/key-plays/view/KeyPlayCardView.js +120 -0
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +58 -0
- package/dist/modules/key-plays/view/KeyPlaysView.js +166 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +182 -0
- package/dist/modules/stats/interfaces/IStats.d.ts +166 -0
- package/dist/modules/stats/interfaces/IStats.js +1 -0
- package/dist/modules/stats/mocks.d.ts +82 -0
- package/dist/modules/stats/mocks.js +686 -0
- package/dist/modules/stats/utils/renderTeamStatistic.d.ts +21 -0
- package/dist/modules/stats/utils/renderTeamStatistic.js +16 -0
- package/dist/modules/stats/utils.d.ts +39 -0
- package/dist/modules/stats/utils.js +62 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +34 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.js +78 -0
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +5 -0
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +27 -0
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +10 -0
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +15 -0
- package/dist/modules/stats/view/ActiveAthletes/index.d.ts +2 -0
- package/dist/modules/stats/view/ActiveAthletes/index.js +2 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +8 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.js +9 -0
- package/dist/modules/stats/view/GameLeaders/index.d.ts +2 -0
- package/dist/modules/stats/view/GameLeaders/index.js +2 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.d.ts +17 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +55 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.d.ts +2 -0
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +1 -0
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +53 -0
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +66 -0
- package/dist/modules/stats/view/MatchPredictor/index.d.ts +3 -0
- package/dist/modules/stats/view/MatchPredictor/index.js +2 -0
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +63 -0
- package/dist/modules/stats/view/RecentGames/RecentGames.js +22 -0
- package/dist/modules/stats/view/RecentGames/index.d.ts +2 -0
- package/dist/modules/stats/view/RecentGames/index.js +2 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +52 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +38 -0
- package/dist/modules/stats/view/StatsQRCode/index.d.ts +2 -0
- package/dist/modules/stats/view/StatsQRCode/index.js +1 -0
- package/dist/modules/stats/view/StatsView.d.ts +20 -0
- package/dist/modules/stats/view/StatsView.js +107 -0
- package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +54 -0
- package/dist/modules/stats/view/TeamStats/TeamStatsView.js +69 -0
- package/dist/modules/stats/view/TeamStats/index.d.ts +2 -0
- package/dist/modules/stats/view/TeamStats/index.js +1 -0
- package/dist/modules/stats/view/Teams/StatsCarousel.d.ts +8 -0
- package/dist/modules/stats/view/Teams/StatsCarousel.js +14 -0
- package/dist/modules/stats/view/Teams/StatsProgressBar.d.ts +7 -0
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +18 -0
- package/dist/modules/stats/view/Teams/Teams.d.ts +68 -0
- package/dist/modules/stats/view/Teams/Teams.js +42 -0
- package/dist/modules/stats/view/Teams/index.d.ts +2 -0
- package/dist/modules/stats/view/Teams/index.js +2 -0
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +63 -0
- package/dist/modules/stats/view/WinProbability/WinProbability.js +27 -0
- package/dist/modules/stats/view/WinProbability/index.d.ts +2 -0
- package/dist/modules/stats/view/WinProbability/index.js +2 -0
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +67 -0
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +29 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +4 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +12 -0
- package/dist/modules/stats/view/components/AthletesStatistics/index.d.ts +2 -0
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +2 -0
- package/dist/modules/stats/view/index.d.ts +2 -0
- package/dist/modules/stats/view/index.js +2 -0
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +31 -0
- package/dist/modules/stats/view-model/StatsViewModel.js +90 -0
- package/dist/services/BetsService.js +102 -0
- package/dist/services/NetworkManager/NetworkManager.js +410 -0
- package/dist/services/NetworkManager/errors.js +45 -0
- package/dist/services/StatsService.d.ts +36 -0
- package/dist/services/StatsService.js +68 -0
- package/dist/services/ThemeManager/constants.js +47 -0
- package/dist/test-polyfills.d.ts +1 -0
- package/dist/test-polyfills.js +15 -0
- package/dist/types/OverlayTypes.js +4 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +9 -0
- package/dist/view-models/MaestroEventViewModel.js +168 -0
- package/dist/view-models/OverlayViewModel.js +222 -0
- package/dist/view-models/PanelManagerViewModel.js +80 -0
- package/dist/view-models/ViewModel.js +32 -0
- package/dist/view-models/index.js +59 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './StatsQRCodeView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
import { StatsPromotion } from '../../interfaces/IStats';
|
|
6
|
+
export interface StatsQRCodeViewProps extends WithFocusableProps {
|
|
7
|
+
promotion: StatsPromotion;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: {
|
|
10
|
+
new (props?: (StatsQRCodeViewProps & WithFocusableProps) | undefined, context?: any): {
|
|
11
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
12
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
13
|
+
getChildContext(): {
|
|
14
|
+
parentFocusKey: string;
|
|
15
|
+
};
|
|
16
|
+
setFocus: (focusKey: string) => void;
|
|
17
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
18
|
+
stealFocus: () => void;
|
|
19
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
20
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
21
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
22
|
+
onEnterReleaseHandler: () => void;
|
|
23
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
24
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
25
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
26
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
27
|
+
componentDidMount(): void;
|
|
28
|
+
componentDidUpdate(): void;
|
|
29
|
+
componentWillUnmount(): void;
|
|
30
|
+
render(): React.ReactElement<StatsQRCodeViewProps & WithFocusableProps>;
|
|
31
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: StatsQRCodeViewProps & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
32
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
33
|
+
props: Readonly<{
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}> & Readonly<StatsQRCodeViewProps & WithFocusableProps>;
|
|
36
|
+
context: any;
|
|
37
|
+
refs: {
|
|
38
|
+
[key: string]: React.ReactInstance;
|
|
39
|
+
};
|
|
40
|
+
componentWillMount?(): void;
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextContext: any): void;
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
44
|
+
};
|
|
45
|
+
contextTypes: {
|
|
46
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
47
|
+
};
|
|
48
|
+
childContextTypes: {
|
|
49
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './StatsQRCodeView.styles.css';
|
|
3
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
4
|
+
import FocusableItem from '@/components/core/ScrollableContainer/FocusableItem';
|
|
5
|
+
import Image from '@/components/atoms/Image';
|
|
6
|
+
const StatsQRCodeView = (props) => {
|
|
7
|
+
const { focused, promotion } = props;
|
|
8
|
+
return (React.createElement(FocusableItem, null,
|
|
9
|
+
React.createElement("div", { className: "stats-qr-code-view focus-ring", "data-focused": focused, style: {
|
|
10
|
+
backgroundImage: `url(${promotion.backgroundImage})`,
|
|
11
|
+
} },
|
|
12
|
+
React.createElement("table", { className: "stats-qr-table" },
|
|
13
|
+
React.createElement("tbody", null,
|
|
14
|
+
React.createElement("tr", null,
|
|
15
|
+
React.createElement("td", { className: "stats-qr-header-cell" },
|
|
16
|
+
React.createElement("table", { className: "stats-qr-logo-table" },
|
|
17
|
+
React.createElement("tbody", null,
|
|
18
|
+
React.createElement("tr", null,
|
|
19
|
+
React.createElement("td", { className: "stats-qr-logo-cell" },
|
|
20
|
+
React.createElement(Image, { src: promotion.logo, alt: "ESPN Logo", crossOrigin: "anonymous", className: "stats-qr-logo" }))),
|
|
21
|
+
React.createElement("tr", null,
|
|
22
|
+
React.createElement("td", { className: "stats-qr-tagline-cell" },
|
|
23
|
+
React.createElement("div", { className: "stats-qr-tagline" },
|
|
24
|
+
React.createElement("p", { className: "T20" }, promotion.title)))))))),
|
|
25
|
+
React.createElement("tr", null,
|
|
26
|
+
React.createElement("td", { className: "stats-qr-content-cell" },
|
|
27
|
+
React.createElement("table", { className: "stats-qr-content-table" },
|
|
28
|
+
React.createElement("tbody", null,
|
|
29
|
+
React.createElement("tr", null,
|
|
30
|
+
React.createElement("td", { className: "stats-qr-code-cell" },
|
|
31
|
+
React.createElement("div", { className: "stats-qr-code-container" },
|
|
32
|
+
React.createElement(Image, { src: promotion.qrCode, alt: "QR Code", crossOrigin: "anonymous", className: "stats-qr-code" })))),
|
|
33
|
+
React.createElement("tr", null,
|
|
34
|
+
React.createElement("td", { className: "stats-qr-description-cell" },
|
|
35
|
+
React.createElement("div", { className: "stats-qr-description" },
|
|
36
|
+
React.createElement("p", { className: "T02" }, promotion.description)))))))))))));
|
|
37
|
+
};
|
|
38
|
+
export default withFocusable()(StatsQRCodeView);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './StatsQRCodeView';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './StatsView.styles.css';
|
|
3
|
+
import { StatsApiResponse } from '../interfaces/IStats';
|
|
4
|
+
interface StatsViewState {
|
|
5
|
+
container: HTMLDivElement | null;
|
|
6
|
+
statsData: StatsApiResponse | null;
|
|
7
|
+
isDataLoading: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare class StatsView extends Component<{}, StatsViewState> {
|
|
10
|
+
private container;
|
|
11
|
+
private statsDataUnsub;
|
|
12
|
+
private isDataLoadingUnsub;
|
|
13
|
+
private vm;
|
|
14
|
+
constructor(props: {});
|
|
15
|
+
componentDidMount(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
renderStatsComponents: () => React.ReactElement[];
|
|
18
|
+
render(): React.JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export default StatsView;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './StatsView.styles.css';
|
|
3
|
+
import ScrollableContainer from '@/components/core/ScrollableContainer';
|
|
4
|
+
import MatchPredictorView from './MatchPredictor';
|
|
5
|
+
import SDK from '@/index';
|
|
6
|
+
import StatsQRCodeView from './StatsQRCode';
|
|
7
|
+
import TeamStatsView from './TeamStats';
|
|
8
|
+
const STICKY_HEADER_HEIGHT = 32; // Match KeyPlaysView
|
|
9
|
+
class StatsView extends Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
Object.defineProperty(this, "container", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: null
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "statsDataUnsub", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: null
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "isDataLoadingUnsub", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: null
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "vm", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "renderStatsComponents", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: () => {
|
|
41
|
+
const { statsData } = this.state;
|
|
42
|
+
if (!statsData) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const teams = statsData.entities.teams;
|
|
47
|
+
const homeTeam = Object.values(teams).find((team) => team.homeAway === 'home');
|
|
48
|
+
const awayTeam = Object.values(teams).find((team) => team.homeAway === 'away');
|
|
49
|
+
const availableStatistics = homeTeam?.statistics || awayTeam?.statistics || [];
|
|
50
|
+
const components = [];
|
|
51
|
+
if (statsData.predictor) {
|
|
52
|
+
components.push(React.createElement(MatchPredictorView, { key: "match-predictor", predictor: statsData.predictor, teams: statsData.entities.teams }));
|
|
53
|
+
}
|
|
54
|
+
// Add TeamStatsView if available
|
|
55
|
+
if (homeTeam && awayTeam && availableStatistics.length > 0) {
|
|
56
|
+
components.push(React.createElement(TeamStatsView, { key: "team-stats", homeTeam: homeTeam, awayTeam: awayTeam, statistics: availableStatistics }));
|
|
57
|
+
}
|
|
58
|
+
// Add StatsQRCodeView if available
|
|
59
|
+
if (statsData.promotion) {
|
|
60
|
+
components.push(React.createElement(StatsQRCodeView, { key: "stats-qr-code", promotion: statsData.promotion }));
|
|
61
|
+
}
|
|
62
|
+
return components;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('Error rendering stats components:', error);
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this.vm = SDK.getMaestroEventViewModel().statsViewModel;
|
|
71
|
+
this.state = {
|
|
72
|
+
container: null,
|
|
73
|
+
statsData: this.vm.statsData.value,
|
|
74
|
+
isDataLoading: this.vm.isDataLoading.value,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
componentDidMount() {
|
|
78
|
+
this.statsDataUnsub = this.vm.statsData.subscribe((value) => {
|
|
79
|
+
this.setState({ statsData: value });
|
|
80
|
+
});
|
|
81
|
+
this.isDataLoadingUnsub = this.vm.isDataLoading.subscribe((value) => {
|
|
82
|
+
this.setState({ isDataLoading: value });
|
|
83
|
+
});
|
|
84
|
+
this.setState({
|
|
85
|
+
container: this.container,
|
|
86
|
+
});
|
|
87
|
+
// Initialize the view model
|
|
88
|
+
this.vm.init();
|
|
89
|
+
}
|
|
90
|
+
componentWillUnmount() {
|
|
91
|
+
this.statsDataUnsub && this.statsDataUnsub();
|
|
92
|
+
this.isDataLoadingUnsub && this.isDataLoadingUnsub();
|
|
93
|
+
// Clean up the view model
|
|
94
|
+
this.vm.cleanup();
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
const { container, statsData } = this.state;
|
|
98
|
+
const components = this.renderStatsComponents();
|
|
99
|
+
return (React.createElement(ScrollableContainer, { scrollableContainerRef: container, containerTopOffset: STICKY_HEADER_HEIGHT },
|
|
100
|
+
React.createElement("div", { ref: (el) => {
|
|
101
|
+
this.container = el;
|
|
102
|
+
}, className: "stats-view" },
|
|
103
|
+
!statsData ? (React.createElement("div", { className: "stats-loading T02" }, "Loading...")) : components.length > 0 ? (React.createElement("div", { className: "stats-content" }, components.map((component, index) => (React.createElement("div", { key: component.key || index, className: "stats-component" }, component))))) : (React.createElement("div", { className: "stats-loading T02" }, "No stats available")),
|
|
104
|
+
React.createElement("div", { className: "stats-bottom-padding" }))));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export default StatsView;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './TeamStatsView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
import { Team, TeamStatistic } from '../../interfaces/IStats';
|
|
6
|
+
export interface TeamStatsViewProps {
|
|
7
|
+
homeTeam: Team;
|
|
8
|
+
awayTeam: Team;
|
|
9
|
+
statistics?: TeamStatistic[];
|
|
10
|
+
}
|
|
11
|
+
declare const _default: {
|
|
12
|
+
new (props?: (TeamStatsViewProps & WithFocusableProps) | undefined, context?: any): {
|
|
13
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
14
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
15
|
+
getChildContext(): {
|
|
16
|
+
parentFocusKey: string;
|
|
17
|
+
};
|
|
18
|
+
setFocus: (focusKey: string) => void;
|
|
19
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
20
|
+
stealFocus: () => void;
|
|
21
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
22
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
23
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
24
|
+
onEnterReleaseHandler: () => void;
|
|
25
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
26
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
27
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
28
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
componentDidUpdate(): void;
|
|
31
|
+
componentWillUnmount(): void;
|
|
32
|
+
render(): React.ReactElement<TeamStatsViewProps & WithFocusableProps>;
|
|
33
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: TeamStatsViewProps & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
34
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
35
|
+
props: Readonly<{
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}> & Readonly<TeamStatsViewProps & WithFocusableProps>;
|
|
38
|
+
context: any;
|
|
39
|
+
refs: {
|
|
40
|
+
[key: string]: React.ReactInstance;
|
|
41
|
+
};
|
|
42
|
+
componentWillMount?(): void;
|
|
43
|
+
componentWillReceiveProps?(nextProps: Readonly<TeamStatsViewProps & WithFocusableProps>, nextContext: any): void;
|
|
44
|
+
shouldComponentUpdate?(nextProps: Readonly<TeamStatsViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
45
|
+
componentWillUpdate?(nextProps: Readonly<TeamStatsViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
46
|
+
};
|
|
47
|
+
contextTypes: {
|
|
48
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
49
|
+
};
|
|
50
|
+
childContextTypes: {
|
|
51
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TeamStatsView.styles.css';
|
|
3
|
+
import Image from '@/components/atoms/Image';
|
|
4
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
+
import { renderTeamStatistic } from '../../utils/renderTeamStatistic';
|
|
6
|
+
const TeamStatsView = (props) => {
|
|
7
|
+
const { homeTeam, awayTeam, statistics } = props;
|
|
8
|
+
// If no statistics available, don't render the component
|
|
9
|
+
if (!statistics || statistics.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
// Get statistics for both teams and match them by displayName
|
|
13
|
+
const homeStats = homeTeam.statistics || [];
|
|
14
|
+
const awayStats = awayTeam.statistics || [];
|
|
15
|
+
// Create a map of statistics by displayName for easier lookup
|
|
16
|
+
const createStatsMap = (stats) => {
|
|
17
|
+
return stats.reduce((map, stat) => {
|
|
18
|
+
map[stat.displayName] = stat;
|
|
19
|
+
return map;
|
|
20
|
+
}, {});
|
|
21
|
+
};
|
|
22
|
+
const homeStatsMap = createStatsMap(homeStats);
|
|
23
|
+
const awayStatsMap = createStatsMap(awayStats);
|
|
24
|
+
// Filter statistics to only include those that exist for both teams
|
|
25
|
+
const matchedStatistics = statistics.filter((stat) => homeStatsMap[stat.displayName] && awayStatsMap[stat.displayName]);
|
|
26
|
+
return (React.createElement("section", { className: "team-stats-view focus-ring", "data-focused": props.focused, style: {
|
|
27
|
+
'--home-team': `#${homeTeam.color}`,
|
|
28
|
+
'--away-team': `#${awayTeam.color}`,
|
|
29
|
+
} },
|
|
30
|
+
React.createElement("div", { className: "team-stats-header" },
|
|
31
|
+
React.createElement("div", { className: "team-stats-team away-team" },
|
|
32
|
+
React.createElement("div", { className: "team-stats-team-inner" },
|
|
33
|
+
awayTeam.logo && (React.createElement(Image, { src: awayTeam.logo, alt: awayTeam.displayName, crossOrigin: "anonymous", className: "team-logo" })),
|
|
34
|
+
React.createElement("div", { className: "team-swatch away-swatch" }),
|
|
35
|
+
React.createElement("span", { className: "team-abbreviation" }, awayTeam.abbreviation))),
|
|
36
|
+
React.createElement("h2", { className: "stats-title" }, "Team Stats"),
|
|
37
|
+
React.createElement("div", { className: "team-stats-team home-team" },
|
|
38
|
+
React.createElement("div", { className: "team-stats-team-inner" },
|
|
39
|
+
React.createElement("span", { className: "team-abbreviation" }, homeTeam.abbreviation),
|
|
40
|
+
React.createElement("div", { className: "team-swatch home-swatch" }),
|
|
41
|
+
homeTeam.logo && (React.createElement(Image, { src: homeTeam.logo, alt: homeTeam.displayName, crossOrigin: "anonymous", className: "team-logo" }))))),
|
|
42
|
+
React.createElement("div", { className: "team-stats-content" }, matchedStatistics.map((statistic) => {
|
|
43
|
+
const homeStat = homeStatsMap[statistic.displayName];
|
|
44
|
+
const awayStat = awayStatsMap[statistic.displayName];
|
|
45
|
+
// Parse values, handle different formats (numbers and strings)
|
|
46
|
+
const homeValue = homeStat
|
|
47
|
+
? parseFloat(homeStat.displayValue) || 0
|
|
48
|
+
: 0;
|
|
49
|
+
const awayValue = awayStat
|
|
50
|
+
? parseFloat(awayStat.displayValue) || 0
|
|
51
|
+
: 0;
|
|
52
|
+
return renderTeamStatistic({
|
|
53
|
+
statisticName: statistic.displayName,
|
|
54
|
+
firstDisplayValue: awayStat?.displayValue || '0',
|
|
55
|
+
secondDisplayValue: homeStat?.displayValue || '0',
|
|
56
|
+
awayProgressValue: awayValue,
|
|
57
|
+
homeProgressValue: homeValue,
|
|
58
|
+
key: statistic.displayName,
|
|
59
|
+
classNames: {
|
|
60
|
+
container: 'team-stat-item',
|
|
61
|
+
header: 'stat-header',
|
|
62
|
+
firstValue: 'stat-value away-value',
|
|
63
|
+
secondValue: 'stat-value home-value',
|
|
64
|
+
statisticName: 'stat-name',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}))));
|
|
68
|
+
};
|
|
69
|
+
export default withFocusable()(TeamStatsView);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TeamStatsView';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
itemsLength: number;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare const StatsCarousel: (props: Props) => React.JSX.Element;
|
|
7
|
+
declare const CarouselSlider: (props: Props) => React.JSX.Element;
|
|
8
|
+
export { StatsCarousel, CarouselSlider };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const StatsCarousel = (props) => {
|
|
3
|
+
return (React.createElement("div", { className: "carousel" },
|
|
4
|
+
React.createElement("div", { className: "carousel-track", style: {
|
|
5
|
+
width: `${props.itemsLength * 100}%`,
|
|
6
|
+
animation: `carousel-slide ${props.itemsLength * 6}s steps(${props.itemsLength}) infinite`,
|
|
7
|
+
} }, props.children)));
|
|
8
|
+
};
|
|
9
|
+
const CarouselSlider = (props) => {
|
|
10
|
+
return (React.createElement("div", { className: "carousel-slide", style: {
|
|
11
|
+
width: `${100 / props.itemsLength}%`,
|
|
12
|
+
} }, props.children));
|
|
13
|
+
};
|
|
14
|
+
export { StatsCarousel, CarouselSlider };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const StatsProgressBar = (props) => {
|
|
3
|
+
const total = props.homeTeamValue + props.awayTeamValue;
|
|
4
|
+
const awayTeamPercentage = total === 0 ? 0 : Math.round((props.awayTeamValue / total) * 100);
|
|
5
|
+
return (React.createElement("div", { className: "progress-bar" },
|
|
6
|
+
React.createElement("div", { className: "progress-fill" },
|
|
7
|
+
React.createElement("div", { className: "progress-solid", style: {
|
|
8
|
+
width: `${awayTeamPercentage}%`,
|
|
9
|
+
} }),
|
|
10
|
+
React.createElement("div", { className: "progress-stripes", style: {
|
|
11
|
+
left: `${awayTeamPercentage}%`,
|
|
12
|
+
width: `${100 - awayTeamPercentage}%`,
|
|
13
|
+
} }),
|
|
14
|
+
React.createElement("div", { className: "progress-divider", style: {
|
|
15
|
+
left: `${awayTeamPercentage}%`,
|
|
16
|
+
} }))));
|
|
17
|
+
};
|
|
18
|
+
export default StatsProgressBar;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './TeamsView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
type Team = {
|
|
6
|
+
color?: string;
|
|
7
|
+
id: string;
|
|
8
|
+
logo: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
abbreviation: string;
|
|
11
|
+
record?: string;
|
|
12
|
+
linescores: string[];
|
|
13
|
+
};
|
|
14
|
+
export type HeaderTeamStatItem = {
|
|
15
|
+
isLive: boolean;
|
|
16
|
+
linescoresHeader: string[];
|
|
17
|
+
statistics?: {
|
|
18
|
+
displayName: string;
|
|
19
|
+
homeTeamValue: number;
|
|
20
|
+
awayTeamValue: number;
|
|
21
|
+
}[];
|
|
22
|
+
homeTeam: Team;
|
|
23
|
+
awayTeam: Team;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: {
|
|
26
|
+
new (props?: (HeaderTeamStatItem & WithFocusableProps) | undefined, context?: any): {
|
|
27
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
28
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
29
|
+
getChildContext(): {
|
|
30
|
+
parentFocusKey: string;
|
|
31
|
+
};
|
|
32
|
+
setFocus: (focusKey: string) => void;
|
|
33
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
34
|
+
stealFocus: () => void;
|
|
35
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
36
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
37
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
38
|
+
onEnterReleaseHandler: () => void;
|
|
39
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
40
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
41
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
42
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
43
|
+
componentDidMount(): void;
|
|
44
|
+
componentDidUpdate(): void;
|
|
45
|
+
componentWillUnmount(): void;
|
|
46
|
+
render(): React.ReactElement<HeaderTeamStatItem & WithFocusableProps>;
|
|
47
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: HeaderTeamStatItem & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
48
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
49
|
+
props: Readonly<{
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
}> & Readonly<HeaderTeamStatItem & WithFocusableProps>;
|
|
52
|
+
context: any;
|
|
53
|
+
refs: {
|
|
54
|
+
[key: string]: React.ReactInstance;
|
|
55
|
+
};
|
|
56
|
+
componentWillMount?(): void;
|
|
57
|
+
componentWillReceiveProps?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextContext: any): void;
|
|
58
|
+
shouldComponentUpdate?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
59
|
+
componentWillUpdate?(nextProps: Readonly<HeaderTeamStatItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
60
|
+
};
|
|
61
|
+
contextTypes: {
|
|
62
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
63
|
+
};
|
|
64
|
+
childContextTypes: {
|
|
65
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TeamsView.styles.css';
|
|
3
|
+
import Image from '@/components/atoms/Image';
|
|
4
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
+
import { CarouselSlider, StatsCarousel } from './StatsCarousel';
|
|
6
|
+
import { renderTeamStatistic } from '../../utils/renderTeamStatistic';
|
|
7
|
+
const Teams = (props) => {
|
|
8
|
+
const teams = [props.homeTeam, props.awayTeam];
|
|
9
|
+
return (React.createElement("section", { className: "stats-teams-view focus-ring", "data-focused": props.focused, style: {
|
|
10
|
+
'--home-team': `#${props.homeTeam.color}`,
|
|
11
|
+
'--away-team': `#${props.awayTeam.color}`,
|
|
12
|
+
}, "data-live": props.isLive },
|
|
13
|
+
React.createElement("div", { className: "stats-teams-view-header" }, teams.map((team) => (React.createElement("div", { key: team.id, className: "stats-team" },
|
|
14
|
+
React.createElement(Image, { src: team.logo, alt: team.name, crossOrigin: "anonymous" }),
|
|
15
|
+
React.createElement("div", null,
|
|
16
|
+
React.createElement("span", { className: props.isLive ? 'T05_ALT' : 'T30' }, team.abbreviation),
|
|
17
|
+
React.createElement("p", { className: "T02" }, team.record)))))),
|
|
18
|
+
props.isLive && (React.createElement("div", { className: "statistics" },
|
|
19
|
+
React.createElement("table", { className: "statistics-table" },
|
|
20
|
+
React.createElement("thead", null,
|
|
21
|
+
React.createElement("tr", null,
|
|
22
|
+
React.createElement("th", { className: "T10" }),
|
|
23
|
+
props.linescoresHeader.map((header) => (React.createElement("th", { key: header, className: "T10" }, header))))),
|
|
24
|
+
React.createElement("tbody", null, teams.map((team) => (React.createElement("tr", { key: team.id },
|
|
25
|
+
React.createElement("td", { className: "T30" }, team.name),
|
|
26
|
+
team.linescores.map((lineScore, index) => (React.createElement("td", { key: `${lineScore}-${index}`, className: "T10" }, lineScore)))))))),
|
|
27
|
+
props.statistics && props.statistics.length > 0 && (React.createElement(StatsCarousel, { itemsLength: props.statistics.length }, props.statistics.map((statistic) => (React.createElement(CarouselSlider, { itemsLength: props.statistics.length, key: statistic.displayName }, renderTeamStatistic({
|
|
28
|
+
statisticName: statistic.displayName,
|
|
29
|
+
firstDisplayValue: statistic.homeTeamValue,
|
|
30
|
+
secondDisplayValue: statistic.awayTeamValue,
|
|
31
|
+
awayProgressValue: statistic.awayTeamValue,
|
|
32
|
+
homeProgressValue: statistic.homeTeamValue,
|
|
33
|
+
classNames: {
|
|
34
|
+
container: 'score-statistics',
|
|
35
|
+
header: 'score-statistics-header',
|
|
36
|
+
firstValue: 'T30',
|
|
37
|
+
secondValue: 'T30',
|
|
38
|
+
statisticName: 'statistic-name T02',
|
|
39
|
+
},
|
|
40
|
+
}))))))))));
|
|
41
|
+
};
|
|
42
|
+
export default withFocusable()(Teams);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './WinProbability.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
export type WinProbabilityStatsItem = {
|
|
6
|
+
chartImageUrl: string;
|
|
7
|
+
awayTeam: {
|
|
8
|
+
id: string;
|
|
9
|
+
abbreviation: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
winPercentage: string;
|
|
12
|
+
};
|
|
13
|
+
homeTeam: {
|
|
14
|
+
id: string;
|
|
15
|
+
abbreviation: string;
|
|
16
|
+
logo: string;
|
|
17
|
+
winPercentage: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const _default: {
|
|
21
|
+
new (props?: (WinProbabilityStatsItem & WithFocusableProps) | undefined, context?: any): {
|
|
22
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
23
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
24
|
+
getChildContext(): {
|
|
25
|
+
parentFocusKey: string;
|
|
26
|
+
};
|
|
27
|
+
setFocus: (focusKey: string) => void;
|
|
28
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
29
|
+
stealFocus: () => void;
|
|
30
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
31
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
32
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
33
|
+
onEnterReleaseHandler: () => void;
|
|
34
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
35
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
36
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
37
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
38
|
+
componentDidMount(): void;
|
|
39
|
+
componentDidUpdate(): void;
|
|
40
|
+
componentWillUnmount(): void;
|
|
41
|
+
render(): React.ReactElement<WinProbabilityStatsItem & WithFocusableProps>;
|
|
42
|
+
setState<K extends keyof import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>(state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | ((prevState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, props: WinProbabilityStatsItem & WithFocusableProps) => import("../../../../external/spatial-navigation/withFocusable").WithFocusableState | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>) | Pick<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState, K>, callback?: (() => any) | undefined): void;
|
|
43
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
44
|
+
props: Readonly<{
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
}> & Readonly<WinProbabilityStatsItem & WithFocusableProps>;
|
|
47
|
+
context: any;
|
|
48
|
+
refs: {
|
|
49
|
+
[key: string]: React.ReactInstance;
|
|
50
|
+
};
|
|
51
|
+
componentWillMount?(): void;
|
|
52
|
+
componentWillReceiveProps?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextContext: any): void;
|
|
53
|
+
shouldComponentUpdate?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
54
|
+
componentWillUpdate?(nextProps: Readonly<WinProbabilityStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
55
|
+
};
|
|
56
|
+
contextTypes: {
|
|
57
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
58
|
+
};
|
|
59
|
+
childContextTypes: {
|
|
60
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export default _default;
|