@maestro_io/maestro-web-sdk 2.1.3 → 2.2.1
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.d.ts +1 -0
- package/dist/components/atoms/SvgIcon/Icon.d.ts +0 -2
- package/dist/components/core/PanelManager/PanelManager.d.ts +3 -0
- package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +3 -1
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +1 -1
- package/dist/helpers/url.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/interfaces/IMaestroEvent.d.ts +27 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +19 -6
- package/dist/interfaces/IMaestroManager.d.ts +8 -1
- package/dist/interfaces/IUserSettings.d.ts +36 -0
- package/dist/maestro-web-sdk.umd.js +3 -3
- package/dist/maestro-web-sdk.umd.js.map +1 -1
- package/dist/models/IPanel.d.ts +1 -2
- package/dist/modules/bets/view/BetsView.d.ts +4 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Boost/Boost.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Straight/Straight.d.ts +2 -1
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.d.ts +2 -1
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +7 -0
- package/dist/modules/bets/view-model/BetsViewModel.d.ts +15 -0
- package/dist/modules/key-plays/interfaces/IKeyPlays.d.ts +1 -0
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.d.ts +6 -6
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +4 -1
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.d.ts +2 -0
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +5 -1
- package/dist/modules/stats/interfaces/IStats.d.ts +38 -12
- package/dist/modules/stats/mocks.d.ts +0 -80
- package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +6 -19
- package/dist/modules/stats/view/DriveSummary/DrivePlayCard.d.ts +26 -0
- package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +24 -0
- package/dist/modules/stats/view/DriveSummary/index.d.ts +2 -0
- package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +15 -4
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -48
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +10 -21
- package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
- package/dist/modules/stats/view/StatsView.d.ts +3 -3
- package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +2 -4
- package/dist/modules/stats/view/Teams/Teams.d.ts +10 -26
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +10 -21
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
- package/dist/services/BetsService.d.ts +2 -2
- package/dist/services/NetworkManager/NetworkManager.d.ts +1 -3
- package/dist/services/NetworkManager/NetworkManagerFactory.d.ts +42 -0
- package/dist/services/NetworkManager/types.d.ts +77 -0
- package/dist/services/StatsService.d.ts +2 -2
- package/dist/services/UserSettingsManager.d.ts +63 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +5 -0
- package/dist/view-models/PanelManagerViewModel.d.ts +24 -0
- package/dist/view-models/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/MaestroEventDelegate.js +0 -60
- package/dist/components/atoms/BaseButton/BaseButton.js +0 -11
- package/dist/components/atoms/BaseButton/index.js +0 -2
- package/dist/components/atoms/Image/index.js +0 -30
- package/dist/components/atoms/Rive/index.js +0 -53
- package/dist/components/atoms/SvgIcon/BetGeneralIcon.js +0 -9
- package/dist/components/atoms/SvgIcon/BetsIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/BetsWarningIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/CheckmarkIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/CollapseIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/ExpandIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/FantasyIcon.d.ts +0 -6
- package/dist/components/atoms/SvgIcon/FantasyIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/FlameIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/Icon.js +0 -42
- package/dist/components/atoms/SvgIcon/KeyPlaysIcon.js +0 -10
- package/dist/components/atoms/SvgIcon/MobilePhoneIcon.js +0 -11
- package/dist/components/atoms/SvgIcon/PlayIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/StatsIcon.js +0 -12
- package/dist/components/atoms/SvgIcon/TimesIcon.js +0 -6
- package/dist/components/atoms/SvgIcon/WarningIcon.js +0 -8
- package/dist/components/atoms/SvgIcon/index.js +0 -2
- package/dist/components/core/App/App.js +0 -41
- package/dist/components/core/App/index.js +0 -2
- package/dist/components/core/OverlayContainer.js +0 -58
- package/dist/components/core/PanelManager/PanelManager.js +0 -80
- package/dist/components/core/PanelManager/index.js +0 -2
- package/dist/components/core/ScrollableContainer/FocusableItem.js +0 -38
- package/dist/components/core/ScrollableContainer/ScrollableContainer.js +0 -166
- package/dist/components/core/ScrollableContainer/index.js +0 -2
- package/dist/components/molecules/ActionButton/ActionButton.js +0 -10
- package/dist/components/molecules/ActionButton/index.js +0 -2
- package/dist/components/molecules/Overlay/Overlay.js +0 -139
- package/dist/components/molecules/Overlay/index.js +0 -2
- package/dist/components/molecules/PanelNavButton/PanelNavButton.js +0 -40
- package/dist/components/molecules/PanelNavButton/index.js +0 -2
- package/dist/components/molecules/SegmentButton/SegmentButton.js +0 -10
- package/dist/components/molecules/SegmentButton/index.js +0 -2
- package/dist/components/molecules/WatchButton/WatchButton.js +0 -15
- package/dist/components/molecules/WatchButton/index.js +0 -2
- package/dist/components/organisms/PanelNavigation/PanelNavigation.js +0 -71
- package/dist/components/organisms/PanelNavigation/index.js +0 -2
- package/dist/components/organisms/SegmentController/SegmentController.js +0 -68
- package/dist/components/organisms/SegmentController/index.js +0 -2
- package/dist/external/AxiosNetworkClient.js +0 -83
- package/dist/external/LocalStorageCacheManager.js +0 -213
- package/dist/external/ReactRenderer.js +0 -86
- package/dist/external/mocks/MockExternalNetworkClient.js +0 -161
- package/dist/external/ports/cacheManager.js +0 -1
- package/dist/external/ports/networkClient.js +0 -1
- package/dist/external/ports/renderer.js +0 -1
- package/dist/external/spatial-navigation/index.js +0 -3
- package/dist/external/spatial-navigation/measureLayout.js +0 -30
- package/dist/external/spatial-navigation/spatialNavigation.js +0 -864
- package/dist/external/spatial-navigation/utils.js +0 -6
- package/dist/external/spatial-navigation/visualDebugger.js +0 -76
- package/dist/external/spatial-navigation/withFocusable.js +0 -245
- package/dist/helpers/Observable.js +0 -37
- package/dist/helpers/deliver-focus.d.ts +0 -5
- package/dist/helpers/deliver-focus.js +0 -12
- package/dist/index.js +0 -192
- package/dist/interfaces/IMaestroEvent.js +0 -6
- package/dist/interfaces/IMaestroEventDelegate.js +0 -1
- package/dist/interfaces/IMaestroManager.js +0 -1
- package/dist/models/IModel.js +0 -1
- package/dist/models/IPanel.js +0 -53
- package/dist/models/ITheme.js +0 -20
- package/dist/models/IWinningBet.js +0 -1
- package/dist/modules/bets/interfaces/IBets.js +0 -1
- package/dist/modules/bets/mocks.js +0 -572
- package/dist/modules/bets/view/BetsView.js +0 -116
- package/dist/modules/bets/view/HotProps/HotPropsView.js +0 -139
- package/dist/modules/bets/view/SixPack/SixPackView.js +0 -103
- package/dist/modules/bets/view/TabLoadFailureView.js +0 -12
- package/dist/modules/bets/view/UserBets/BetResult/BetResult.js +0 -6
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.js +0 -122
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardEvent.js +0 -34
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCardFooter.js +0 -22
- package/dist/modules/bets/view/UserBets/Boost/Boost.js +0 -6
- package/dist/modules/bets/view/UserBets/OutcomeBadge/OutcomeBadge.js +0 -9
- package/dist/modules/bets/view/UserBets/Parlay/Parlay.js +0 -13
- package/dist/modules/bets/view/UserBets/Straight/Straight.js +0 -6
- package/dist/modules/bets/view/UserBets/Teaser/Teaser.js +0 -13
- package/dist/modules/bets/view/UserBets/UserBetsView.js +0 -114
- package/dist/modules/bets/view/components/Bet/Bet.js +0 -32
- package/dist/modules/bets/view/components/BetPill/BetPill.js +0 -6
- package/dist/modules/bets/view/components/BetsCard/BetsCard.js +0 -15
- package/dist/modules/bets/view/components/BetsCard/BetsCardHeader.js +0 -20
- package/dist/modules/bets/view/components/GamblingDisclaimer/GamblingDisclaimer.js +0 -14
- package/dist/modules/bets/view/components/LocationWarning/LocationWarning.js +0 -16
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.js +0 -63
- package/dist/modules/bets/view/components/PromoCodeBanner/index.js +0 -1
- package/dist/modules/bets/view-model/BetsViewModel.js +0 -767
- package/dist/modules/key-plays/constants.js +0 -292
- package/dist/modules/key-plays/interfaces/IKeyPlays.js +0 -14
- package/dist/modules/key-plays/interfaces/IKeyPlaysResponse.js +0 -1
- package/dist/modules/key-plays/view/KeyPlayCardScoreTagView.js +0 -13
- package/dist/modules/key-plays/view/KeyPlayCardView.js +0 -120
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
- package/dist/modules/key-plays/view/KeyPlaysView.js +0 -166
- package/dist/modules/key-plays/view-model/KeyPlaysViewModel.js +0 -182
- package/dist/modules/stats/interfaces/IStats.js +0 -1
- package/dist/modules/stats/mocks.js +0 -686
- package/dist/modules/stats/utils/renderTeamStatistic.js +0 -16
- package/dist/modules/stats/utils.js +0 -62
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.js +0 -78
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.js +0 -27
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.js +0 -15
- package/dist/modules/stats/view/ActiveAthletes/index.js +0 -2
- package/dist/modules/stats/view/GameLeaders/GameLeaders.js +0 -9
- package/dist/modules/stats/view/GameLeaders/index.js +0 -2
- package/dist/modules/stats/view/MatchPredictor/DonutChart/DonutChart.js +0 -55
- package/dist/modules/stats/view/MatchPredictor/DonutChart/index.js +0 -1
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.js +0 -66
- package/dist/modules/stats/view/MatchPredictor/index.js +0 -2
- package/dist/modules/stats/view/RecentGames/RecentGames.js +0 -22
- package/dist/modules/stats/view/RecentGames/index.js +0 -2
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.js +0 -38
- package/dist/modules/stats/view/StatsQRCode/index.js +0 -1
- package/dist/modules/stats/view/StatsView.js +0 -107
- package/dist/modules/stats/view/TeamStats/TeamStatsView.js +0 -69
- package/dist/modules/stats/view/TeamStats/index.js +0 -1
- package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -18
- package/dist/modules/stats/view/Teams/Teams.js +0 -42
- package/dist/modules/stats/view/Teams/index.js +0 -2
- package/dist/modules/stats/view/WinProbability/WinProbability.js +0 -27
- package/dist/modules/stats/view/WinProbability/index.js +0 -2
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.js +0 -29
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -12
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
- package/dist/modules/stats/view/index.js +0 -2
- package/dist/modules/stats/view-model/StatsViewModel.js +0 -90
- package/dist/services/BetsService.js +0 -102
- package/dist/services/NetworkManager/NetworkManager.js +0 -410
- package/dist/services/NetworkManager/errors.js +0 -45
- package/dist/services/StatsService.js +0 -68
- package/dist/services/ThemeManager/constants.js +0 -47
- package/dist/test-polyfills.js +0 -15
- package/dist/types/OverlayTypes.js +0 -4
- package/dist/view-models/MaestroEventViewModel.js +0 -168
- package/dist/view-models/OverlayViewModel.js +0 -222
- package/dist/view-models/PanelManagerViewModel.js +0 -80
- package/dist/view-models/ViewModel.js +0 -32
- package/dist/view-models/index.js +0 -59
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for stats module
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Convert polar coordinates to cartesian coordinates
|
|
6
|
-
* @param centerX - Center X coordinate
|
|
7
|
-
* @param centerY - Center Y coordinate
|
|
8
|
-
* @param radius - Radius from center
|
|
9
|
-
* @param angleInDegrees - Angle in degrees (0 degrees is at the top)
|
|
10
|
-
* @returns Point with x,y coordinates
|
|
11
|
-
*/
|
|
12
|
-
export const polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
|
|
13
|
-
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
|
|
14
|
-
return {
|
|
15
|
-
x: centerX + radius * Math.cos(angleInRadians),
|
|
16
|
-
y: centerY + radius * Math.sin(angleInRadians),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Create an SVG arc path string
|
|
21
|
-
* @param centerX - Center X coordinate
|
|
22
|
-
* @param centerY - Center Y coordinate
|
|
23
|
-
* @param radius - Arc radius
|
|
24
|
-
* @param startAngle - Start angle in degrees
|
|
25
|
-
* @param endAngle - End angle in degrees
|
|
26
|
-
* @returns SVG path string for the arc
|
|
27
|
-
*/
|
|
28
|
-
export const createArcPath = (centerX, centerY, radius, startAngle, endAngle) => {
|
|
29
|
-
const start = polarToCartesian(centerX, centerY, radius, endAngle);
|
|
30
|
-
const end = polarToCartesian(centerX, centerY, radius, startAngle);
|
|
31
|
-
const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';
|
|
32
|
-
return [
|
|
33
|
-
'M',
|
|
34
|
-
start.x,
|
|
35
|
-
start.y,
|
|
36
|
-
'A',
|
|
37
|
-
radius,
|
|
38
|
-
radius,
|
|
39
|
-
0,
|
|
40
|
-
largeArcFlag,
|
|
41
|
-
0,
|
|
42
|
-
end.x,
|
|
43
|
-
end.y,
|
|
44
|
-
].join(' ');
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Convert percentage to angle in degrees
|
|
48
|
-
* @param percentage - Percentage value (0-100)
|
|
49
|
-
* @returns Angle in degrees (0-360)
|
|
50
|
-
*/
|
|
51
|
-
export const percentageToAngle = (percentage) => {
|
|
52
|
-
return (percentage / 100) * 360;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Get team color with fallback
|
|
56
|
-
* @param teamColor - Team color from API (without #)
|
|
57
|
-
* @param fallbackColor - Fallback color (with #)
|
|
58
|
-
* @returns Color string with # prefix
|
|
59
|
-
*/
|
|
60
|
-
export const getTeamColor = (teamColor, fallbackColor = '#666666') => {
|
|
61
|
-
return teamColor ? `#${teamColor}` : fallbackColor;
|
|
62
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './ActiveAthletes.styles.css';
|
|
3
|
-
import Icon from '@/components/atoms/SvgIcon';
|
|
4
|
-
import { withFocusable, } from '@/external/spatial-navigation';
|
|
5
|
-
import CollapsedAthletes from './CollapsedAthletes/CollapsedAthletes';
|
|
6
|
-
import ExpandedAthletes from './ExpandedAthletes/ExpandedAthletes';
|
|
7
|
-
import SDK from '@/index';
|
|
8
|
-
class ActiveAthletes extends React.Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
Object.defineProperty(this, "onAthletesStatisticsArrowPress", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: (index) => (d) => {
|
|
16
|
-
if (d === 'up' && index === 0) {
|
|
17
|
-
SDK.getMaestroEventViewModel().navigation.setFocus(this.cardFocusKey);
|
|
18
|
-
this.setState({
|
|
19
|
-
expanded: false,
|
|
20
|
-
});
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(this, "onAthletesStatisticsBackPress", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: () => {
|
|
31
|
-
this.setState({
|
|
32
|
-
expanded: false,
|
|
33
|
-
}, () => {
|
|
34
|
-
SDK.getMaestroEventViewModel().navigation.setFocus(this.cardFocusKey);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
this.state = {
|
|
39
|
-
expanded: false,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
onEnterPress() {
|
|
43
|
-
const newValue = !this.state.expanded;
|
|
44
|
-
this.setState({
|
|
45
|
-
expanded: newValue,
|
|
46
|
-
}, () => {
|
|
47
|
-
if (newValue) {
|
|
48
|
-
const firstAthlete = this.props.item.athletes[0];
|
|
49
|
-
SDK.getMaestroEventViewModel().navigation.setFocus(`${firstAthlete.awayAthlete.id}-${firstAthlete.homeAthlete.id}-${firstAthlete.displayName}-statistics`);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
get cardFocusKey() {
|
|
54
|
-
return this.props.item.displayText
|
|
55
|
-
.trim()
|
|
56
|
-
.toLowerCase()
|
|
57
|
-
.replace(/\s+/g, '-');
|
|
58
|
-
}
|
|
59
|
-
renderContent() {
|
|
60
|
-
if (this.state.expanded) {
|
|
61
|
-
return (React.createElement(ExpandedAthletes, { item: this.props.item, onArrowPress: this.onAthletesStatisticsArrowPress, onBackPress: this.onAthletesStatisticsBackPress }));
|
|
62
|
-
}
|
|
63
|
-
return React.createElement(CollapsedAthletes, { item: this.props.item });
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
return (React.createElement(FocusableWrapper, { displayText: this.props.item.displayText, onEnterPress: this.onEnterPress.bind(this), expanded: this.state.expanded, focusKey: this.cardFocusKey }, this.renderContent()));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const Wrapper = (props) => {
|
|
70
|
-
return (React.createElement("section", { className: "active-athletes focus-ring", "data-focused": props.focused },
|
|
71
|
-
React.createElement("div", { className: "header" },
|
|
72
|
-
React.createElement("h5", { className: "T05_ALT" }, props.displayText),
|
|
73
|
-
React.createElement("div", { className: "icon-container", "data-focused": props.focused },
|
|
74
|
-
React.createElement(Icon, { iconName: props.expanded ? 'collapse' : 'expand', height: 48, width: 48 }))),
|
|
75
|
-
props.children));
|
|
76
|
-
};
|
|
77
|
-
const FocusableWrapper = withFocusable()(Wrapper);
|
|
78
|
-
export default ActiveAthletes;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './CollapsedAthletes.styles.css';
|
|
3
|
-
import Image from '@/components/atoms/Image';
|
|
4
|
-
const CollapsedAthletes = (props) => {
|
|
5
|
-
const { awayTeam, homeTeam, athletes } = props.item;
|
|
6
|
-
return (React.createElement("div", { className: "minified-content" },
|
|
7
|
-
React.createElement("div", { className: "teams-header" }, [awayTeam, homeTeam].map((team) => {
|
|
8
|
-
return (React.createElement("div", { className: "team-header", key: team.id },
|
|
9
|
-
React.createElement(Image, { src: team.logo, crossOrigin: "anonymous", alt: team.name }),
|
|
10
|
-
React.createElement("span", { className: "T05_ALT" }, team.name)));
|
|
11
|
-
})),
|
|
12
|
-
athletes.map((item, index) => {
|
|
13
|
-
return (React.createElement("div", { className: "minified-athletes", key: item.awayAthlete.id + item.homeAthlete.id },
|
|
14
|
-
React.createElement("div", { className: "athletes-jersey-row" }, [item.awayAthlete, item.homeAthlete].map((athlete) => {
|
|
15
|
-
return (React.createElement("div", { className: "T05_ALT", key: athlete.id + index + '-jersey' },
|
|
16
|
-
React.createElement("span", null,
|
|
17
|
-
"#",
|
|
18
|
-
athlete.jersey),
|
|
19
|
-
" ",
|
|
20
|
-
athlete.shortName));
|
|
21
|
-
})),
|
|
22
|
-
React.createElement("div", { className: "athletes-statistics-row" }, [item.awayAthlete, item.homeAthlete].map((athlete) => {
|
|
23
|
-
return (React.createElement("span", { key: athlete.id + index + '-statistic', className: "T02" }, athlete.minifiedStatistics || ''));
|
|
24
|
-
}))));
|
|
25
|
-
})));
|
|
26
|
-
};
|
|
27
|
-
export default CollapsedAthletes;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Image from '@/components/atoms/Image';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import './ExpandedAthletes.styles.css';
|
|
4
|
-
import AthletesStatistics from '../../components/AthletesStatistics';
|
|
5
|
-
const ExpandedAthletes = (props) => {
|
|
6
|
-
const { awayTeam, homeTeam, athletes } = props.item;
|
|
7
|
-
const { onArrowPress, onBackPress } = props;
|
|
8
|
-
return (React.createElement("div", { className: "active-athletes-statistics" },
|
|
9
|
-
React.createElement("div", { className: "divider" }),
|
|
10
|
-
React.createElement("div", { className: "active-athletes-statistics-header" }, [awayTeam, homeTeam].map((team) => (React.createElement("div", { className: "team-header", key: team.id },
|
|
11
|
-
React.createElement(Image, { src: team.logo, crossOrigin: "anonymous", alt: team.name }),
|
|
12
|
-
React.createElement("span", { className: "T05_ALT" }, team.name))))),
|
|
13
|
-
athletes.map((item, index) => (React.createElement(AthletesStatistics, { key: item.awayAthlete.id + item.homeAthlete.id + item.displayName, focusKey: `${item.awayAthlete.id}-${item.homeAthlete.id}-${item.displayName}-statistics`, item: item, onArrowPress: onArrowPress(index), onBackPress: onBackPress })))));
|
|
14
|
-
};
|
|
15
|
-
export default ExpandedAthletes;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './GameLeaders.styles.css';
|
|
3
|
-
import AthletesStatistics from '../components/AthletesStatistics';
|
|
4
|
-
const GameLeaders = (props) => {
|
|
5
|
-
return (React.createElement("section", { className: "game-leaders" },
|
|
6
|
-
React.createElement("h5", { className: "T05_ALT" }, "Game Leaders"),
|
|
7
|
-
props.items.map((item, index) => (React.createElement(AthletesStatistics, { key: `${index}-${item.awayAthlete.id}`, item: item, focusKey: String(index) })))));
|
|
8
|
-
};
|
|
9
|
-
export default GameLeaders;
|
|
@@ -1,55 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './DonutChart';
|
|
@@ -1,66 +0,0 @@
|
|
|
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);
|
|
@@ -1,22 +0,0 @@
|
|
|
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);
|
|
@@ -1,38 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './StatsQRCodeView';
|
|
@@ -1,107 +0,0 @@
|
|
|
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TeamStatsView';
|
|
@@ -1,14 +0,0 @@
|
|
|
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 };
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|