@maestro_io/maestro-web-sdk 2.1.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MaestroEventDelegate.d.ts +1 -0
- package/dist/components/atoms/Rive/index.d.ts +1 -0
- package/dist/components/atoms/SvgIcon/Icon.d.ts +0 -2
- package/dist/components/core/ScrollableContainer/ScrollableContainer.d.ts +3 -1
- package/dist/components/molecules/ActionButton/ActionButton.d.ts +1 -0
- package/dist/components/molecules/PanelNavButton/PanelNavButton.d.ts +1 -0
- package/dist/components/organisms/SegmentController/SegmentController.d.ts +2 -2
- package/dist/external/spatial-navigation/index.d.ts +2 -3
- package/dist/external/spatial-navigation/spatialNavigation.d.ts +3 -5
- package/dist/external/spatial-navigation/withFocusable.d.ts +1 -0
- package/dist/interfaces/IMaestroEvent.d.ts +14 -0
- package/dist/interfaces/IMaestroEventDelegate.d.ts +19 -6
- 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/HotProps/HotPropsView.d.ts +7 -6
- package/dist/modules/bets/view/SixPack/SixPackView.d.ts +2 -2
- package/dist/modules/bets/view/TabLoadFailureView.d.ts +1 -0
- package/dist/modules/bets/view/UserBets/BetsCard/BetsCard.d.ts +7 -6
- package/dist/modules/bets/view/components/Bet/Bet.d.ts +1 -0
- package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +2 -2
- package/dist/modules/key-plays/view/KeyPlayCardView.d.ts +0 -4
- package/dist/modules/stats/interfaces/IStats.d.ts +44 -15
- package/dist/modules/stats/utils/driveSummaryUtils.d.ts +18 -0
- package/dist/modules/stats/utils/renderTeamStatistic.d.ts +21 -0
- package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +21 -0
- package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +5 -0
- package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +10 -0
- package/dist/modules/stats/view/ActiveAthletes/index.d.ts +2 -0
- 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 -25
- package/dist/modules/stats/view/MatchPredictor/MatchPredictorView.d.ts +13 -47
- package/dist/modules/stats/view/RecentGames/RecentGames.d.ts +11 -21
- package/dist/modules/stats/view/StatsItemView.d.ts +19 -0
- package/dist/modules/stats/view/StatsQRCode/StatsQRCodeView.d.ts +1 -0
- package/dist/modules/stats/view/StatsView.d.ts +3 -3
- package/dist/modules/stats/view/TeamStats/TeamStatsView.d.ts +52 -0
- package/dist/modules/stats/view/TeamStats/index.d.ts +2 -0
- package/dist/modules/stats/view/Teams/Teams.d.ts +11 -26
- package/dist/modules/stats/view/WinProbability/WinProbability.d.ts +11 -21
- package/dist/modules/stats/view/components/AthletesStatistics/AthletesStatistics.d.ts +19 -3
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.d.ts +2 -8
- package/dist/modules/stats/view/index.d.ts +1 -0
- package/dist/modules/stats/view-model/StatsViewModel.d.ts +149 -5
- package/dist/services/StatsService.d.ts +36 -0
- package/dist/view-models/MaestroEventViewModel.d.ts +7 -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 -52
- 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 -72
- package/dist/components/organisms/PanelNavigation/index.js +0 -2
- package/dist/components/organisms/SegmentController/SegmentController.js +0 -69
- 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 -4
- package/dist/external/spatial-navigation/measureLayout.js +0 -30
- package/dist/external/spatial-navigation/spatialNavigation.js +0 -875
- 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 -238
- 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 -142
- package/dist/modules/key-plays/view/KeyPlayErrorStateView.js +0 -58
- package/dist/modules/key-plays/view/KeyPlaysView.js +0 -167
- 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 -546
- package/dist/modules/stats/utils.js +0 -62
- 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 -87
- package/dist/modules/stats/view/Teams/StatsCarousel.js +0 -14
- package/dist/modules/stats/view/Teams/StatsProgressBar.js +0 -14
- package/dist/modules/stats/view/Teams/Teams.js +0 -35
- 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 -28
- package/dist/modules/stats/view/components/AthletesStatistics/StatisticTable.js +0 -11
- package/dist/modules/stats/view/components/AthletesStatistics/index.js +0 -2
- package/dist/modules/stats/view/index.js +0 -1
- 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/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 -156
- 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,9 +1,9 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import './StatsView.styles.css';
|
|
3
|
-
import {
|
|
3
|
+
import { StatsItem } from '../view-model/StatsViewModel';
|
|
4
4
|
interface StatsViewState {
|
|
5
5
|
container: HTMLDivElement | null;
|
|
6
|
-
|
|
6
|
+
statsItems: StatsItem[];
|
|
7
7
|
isDataLoading: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare class StatsView extends Component<{}, StatsViewState> {
|
|
@@ -14,7 +14,7 @@ declare class StatsView extends Component<{}, StatsViewState> {
|
|
|
14
14
|
constructor(props: {});
|
|
15
15
|
componentDidMount(): void;
|
|
16
16
|
componentWillUnmount(): void;
|
|
17
|
-
|
|
17
|
+
renderItems: () => React.JSX.Element[] | null;
|
|
18
18
|
render(): React.JSX.Element;
|
|
19
19
|
}
|
|
20
20
|
export default StatsView;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="prop-types" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './TeamStatsView.styles.css';
|
|
4
|
+
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
+
import { TeamStatsItem } from '../../view-model/StatsViewModel';
|
|
6
|
+
export interface TeamStatsViewProps {
|
|
7
|
+
item: TeamStatsItem;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: {
|
|
10
|
+
new (props?: (TeamStatsViewProps & 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<TeamStatsViewProps & 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: 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;
|
|
32
|
+
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
33
|
+
props: Readonly<{
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}> & Readonly<TeamStatsViewProps & WithFocusableProps>;
|
|
36
|
+
context: any;
|
|
37
|
+
refs: {
|
|
38
|
+
[key: string]: React.ReactInstance;
|
|
39
|
+
};
|
|
40
|
+
componentWillMount?(): void;
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<TeamStatsViewProps & WithFocusableProps>, nextContext: any): void;
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<TeamStatsViewProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<TeamStatsViewProps & 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;
|
|
@@ -2,29 +2,14 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './TeamsView.styles.css';
|
|
4
4
|
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
5
|
+
import { HeaderTeamStatItem } from '../../view-model/StatsViewModel';
|
|
6
|
+
type TeamsProps = {
|
|
7
|
+
item: HeaderTeamStatItem;
|
|
24
8
|
};
|
|
25
9
|
declare const _default: {
|
|
26
|
-
new (props?: (
|
|
10
|
+
new (props?: (TeamsProps & WithFocusableProps) | undefined, context?: any): {
|
|
27
11
|
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
12
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
28
13
|
getChildContext(): {
|
|
29
14
|
parentFocusKey: string;
|
|
30
15
|
};
|
|
@@ -42,20 +27,20 @@ declare const _default: {
|
|
|
42
27
|
componentDidMount(): void;
|
|
43
28
|
componentDidUpdate(): void;
|
|
44
29
|
componentWillUnmount(): void;
|
|
45
|
-
render(): React.ReactElement<
|
|
46
|
-
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:
|
|
30
|
+
render(): React.ReactElement<TeamsProps & 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: TeamsProps & 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;
|
|
47
32
|
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
48
33
|
props: Readonly<{
|
|
49
34
|
children?: React.ReactNode;
|
|
50
|
-
}> & Readonly<
|
|
35
|
+
}> & Readonly<TeamsProps & WithFocusableProps>;
|
|
51
36
|
context: any;
|
|
52
37
|
refs: {
|
|
53
38
|
[key: string]: React.ReactInstance;
|
|
54
39
|
};
|
|
55
40
|
componentWillMount?(): void;
|
|
56
|
-
componentWillReceiveProps?(nextProps: Readonly<
|
|
57
|
-
shouldComponentUpdate?(nextProps: Readonly<
|
|
58
|
-
componentWillUpdate?(nextProps: Readonly<
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<TeamsProps & WithFocusableProps>, nextContext: any): void;
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<TeamsProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<TeamsProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
59
44
|
};
|
|
60
45
|
contextTypes: {
|
|
61
46
|
parentFocusKey: import("prop-types").Requireable<string>;
|
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './WinProbability.styles.css';
|
|
4
4
|
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
};
|
|
5
|
+
import { WinProbabilityStatsItem } from '../../view-model/StatsViewModel';
|
|
6
|
+
type WinProbabilityProps = {
|
|
7
|
+
item: WinProbabilityStatsItem;
|
|
19
8
|
};
|
|
20
9
|
declare const _default: {
|
|
21
|
-
new (props?: (
|
|
10
|
+
new (props?: (WinProbabilityProps & WithFocusableProps) | undefined, context?: any): {
|
|
22
11
|
state: import("../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
12
|
+
navigation: import("../../../../external/spatial-navigation/spatialNavigation").default;
|
|
23
13
|
getChildContext(): {
|
|
24
14
|
parentFocusKey: string;
|
|
25
15
|
};
|
|
@@ -37,20 +27,20 @@ declare const _default: {
|
|
|
37
27
|
componentDidMount(): void;
|
|
38
28
|
componentDidUpdate(): void;
|
|
39
29
|
componentWillUnmount(): void;
|
|
40
|
-
render(): React.ReactElement<
|
|
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:
|
|
30
|
+
render(): React.ReactElement<WinProbabilityProps & 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: WinProbabilityProps & 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
32
|
forceUpdate(callBack?: (() => any) | undefined): void;
|
|
43
33
|
props: Readonly<{
|
|
44
34
|
children?: React.ReactNode;
|
|
45
|
-
}> & Readonly<
|
|
35
|
+
}> & Readonly<WinProbabilityProps & WithFocusableProps>;
|
|
46
36
|
context: any;
|
|
47
37
|
refs: {
|
|
48
38
|
[key: string]: React.ReactInstance;
|
|
49
39
|
};
|
|
50
40
|
componentWillMount?(): void;
|
|
51
|
-
componentWillReceiveProps?(nextProps: Readonly<
|
|
52
|
-
shouldComponentUpdate?(nextProps: Readonly<
|
|
53
|
-
componentWillUpdate?(nextProps: Readonly<
|
|
41
|
+
componentWillReceiveProps?(nextProps: Readonly<WinProbabilityProps & WithFocusableProps>, nextContext: any): void;
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<WinProbabilityProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): boolean;
|
|
43
|
+
componentWillUpdate?(nextProps: Readonly<WinProbabilityProps & WithFocusableProps>, nextState: Readonly<import("../../../../external/spatial-navigation/withFocusable").WithFocusableState>, nextContext: any): void;
|
|
54
44
|
};
|
|
55
45
|
contextTypes: {
|
|
56
46
|
parentFocusKey: import("prop-types").Requireable<string>;
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
/// <reference types="prop-types" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { WithFocusableProps } from '@/external/spatial-navigation';
|
|
4
|
-
import { LeaderStatsItem } from '../../GameLeaders/GameLeaders';
|
|
5
4
|
import './AthleteStatistics.styles.css';
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { LeaderStatistic } from '@/modules/stats/interfaces/IStats';
|
|
6
|
+
type Athlete = {
|
|
7
|
+
id: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
headshot: string;
|
|
10
|
+
position: string;
|
|
11
|
+
shortName: string;
|
|
12
|
+
jersey: string;
|
|
13
|
+
statistics: LeaderStatistic[];
|
|
14
|
+
minifiedStatistics?: string;
|
|
15
|
+
};
|
|
16
|
+
export type AthletesStatisticsItem = {
|
|
17
|
+
displayName?: string;
|
|
18
|
+
awayAthlete: Athlete;
|
|
19
|
+
homeAthlete: Athlete;
|
|
20
|
+
};
|
|
21
|
+
export type AthletesStatisticsProps = {
|
|
22
|
+
item: AthletesStatisticsItem;
|
|
8
23
|
};
|
|
9
24
|
declare const _default: {
|
|
10
25
|
new (props?: (AthletesStatisticsProps & WithFocusableProps) | undefined, context?: any): {
|
|
11
26
|
state: import("../../../../../external/spatial-navigation/withFocusable").WithFocusableState;
|
|
27
|
+
navigation: import("../../../../../external/spatial-navigation/spatialNavigation").default;
|
|
12
28
|
getChildContext(): {
|
|
13
29
|
parentFocusKey: string;
|
|
14
30
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
awayAthleteValue: string;
|
|
5
|
-
abbreviation: string;
|
|
6
|
-
homeAthleteValue: string;
|
|
7
|
-
}[];
|
|
8
|
-
};
|
|
9
|
-
declare const StatisticsTable: (props: LeadersStatisticTableProps) => React.JSX.Element;
|
|
2
|
+
import { AthletesStatisticsProps } from './AthletesStatistics';
|
|
3
|
+
declare const StatisticsTable: (props: AthletesStatisticsProps) => React.JSX.Element;
|
|
10
4
|
export default StatisticsTable;
|
|
@@ -1,14 +1,122 @@
|
|
|
1
1
|
import { Observable } from '../../../helpers/Observable';
|
|
2
2
|
import { ViewModel } from '../../../view-models/ViewModel';
|
|
3
|
-
import {
|
|
3
|
+
import { DrivePlay, Team } from '../interfaces/IStats';
|
|
4
|
+
import { AthletesStatisticsItem } from '../view/components/AthletesStatistics/AthletesStatistics';
|
|
5
|
+
import StatsService from '@/services/StatsService';
|
|
6
|
+
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
7
|
+
declare const STATS_ERROR_STATE: {
|
|
8
|
+
readonly NONE: "none";
|
|
9
|
+
readonly TAB_LOAD_FAILURE: "tabLoadFailure";
|
|
10
|
+
};
|
|
11
|
+
export type BetsErrorState = typeof STATS_ERROR_STATE[keyof typeof STATS_ERROR_STATE];
|
|
12
|
+
export type HeaderTeamStatItem = {
|
|
13
|
+
type: 'headerTeam';
|
|
14
|
+
isLive: boolean;
|
|
15
|
+
linescoresHeader: string[];
|
|
16
|
+
statistics?: {
|
|
17
|
+
displayName: string;
|
|
18
|
+
homeTeamValue: number;
|
|
19
|
+
awayTeamValue: number;
|
|
20
|
+
}[];
|
|
21
|
+
homeTeam: Pick<Team, 'color' | 'id' | 'logo' | 'name' | 'abbreviation' | 'record'> & {
|
|
22
|
+
linescores: string[];
|
|
23
|
+
};
|
|
24
|
+
awayTeam: Pick<Team, 'color' | 'id' | 'logo' | 'name' | 'abbreviation' | 'record'> & {
|
|
25
|
+
linescores: string[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type RecentGamesPreviousGame = {
|
|
29
|
+
score: string;
|
|
30
|
+
gameResult: string;
|
|
31
|
+
teamLogo: string;
|
|
32
|
+
homeAway: string;
|
|
33
|
+
};
|
|
34
|
+
type RecentGamesTeam = {
|
|
35
|
+
logo: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
events: RecentGamesPreviousGame[];
|
|
38
|
+
};
|
|
39
|
+
export type RecentGamesStatsItem = {
|
|
40
|
+
type: 'recentGames';
|
|
41
|
+
awayTeam: RecentGamesTeam;
|
|
42
|
+
homeTeam: RecentGamesTeam;
|
|
43
|
+
};
|
|
44
|
+
export type WinProbabilityStatsItem = {
|
|
45
|
+
type: 'winProbability';
|
|
46
|
+
chartImageUrl: string;
|
|
47
|
+
awayTeam: Pick<Team, 'id' | 'abbreviation' | 'logo'> & {
|
|
48
|
+
winPercentage: string;
|
|
49
|
+
};
|
|
50
|
+
homeTeam: Pick<Team, 'id' | 'abbreviation' | 'logo'> & {
|
|
51
|
+
winPercentage: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type GameLeadersStatsItem = {
|
|
55
|
+
type: 'gameLeaders';
|
|
56
|
+
items: AthletesStatisticsItem[];
|
|
57
|
+
};
|
|
58
|
+
export type ActiveAthletesItem = {
|
|
59
|
+
type: 'activeAthletes';
|
|
60
|
+
displayText: string;
|
|
61
|
+
awayTeam: Pick<Team, 'id' | 'logo' | 'name'>;
|
|
62
|
+
homeTeam: Pick<Team, 'id' | 'logo' | 'name'>;
|
|
63
|
+
athletes: AthletesStatisticsItem[];
|
|
64
|
+
};
|
|
65
|
+
export type StatsPromotionItem = {
|
|
66
|
+
type: 'promotion';
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
logo: string;
|
|
70
|
+
qrCode: string;
|
|
71
|
+
backgroundImage: string;
|
|
72
|
+
};
|
|
73
|
+
export type StatsMatchPredictorItem = {
|
|
74
|
+
type: 'matchPredictor';
|
|
75
|
+
header: string;
|
|
76
|
+
imageUrl: string;
|
|
77
|
+
awayTeam: Pick<Team, 'abbreviation' | 'logo' | 'displayName'> & {
|
|
78
|
+
percentage: number;
|
|
79
|
+
};
|
|
80
|
+
homeTeam: Pick<Team, 'abbreviation' | 'logo' | 'displayName'> & {
|
|
81
|
+
percentage: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export type TeamStatsItem = {
|
|
85
|
+
type: 'teamStats';
|
|
86
|
+
awayTeam: Pick<Team, 'logo' | 'displayName' | 'color' | 'abbreviation'>;
|
|
87
|
+
homeTeam: Pick<Team, 'logo' | 'displayName' | 'color' | 'abbreviation'>;
|
|
88
|
+
statistics: {
|
|
89
|
+
displayName: string;
|
|
90
|
+
awayTeamDisplayValue: string;
|
|
91
|
+
homeTeamDisplayValue: string;
|
|
92
|
+
awayTeamValue: number;
|
|
93
|
+
homeTeamValue: number;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
96
|
+
export type DriveSummaryItem = {
|
|
97
|
+
type: 'driveSummary';
|
|
98
|
+
id: string;
|
|
99
|
+
team: Pick<Team, 'logo' | 'displayName'>;
|
|
100
|
+
playsQuantity: string;
|
|
101
|
+
yards: string;
|
|
102
|
+
time: string;
|
|
103
|
+
lastPlayMarquee: string;
|
|
104
|
+
plays: DrivePlay[];
|
|
105
|
+
};
|
|
106
|
+
export type StatsItem = HeaderTeamStatItem | RecentGamesStatsItem | WinProbabilityStatsItem | GameLeadersStatsItem | ActiveAthletesItem | StatsPromotionItem | StatsMatchPredictorItem | TeamStatsItem | DriveSummaryItem;
|
|
4
107
|
export declare class StatsViewModel extends ViewModel {
|
|
5
|
-
statsData: Observable<StatsApiResponse | null>;
|
|
6
108
|
isDataLoading: Observable<boolean>;
|
|
7
109
|
hasEverSuccessfullyLoaded: Observable<boolean>;
|
|
110
|
+
eventId: string;
|
|
111
|
+
statsItems: Observable<StatsItem[]>;
|
|
112
|
+
errorState: Observable<BetsErrorState>;
|
|
113
|
+
statsService: StatsService;
|
|
114
|
+
private pollingInterval;
|
|
8
115
|
private useMockData;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
options?: {
|
|
116
|
+
private pollingTask;
|
|
117
|
+
private lastResponseHash;
|
|
118
|
+
constructor(eventId: string, delegate: IMaestroEventDelegate, options?: {
|
|
119
|
+
pollingInterval?: number;
|
|
12
120
|
useMockData?: boolean;
|
|
13
121
|
});
|
|
14
122
|
/**
|
|
@@ -27,5 +135,41 @@ export declare class StatsViewModel extends ViewModel {
|
|
|
27
135
|
* Fetch mock data for testing
|
|
28
136
|
*/
|
|
29
137
|
private fetchMockData;
|
|
138
|
+
/**
|
|
139
|
+
* Refresh polling for bet data
|
|
140
|
+
*/
|
|
141
|
+
refreshPolling(): void;
|
|
142
|
+
/**
|
|
143
|
+
* Poll with the correct method based on authentication status
|
|
144
|
+
*/
|
|
145
|
+
private pollWithInterval;
|
|
146
|
+
/**
|
|
147
|
+
* Handle errors that occur during polling
|
|
148
|
+
*/
|
|
149
|
+
private handlePollingError;
|
|
150
|
+
/**
|
|
151
|
+
* Process data received from polling
|
|
152
|
+
*/
|
|
153
|
+
private processPolledData;
|
|
154
|
+
private processData;
|
|
155
|
+
private parseDriveSummary;
|
|
156
|
+
private parseTeamsStatistics;
|
|
157
|
+
private parseMatchPredictor;
|
|
158
|
+
private parsePromotion;
|
|
159
|
+
private parseHeaderTeams;
|
|
160
|
+
private parseRecentGames;
|
|
161
|
+
private parseWinProbability;
|
|
162
|
+
private parseGameLeaders;
|
|
163
|
+
private parseActiveAthletes;
|
|
164
|
+
private getActiveAthletesTeamInfo;
|
|
165
|
+
/**
|
|
166
|
+
* Stop polling for bet data
|
|
167
|
+
*/
|
|
168
|
+
stopPolling(): void;
|
|
169
|
+
}
|
|
170
|
+
declare global {
|
|
171
|
+
interface String {
|
|
172
|
+
hashCode(): number;
|
|
173
|
+
}
|
|
30
174
|
}
|
|
31
175
|
export default StatsViewModel;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import NetworkManager from './NetworkManager/NetworkManager';
|
|
2
|
+
import { StatsApiResponse } from '../modules/stats/interfaces/IStats';
|
|
3
|
+
import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
|
|
4
|
+
/**
|
|
5
|
+
* Service for handling stats-related API calls
|
|
6
|
+
*/
|
|
7
|
+
declare class StatsService {
|
|
8
|
+
networkManager: NetworkManager;
|
|
9
|
+
constructor(delegate: IMaestroEventDelegate);
|
|
10
|
+
/**
|
|
11
|
+
* Get stats for an event
|
|
12
|
+
*
|
|
13
|
+
* @param eventID - The ID of the event
|
|
14
|
+
* @param gameState - Optional game state filter (e.g., 'pre', 'in', 'post')
|
|
15
|
+
* @returns Promise with the stats data
|
|
16
|
+
*/
|
|
17
|
+
getStats(eventID: string, gameState?: string): Promise<StatsApiResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Start polling for stats
|
|
20
|
+
*
|
|
21
|
+
* @param eventID - The ID of the event
|
|
22
|
+
* @param gameState - Optional game state filter (e.g., 'pre', 'in', 'post')
|
|
23
|
+
* @param interval - The polling interval in milliseconds
|
|
24
|
+
* @param onData - Callback for successful data fetch
|
|
25
|
+
* @param onError - Callback for errors
|
|
26
|
+
* @returns Object with a stop function to stop polling
|
|
27
|
+
*/
|
|
28
|
+
pollStats(eventID: string, gameState: string | undefined, interval: number, onData: (data: StatsApiResponse) => void, onError?: (error: Error) => void): {
|
|
29
|
+
stop: () => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Get the endpoint for stats
|
|
33
|
+
*/
|
|
34
|
+
statsEndpoint(eventID: string): string;
|
|
35
|
+
}
|
|
36
|
+
export default StatsService;
|
|
@@ -4,6 +4,7 @@ import { Observable } from '../helpers/Observable';
|
|
|
4
4
|
import { ViewModel } from './ViewModel';
|
|
5
5
|
import KeyPlaysViewModel from '../modules/key-plays/view-model/KeyPlaysViewModel';
|
|
6
6
|
import BetsViewModel from '../modules/bets/view-model/BetsViewModel';
|
|
7
|
+
import SpatialNavigation from '@/external/spatial-navigation/spatialNavigation';
|
|
7
8
|
import StatsViewModel from '../modules/stats/view-model/StatsViewModel';
|
|
8
9
|
import IMaestroKeyPlaysResponse from '../modules/key-plays/interfaces/IKeyPlaysResponse';
|
|
9
10
|
import { MaestroPanelType } from '@/models/IPanel';
|
|
@@ -16,6 +17,7 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
|
|
|
16
17
|
keyPlaysViewModel: KeyPlaysViewModel;
|
|
17
18
|
betsViewModel: BetsViewModel;
|
|
18
19
|
statsViewModel: StatsViewModel;
|
|
20
|
+
navigation: SpatialNavigation;
|
|
19
21
|
constructor(eventId: string | undefined, delegate: IMaestroEventDelegate);
|
|
20
22
|
deinit(): void;
|
|
21
23
|
updateKeyPlaysData(data: IMaestroKeyPlaysResponse | null): Promise<void>;
|
|
@@ -40,4 +42,9 @@ export declare class MaestroEventViewModel extends ViewModel implements IMaestro
|
|
|
40
42
|
get isShowingPanel(): boolean;
|
|
41
43
|
set isShowingPanel(value: boolean);
|
|
42
44
|
simulateUseCase<T = any>(useCase: TestUseCase, panelType: MaestroPanelType, testData?: T): void;
|
|
45
|
+
/**
|
|
46
|
+
* This method is called when the user navigates to the MaestroEventViewModel.
|
|
47
|
+
* It will pause navigation and start focus management.
|
|
48
|
+
*/
|
|
49
|
+
deliverFocus(): void;
|
|
43
50
|
}
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import SDK from '.';
|
|
2
|
-
import { KEY_PLAYS_RESPONSE_MOCK_DATA } from './modules/key-plays/constants';
|
|
3
|
-
const playbackProgressIntervals = {};
|
|
4
|
-
let keyPlayClipError = true;
|
|
5
|
-
const allPlays = KEY_PLAYS_RESPONSE_MOCK_DATA.sections.reduce((prev, curr) => prev + curr.items.length, 0);
|
|
6
|
-
/**
|
|
7
|
-
* Our own implementation of the IMaestroEventDelegate interface. Useful for Development and Testing
|
|
8
|
-
*/
|
|
9
|
-
export default class MaestroEventDelegate {
|
|
10
|
-
getBettingAPIBaseURL() {
|
|
11
|
-
return 'http://localhost:8080/espn-api';
|
|
12
|
-
}
|
|
13
|
-
userRequestedNewKeyPlaysData() {
|
|
14
|
-
throw new Error('Method not implemented.');
|
|
15
|
-
}
|
|
16
|
-
startFocusManagement() {
|
|
17
|
-
return Promise.resolve();
|
|
18
|
-
}
|
|
19
|
-
userIsAuthenticated() {
|
|
20
|
-
const swid = SDK.getClientAppSwid();
|
|
21
|
-
const appToken = SDK.getClientAppToken();
|
|
22
|
-
return Promise.resolve(Boolean(swid && appToken));
|
|
23
|
-
}
|
|
24
|
-
getUserSWID() {
|
|
25
|
-
return Promise.resolve(SDK.getClientAppSwid() || null);
|
|
26
|
-
}
|
|
27
|
-
getUserToken() {
|
|
28
|
-
return Promise.resolve(SDK.getClientAppToken() || null);
|
|
29
|
-
}
|
|
30
|
-
playClip(atIndex) {
|
|
31
|
-
Object.values(playbackProgressIntervals).forEach((interval) => {
|
|
32
|
-
clearInterval(interval);
|
|
33
|
-
});
|
|
34
|
-
// Do something with the clip index
|
|
35
|
-
const event = SDK.getMaestroEventViewModel();
|
|
36
|
-
if (atIndex === 0 && keyPlayClipError) {
|
|
37
|
-
keyPlayClipError = false;
|
|
38
|
-
event.didFailToPlayClip(atIndex);
|
|
39
|
-
this.playClip(atIndex + 1);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
event.didStartPlayingClip(atIndex);
|
|
43
|
-
// Simulate playback progress
|
|
44
|
-
let progress = 0;
|
|
45
|
-
playbackProgressIntervals[atIndex] = setInterval(() => {
|
|
46
|
-
progress += 0.002;
|
|
47
|
-
if (progress >= 1) {
|
|
48
|
-
clearInterval(playbackProgressIntervals[atIndex]);
|
|
49
|
-
event.didStopPlayingClip(atIndex);
|
|
50
|
-
// if index is still under allPlays boundary, play next clip
|
|
51
|
-
if (atIndex + 1 < allPlays) {
|
|
52
|
-
return this.playClip(atIndex + 1);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
event.didUpdatePlaybackProgressOfClip(atIndex, progress);
|
|
57
|
-
}
|
|
58
|
-
}, 10);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './BaseButton.styles.css';
|
|
3
|
-
import FocusableItem from '@/components/core/ScrollableContainer/FocusableItem';
|
|
4
|
-
class BaseButton extends React.Component {
|
|
5
|
-
render() {
|
|
6
|
-
const className = ['base-button', this.props.className].join(' ');
|
|
7
|
-
return (React.createElement(FocusableItem, null,
|
|
8
|
-
React.createElement("button", { ...this.props, className: className }, this.props.children)));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export default BaseButton;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
class Image extends React.Component {
|
|
3
|
-
constructor(props) {
|
|
4
|
-
super(props);
|
|
5
|
-
Object.defineProperty(this, "state", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: {
|
|
10
|
-
failed: false,
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "handleError", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: () => {
|
|
18
|
-
this.setState({ failed: true });
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
if (this.state.failed) {
|
|
24
|
-
console.warn('Image failed to load:', this.props.src);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return (React.createElement("img", { alt: this.props.alt || 'Image', ...this.props, onError: this.handleError }));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export default Image;
|