@maestro_io/maestro-web-sdk 2.1.1 → 2.1.2
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.js +52 -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.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.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 +72 -0
- package/dist/components/organisms/PanelNavigation/index.js +2 -0
- package/dist/components/organisms/SegmentController/SegmentController.js +69 -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 +1 -1
- package/dist/external/spatial-navigation/index.js +4 -0
- package/dist/external/spatial-navigation/measureLayout.js +30 -0
- package/dist/external/spatial-navigation/spatialNavigation.js +875 -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.js +238 -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.js +139 -0
- package/dist/modules/bets/view/SixPack/SixPackView.js +103 -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.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.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.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.js +142 -0
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +58 -0
- package/dist/modules/key-plays/view/KeyPlaysView.js +167 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +182 -0
- package/dist/modules/stats/interfaces/IStats.d.ts +163 -0
- package/dist/modules/stats/interfaces/IStats.js +1 -0
- package/dist/modules/stats/mocks.d.ts +2 -0
- package/dist/modules/stats/mocks.js +546 -0
- package/dist/modules/stats/utils.d.ts +39 -0
- package/dist/modules/stats/utils.js +62 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +29 -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 +52 -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 +62 -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 +51 -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 +87 -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 +14 -0
- package/dist/modules/stats/view/Teams/Teams.d.ts +67 -0
- package/dist/modules/stats/view/Teams/Teams.js +35 -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 +62 -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 +51 -0
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +28 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +10 -0
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +11 -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 +1 -0
- package/dist/modules/stats/view/index.js +1 -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/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 +2 -0
- package/dist/view-models/MaestroEventViewModel.js +156 -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,17 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
export interface DonutChartProps {
|
|
3
|
+
awayPercentage: number;
|
|
4
|
+
homePercentage: number;
|
|
5
|
+
size?: number;
|
|
6
|
+
strokeWidth?: number;
|
|
7
|
+
}
|
|
8
|
+
declare class DonutChart extends Component<DonutChartProps> {
|
|
9
|
+
static defaultProps: {
|
|
10
|
+
size: number;
|
|
11
|
+
strokeWidth: number;
|
|
12
|
+
};
|
|
13
|
+
private patternId;
|
|
14
|
+
constructor(props: DonutChartProps);
|
|
15
|
+
render(): React.JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
export default DonutChart;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { createArcPath, percentageToAngle } from '../../../utils';
|
|
3
|
+
class DonutChart extends Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
Object.defineProperty(this, "patternId", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: void 0
|
|
11
|
+
});
|
|
12
|
+
this.patternId = `homeStripes-${Math.random().toString(36).substr(2, 9)}`;
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const { awayPercentage, size = 280, strokeWidth = 32 } = this.props;
|
|
16
|
+
const radius = (size - strokeWidth) / 2;
|
|
17
|
+
const centerX = size / 2;
|
|
18
|
+
const centerY = size / 2;
|
|
19
|
+
// Calculate angles with equal gaps between sections
|
|
20
|
+
const awayAngle = percentageToAngle(awayPercentage);
|
|
21
|
+
const homeAngle = percentageToAngle(100 - awayPercentage);
|
|
22
|
+
const gapAngle = 3; // 3 degree gap between sections
|
|
23
|
+
const totalGaps = gapAngle * 2; // Two gaps total
|
|
24
|
+
// Adjust angles to account for gaps
|
|
25
|
+
const adjustedAwayAngle = (awayAngle * (360 - totalGaps)) / 360;
|
|
26
|
+
const adjustedHomeAngle = (homeAngle * (360 - totalGaps)) / 360;
|
|
27
|
+
const startAngle = 270; // Start from top
|
|
28
|
+
const awayEndAngle = startAngle + adjustedAwayAngle; // Away team section
|
|
29
|
+
const homeStartAngle = awayEndAngle + gapAngle; // Gap after away team
|
|
30
|
+
const homeEndAngle = homeStartAngle + adjustedHomeAngle; // Home team section
|
|
31
|
+
// Use consistent text-100 color for both teams
|
|
32
|
+
const chartColor = 'var(--sdk-text100)';
|
|
33
|
+
return (React.createElement("svg", { width: size, height: size, className: "donut-svg" },
|
|
34
|
+
React.createElement("defs", null,
|
|
35
|
+
React.createElement("pattern", { id: this.patternId, patternUnits: "userSpaceOnUse", width: "6", height: "6", patternTransform: "rotate(45)" },
|
|
36
|
+
React.createElement("rect", { width: "1", height: "6", fill: chartColor }),
|
|
37
|
+
React.createElement("rect", { x: "1", width: "2", height: "6", fill: "transparent" }),
|
|
38
|
+
React.createElement("rect", { x: "3", width: "1", height: "6", fill: chartColor }),
|
|
39
|
+
React.createElement("rect", { x: "4", width: "2", height: "6", fill: "transparent" }))),
|
|
40
|
+
React.createElement("path", { d: createArcPath(centerX, centerY, radius, startAngle, awayEndAngle), fill: "transparent", stroke: chartColor, strokeWidth: strokeWidth, strokeLinecap: "butt" }),
|
|
41
|
+
React.createElement("path", { d: createArcPath(centerX, centerY, radius, homeStartAngle, homeEndAngle), fill: "transparent", stroke: `url(#${this.patternId})`, strokeWidth: strokeWidth, strokeLinecap: "butt" }),
|
|
42
|
+
React.createElement("path", { d: createArcPath(centerX, centerY, radius, awayEndAngle, homeStartAngle), fill: "transparent", stroke: "var(--sdk-surface4)", strokeWidth: strokeWidth, strokeLinecap: "butt" }),
|
|
43
|
+
React.createElement("path", { d: createArcPath(centerX, centerY, radius, homeEndAngle, startAngle + 360), fill: "transparent", stroke: "var(--sdk-surface4)", strokeWidth: strokeWidth, strokeLinecap: "butt" })));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
Object.defineProperty(DonutChart, "defaultProps", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: {
|
|
51
|
+
size: 280,
|
|
52
|
+
strokeWidth: 32,
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export default DonutChart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DonutChart';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './MatchPredictorView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
import { Predictor, EntityMap, Team } from '../../interfaces/IStats';
|
|
6
|
+
export interface MatchPredictorProps {
|
|
7
|
+
predictor: Predictor;
|
|
8
|
+
teams: EntityMap<Team>;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: {
|
|
11
|
+
new (props?: (MatchPredictorProps & WithFocusableProps) | undefined, context?: any): {
|
|
12
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
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<MatchPredictorProps & 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: MatchPredictorProps & 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<MatchPredictorProps & WithFocusableProps>;
|
|
36
|
+
context: any;
|
|
37
|
+
refs: {
|
|
38
|
+
[key: string]: React.ReactInstance;
|
|
39
|
+
};
|
|
40
|
+
componentWillMount?(): void;
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<MatchPredictorProps & WithFocusableProps>, nextContext: any): void;
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<MatchPredictorProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<MatchPredictorProps & 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,66 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './MatchPredictorView.styles.css';
|
|
3
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
4
|
+
import DonutChart from './DonutChart/DonutChart';
|
|
5
|
+
import Image from '@/components/atoms/Image';
|
|
6
|
+
class MatchPredictorView extends Component {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
Object.defineProperty(this, "state", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: {
|
|
14
|
+
shouldRenderPredictorImage: Boolean(this.props.predictor.imageUrl),
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "handleImageError", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: () => {
|
|
22
|
+
this.setState({ shouldRenderPredictorImage: false });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const { predictor, teams } = this.props;
|
|
28
|
+
const { shouldRenderPredictorImage } = this.state;
|
|
29
|
+
// Get team data
|
|
30
|
+
const homeTeam = teams[predictor.homeTeam.team.$key];
|
|
31
|
+
const awayTeam = teams[predictor.awayTeam.team.$key];
|
|
32
|
+
// Parse percentages
|
|
33
|
+
const homePercentage = parseFloat(predictor.homeTeam.gameProjection);
|
|
34
|
+
const awayPercentage = parseFloat(predictor.awayTeam.gameProjection);
|
|
35
|
+
return (React.createElement("section", { className: "match-predictor-view focus-ring", "data-focused": this.props.focused },
|
|
36
|
+
React.createElement("div", { className: "match-predictor-header" },
|
|
37
|
+
React.createElement("h2", { className: "T05_ALT" }, predictor.header)),
|
|
38
|
+
React.createElement("div", { className: "match-predictor-percentages" },
|
|
39
|
+
React.createElement("div", { className: "team-percentage away-team" },
|
|
40
|
+
React.createElement("span", { className: "percentage-value T70" },
|
|
41
|
+
awayPercentage,
|
|
42
|
+
"%"),
|
|
43
|
+
React.createElement("div", { className: "team-info" },
|
|
44
|
+
React.createElement("div", { className: "legend-item away" },
|
|
45
|
+
React.createElement("div", { className: "legend-pattern away-pattern" }),
|
|
46
|
+
React.createElement("span", { className: "T02" }, awayTeam?.abbreviation)))),
|
|
47
|
+
React.createElement("div", { className: "team-percentage home-team" },
|
|
48
|
+
React.createElement("span", { className: "percentage-value T70" },
|
|
49
|
+
homePercentage,
|
|
50
|
+
"%"),
|
|
51
|
+
React.createElement("div", { className: "team-info" },
|
|
52
|
+
React.createElement("div", { className: "legend-item home" },
|
|
53
|
+
React.createElement("div", { className: "legend-pattern home-pattern" }),
|
|
54
|
+
React.createElement("span", { className: "T02" }, homeTeam?.abbreviation))))),
|
|
55
|
+
React.createElement("div", { className: "donut-chart-container" }, shouldRenderPredictorImage && predictor.imageUrl ? (React.createElement("div", { className: "actual-chart" },
|
|
56
|
+
React.createElement(Image, { src: predictor.imageUrl, alt: "Match Predictor Chart", className: "predictor-chart-image", onError: this.handleImageError }))) : (React.createElement("div", { className: "svg-chart-fallback" },
|
|
57
|
+
React.createElement("div", { className: "svg-donut-container" },
|
|
58
|
+
React.createElement(DonutChart, { awayPercentage: awayPercentage, homePercentage: homePercentage }),
|
|
59
|
+
React.createElement("div", { className: "donut-center" },
|
|
60
|
+
React.createElement("div", { className: "center-team-logos" },
|
|
61
|
+
React.createElement("div", { className: "center-logo away-center-logo" }, awayTeam?.logo ? (React.createElement(Image, { src: awayTeam.logo, alt: awayTeam.displayName, className: "center-logo-image" })) : (React.createElement("span", { className: "center-logo-fallback T30" }, awayTeam?.abbreviation))),
|
|
62
|
+
React.createElement("div", { className: "center-divider" }),
|
|
63
|
+
React.createElement("div", { className: "center-logo home-center-logo" }, homeTeam?.logo ? (React.createElement(Image, { src: homeTeam.logo, alt: homeTeam.displayName, className: "center-logo-image" })) : (React.createElement("span", { className: "center-logo-fallback T30" }, homeTeam?.abbreviation)))))))))));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export default withFocusable()(MatchPredictorView);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import './RecentGames.styles.css';
|
|
5
|
+
type PreviousGame = {
|
|
6
|
+
score: string;
|
|
7
|
+
gameResult: string;
|
|
8
|
+
teamLogo: string;
|
|
9
|
+
homeAway: string;
|
|
10
|
+
};
|
|
11
|
+
type Team = {
|
|
12
|
+
logo: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
events: PreviousGame[];
|
|
15
|
+
};
|
|
16
|
+
export type RecentGamesStatsItem = {
|
|
17
|
+
awayTeam: Team;
|
|
18
|
+
homeTeam: Team;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: {
|
|
21
|
+
new (props?: (RecentGamesStatsItem & WithFocusableProps) | undefined, context?: any): {
|
|
22
|
+
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
23
|
+
getChildContext(): {
|
|
24
|
+
parentFocusKey: string;
|
|
25
|
+
};
|
|
26
|
+
setFocus: (focusKey: string) => void;
|
|
27
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
28
|
+
stealFocus: () => void;
|
|
29
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
30
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
31
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
32
|
+
onEnterReleaseHandler: () => void;
|
|
33
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
34
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
35
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
36
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
37
|
+
componentDidMount(): void;
|
|
38
|
+
componentDidUpdate(): void;
|
|
39
|
+
componentWillUnmount(): void;
|
|
40
|
+
render(): React.ReactElement<RecentGamesStatsItem & WithFocusableProps>;
|
|
41
|
+
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: RecentGamesStatsItem & 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;
|
|
42
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
43
|
+
props: Readonly<{
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
}> & Readonly<RecentGamesStatsItem & WithFocusableProps>;
|
|
46
|
+
context: any;
|
|
47
|
+
refs: {
|
|
48
|
+
[key: string]: React.ReactInstance;
|
|
49
|
+
};
|
|
50
|
+
componentWillMount?(): void;
|
|
51
|
+
componentWillReceiveProps?(nextProps: Readonly<RecentGamesStatsItem & WithFocusableProps>, nextContext: any): void;
|
|
52
|
+
shouldComponentUpdate?(nextProps: Readonly<RecentGamesStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
53
|
+
componentWillUpdate?(nextProps: Readonly<RecentGamesStatsItem & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
54
|
+
};
|
|
55
|
+
contextTypes: {
|
|
56
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
57
|
+
};
|
|
58
|
+
childContextTypes: {
|
|
59
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { withFocusable, } from '@/external/spatial-navigation';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './RecentGames.styles.css';
|
|
4
|
+
import Image from '@/components/atoms/Image';
|
|
5
|
+
const RecentGames = (props) => {
|
|
6
|
+
return (React.createElement("section", { className: "recent-games focus-ring", "data-focused": props.focused },
|
|
7
|
+
React.createElement("h5", { className: "T05_ALT" }, "Recent Games"),
|
|
8
|
+
React.createElement("div", { className: "recent-games-teams" }, [props.awayTeam, props.homeTeam].map((team, index) => (React.createElement("div", { className: "team-container", key: team.name || team.logo || index },
|
|
9
|
+
React.createElement(Image, { src: team.logo, alt: team.name || '', crossOrigin: "anonymous" }),
|
|
10
|
+
React.createElement("span", { className: "T05_ALT" }, team.name))))),
|
|
11
|
+
React.createElement("div", { className: "recent-games-list-group" }, [props.awayTeam, props.homeTeam].map((team, index) => (React.createElement("div", { className: "recent-games-list", key: team.name || team.logo || index }, team.events.map((event) => (React.createElement("div", { className: "recent-game-item T10", key: event.teamLogo +
|
|
12
|
+
event.score +
|
|
13
|
+
event.gameResult +
|
|
14
|
+
event.homeAway },
|
|
15
|
+
React.createElement("div", { className: "recent-game-item-team" },
|
|
16
|
+
React.createElement("span", null, event.homeAway === 'home' ? 'VS' : '@'),
|
|
17
|
+
React.createElement(Image, { src: event.teamLogo, alt: `${team.name} event ${event.score}`, crossOrigin: "anonymous" })),
|
|
18
|
+
React.createElement("div", { className: "recent-game-item-result" },
|
|
19
|
+
React.createElement("span", { "data-result": event.gameResult }, event.gameResult),
|
|
20
|
+
event.score))))))))));
|
|
21
|
+
};
|
|
22
|
+
export default withFocusable()(RecentGames);
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
getChildContext(): {
|
|
13
|
+
parentFocusKey: string;
|
|
14
|
+
};
|
|
15
|
+
setFocus: (focusKey: string) => void;
|
|
16
|
+
navigateByDirection: (direction: import("../../../../external/spatial-navigation/utils").Direction, details?: Record<string, any>) => void;
|
|
17
|
+
stealFocus: () => void;
|
|
18
|
+
onUpdateFocus: (focused: boolean) => void;
|
|
19
|
+
onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
|
|
20
|
+
onEnterPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
21
|
+
onEnterReleaseHandler: () => void;
|
|
22
|
+
onBackPressHandler: (details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
23
|
+
onArrowPressHandler: (direction: import("../../../../external/spatial-navigation/utils").Direction, details: import("../../../../external/spatial-navigation/utils").Details) => boolean | void;
|
|
24
|
+
onBecameFocusedHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
25
|
+
onBecameBlurredHandler: (layout: import("../../../../external/spatial-navigation/utils").Layout, details: import("../../../../external/spatial-navigation/utils").Details) => void;
|
|
26
|
+
componentDidMount(): void;
|
|
27
|
+
componentDidUpdate(): void;
|
|
28
|
+
componentWillUnmount(): void;
|
|
29
|
+
render(): React.ReactElement<StatsQRCodeViewProps & WithFocusableProps>;
|
|
30
|
+
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;
|
|
31
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
32
|
+
props: Readonly<{
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}> & Readonly<StatsQRCodeViewProps & WithFocusableProps>;
|
|
35
|
+
context: any;
|
|
36
|
+
refs: {
|
|
37
|
+
[key: string]: React.ReactInstance;
|
|
38
|
+
};
|
|
39
|
+
componentWillMount?(): void;
|
|
40
|
+
componentWillReceiveProps?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextContext: any): void;
|
|
41
|
+
shouldComponentUpdate?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
42
|
+
componentWillUpdate?(nextProps: Readonly<StatsQRCodeViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
43
|
+
};
|
|
44
|
+
contextTypes: {
|
|
45
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
46
|
+
};
|
|
47
|
+
childContextTypes: {
|
|
48
|
+
parentFocusKey: import("prop-types").Requireable<string>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
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.JSX.Element | null;
|
|
18
|
+
render(): React.JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export default StatsView;
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
class StatsView extends Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
Object.defineProperty(this, "container", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: null
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "statsDataUnsub", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: null
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "isDataLoadingUnsub", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: null
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "vm", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "renderStatsComponents", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: () => {
|
|
39
|
+
const { statsData } = this.state;
|
|
40
|
+
if (!statsData) {
|
|
41
|
+
return React.createElement("div", { className: "stats-loading T02" }, "Loading...");
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
return (React.createElement("div", null,
|
|
45
|
+
statsData.predictor && (React.createElement(MatchPredictorView, { predictor: statsData.predictor, teams: statsData.entities.teams })),
|
|
46
|
+
statsData.promotion && (React.createElement(StatsQRCodeView, { promotion: statsData.promotion }))));
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error('Error rendering stats components:', error);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this.vm = SDK.getMaestroEventViewModel().statsViewModel;
|
|
55
|
+
this.state = {
|
|
56
|
+
container: null,
|
|
57
|
+
statsData: this.vm.statsData.value,
|
|
58
|
+
isDataLoading: this.vm.isDataLoading.value,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
this.setState({
|
|
63
|
+
container: this.container,
|
|
64
|
+
});
|
|
65
|
+
this.statsDataUnsub = this.vm.statsData.subscribe((value) => {
|
|
66
|
+
this.setState({ statsData: value });
|
|
67
|
+
});
|
|
68
|
+
this.isDataLoadingUnsub = this.vm.isDataLoading.subscribe((value) => {
|
|
69
|
+
this.setState({ isDataLoading: value });
|
|
70
|
+
});
|
|
71
|
+
// Initialize the view model
|
|
72
|
+
this.vm.init();
|
|
73
|
+
}
|
|
74
|
+
componentWillUnmount() {
|
|
75
|
+
this.statsDataUnsub && this.statsDataUnsub();
|
|
76
|
+
this.isDataLoadingUnsub && this.isDataLoadingUnsub();
|
|
77
|
+
// Clean up the view model
|
|
78
|
+
this.vm.cleanup();
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return (React.createElement(ScrollableContainer, { scrollableContainerRef: this.state.container, containerTopOffset: 40 },
|
|
82
|
+
React.createElement("div", { className: "stats-view", ref: (e) => (this.container = e) },
|
|
83
|
+
this.renderStatsComponents(),
|
|
84
|
+
React.createElement("div", { className: "stats-bottom-padding" }))));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export default StatsView;
|
|
@@ -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,14 @@
|
|
|
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-divider", style: {
|
|
8
|
+
right: `${awayTeamPercentage}%`,
|
|
9
|
+
} }),
|
|
10
|
+
React.createElement("div", { className: "progress-stripes", style: {
|
|
11
|
+
width: `${awayTeamPercentage}%`,
|
|
12
|
+
} }))));
|
|
13
|
+
};
|
|
14
|
+
export default StatsProgressBar;
|