playball 3.1.0 → 3.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/cli.js +31 -0
- package/{src/components/AllPlays.jsx → dist/components/AllPlays.js} +22 -37
- package/dist/components/App.js +42 -0
- package/dist/components/AtBat.js +42 -0
- package/dist/components/Bases.js +23 -0
- package/dist/components/Count.js +21 -0
- package/dist/components/FinishedGame.js +90 -0
- package/dist/components/Game.js +50 -0
- package/dist/components/GameList.js +171 -0
- package/{src/components/Grid.jsx → dist/components/Grid.js} +30 -33
- package/dist/components/HelpBar.js +16 -0
- package/dist/components/InningDisplay.js +12 -0
- package/dist/components/LineScore.js +39 -0
- package/dist/components/LiveGame.js +51 -0
- package/{src/components/LoadingSpinner.jsx → dist/components/LoadingSpinner.js} +8 -24
- package/dist/components/Matchup.js +40 -0
- package/dist/components/PreviewGame.js +54 -0
- package/dist/components/Standings.js +70 -0
- package/{src → dist}/config.js +21 -62
- package/dist/features/games.js +100 -0
- package/{src → dist}/features/keys.js +19 -10
- package/dist/features/schedule.js +43 -0
- package/dist/features/standings.js +43 -0
- package/{src → dist}/hooks/useKey.js +3 -5
- package/dist/logger.js +11 -0
- package/dist/main.js +20 -0
- package/{src → dist}/package.js +2 -4
- package/{src → dist}/screen.js +2 -8
- package/dist/store/index.js +19 -0
- package/{src → dist}/style/index.js +2 -2
- package/{src → dist}/utils.js +4 -5
- package/package.json +5 -1
- package/.eslintrc.json +0 -33
- package/CODE_OF_CONDUCT.md +0 -76
- package/demo.cast +0 -95
- package/demo.gif +0 -0
- package/src/cli.js +0 -46
- package/src/components/App.jsx +0 -43
- package/src/components/AtBat.jsx +0 -41
- package/src/components/Bases.jsx +0 -23
- package/src/components/Count.jsx +0 -25
- package/src/components/FinishedGame.jsx +0 -76
- package/src/components/Game.jsx +0 -60
- package/src/components/GameList.jsx +0 -169
- package/src/components/HelpBar.jsx +0 -19
- package/src/components/InningDisplay.jsx +0 -19
- package/src/components/LineScore.jsx +0 -52
- package/src/components/LiveGame.jsx +0 -47
- package/src/components/Matchup.jsx +0 -41
- package/src/components/PreviewGame.jsx +0 -54
- package/src/components/Standings.jsx +0 -81
- package/src/features/games.js +0 -166
- package/src/features/schedule.js +0 -60
- package/src/features/standings.js +0 -61
- package/src/logger.js +0 -19
- package/src/main.js +0 -27
- package/src/store/index.js +0 -19
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
|
-
import { format } from 'date-fns';
|
|
4
|
-
import { selectTeams, selectVenue, selectStartTime, selectBoxscore, selectProbablePitchers, selectGameStatus } from '../features/games.js';
|
|
5
|
-
|
|
6
|
-
const formatPitcherName = (pitcher) => {
|
|
7
|
-
let display = pitcher.person.fullName;
|
|
8
|
-
const number = pitcher.jerseyNumber;
|
|
9
|
-
if (number) {
|
|
10
|
-
display += `, #${number}`;
|
|
11
|
-
}
|
|
12
|
-
return display;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const formatTeam = (teams, probables, boxscore, homeAway) => {
|
|
16
|
-
const pitcherId = probables[homeAway].id;
|
|
17
|
-
const pitcher = boxscore[homeAway].players['ID' + pitcherId];
|
|
18
|
-
let lines = [
|
|
19
|
-
teams[homeAway].teamName,
|
|
20
|
-
`(${teams[homeAway].record.wins}-${teams[homeAway].record.losses})`,
|
|
21
|
-
];
|
|
22
|
-
if (pitcher) {
|
|
23
|
-
lines = lines.concat([
|
|
24
|
-
'',
|
|
25
|
-
formatPitcherName(pitcher),
|
|
26
|
-
`${pitcher.seasonStats?.pitching?.wins}-${pitcher.seasonStats?.pitching?.losses}`,
|
|
27
|
-
`${pitcher.seasonStats?.pitching?.era} ERA ${pitcher.seasonStats?.pitching?.strikeOuts} K`,
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
return lines;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function PreviewGame() {
|
|
34
|
-
const boxscore = useSelector(selectBoxscore);
|
|
35
|
-
const probables = useSelector(selectProbablePitchers);
|
|
36
|
-
const startTime = useSelector(selectStartTime);
|
|
37
|
-
const status = useSelector(selectGameStatus);
|
|
38
|
-
const teams = useSelector(selectTeams);
|
|
39
|
-
const venue = useSelector(selectVenue);
|
|
40
|
-
const away = formatTeam(teams, probables, boxscore, 'away');
|
|
41
|
-
const home = formatTeam(teams, probables, boxscore, 'home');
|
|
42
|
-
const formattedStart = status.startTimeTBD ? 'Start time TBD' : format(new Date(startTime), 'MMMM d, yyy p');
|
|
43
|
-
return (
|
|
44
|
-
<element>
|
|
45
|
-
<element height='60%'>
|
|
46
|
-
<box content={away.join('\n')} width='33%-1' top='50%' align='center' />
|
|
47
|
-
<box content={`\nvs.\n\n${formattedStart}\n${venue.name}\n${venue.location.city}, ${venue.location.stateAbbrev}`} width='33%-1' left='33%' top='50%' align='center' />
|
|
48
|
-
<box content={home.join('\n')} width='34%' top='50%' left='66%' align='center' />
|
|
49
|
-
</element>
|
|
50
|
-
</element>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default PreviewGame;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
import { fetchStandings, selectData } from '../features/standings.js';
|
|
5
|
-
import { teamFavoriteStar } from '../utils.js';
|
|
6
|
-
|
|
7
|
-
function formatHeaderRow(record) {
|
|
8
|
-
return record.division.nameShort.padEnd(15) +
|
|
9
|
-
' W' +
|
|
10
|
-
' L' +
|
|
11
|
-
' PCT' +
|
|
12
|
-
' GB' +
|
|
13
|
-
' WCGB' +
|
|
14
|
-
' L10' +
|
|
15
|
-
' STRK';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function formatTeamRow(record) {
|
|
19
|
-
const lastTen = record.records.splitRecords.find(o => o.type === 'lastTen');
|
|
20
|
-
const star = teamFavoriteStar(record.team);
|
|
21
|
-
return star +
|
|
22
|
-
record.team.teamName.padEnd(star ? 13 : 15) +
|
|
23
|
-
record.wins.toString().padStart(5) +
|
|
24
|
-
record.losses.toString().padStart(5) +
|
|
25
|
-
record.winningPercentage.padStart(7) +
|
|
26
|
-
record.gamesBack.padStart(6) +
|
|
27
|
-
record.wildCardGamesBack.padStart(6) +
|
|
28
|
-
`${lastTen.wins}-${lastTen.losses}`.padStart(6) +
|
|
29
|
-
record.streak.streakCode.padStart(5);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function Division({record, top, left, width}) {
|
|
33
|
-
return (
|
|
34
|
-
<box top={top} left={left} height={6} width={width}>
|
|
35
|
-
<box top={0} left={0} height={1} fg='black' bg='white' content={formatHeaderRow(record)} wrap={false} />
|
|
36
|
-
<box top={1} left={0} height={5} content={record.teamRecords.map(formatTeamRow).join('\n')} wrap={false} tags />
|
|
37
|
-
</box>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
Division.propTypes = {
|
|
41
|
-
record: PropTypes.object,
|
|
42
|
-
top: PropTypes.number,
|
|
43
|
-
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
44
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function Standings() {
|
|
48
|
-
const dispatch = useDispatch();
|
|
49
|
-
const standings = useSelector(selectData);
|
|
50
|
-
|
|
51
|
-
useEffect(() => dispatch(fetchStandings()), []);
|
|
52
|
-
|
|
53
|
-
if (!standings) {
|
|
54
|
-
return <element />;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<element>
|
|
59
|
-
{standings.records.filter(record => record.league.id === 103).map((record, idx) => (
|
|
60
|
-
<Division
|
|
61
|
-
top={idx * 7}
|
|
62
|
-
left={0}
|
|
63
|
-
width='50%-1'
|
|
64
|
-
key={record.division.id}
|
|
65
|
-
record={record}
|
|
66
|
-
/>
|
|
67
|
-
))}
|
|
68
|
-
{standings.records.filter(record => record.league.id === 104).map((record, idx) => (
|
|
69
|
-
<Division
|
|
70
|
-
top={idx * 7}
|
|
71
|
-
left='50%+1'
|
|
72
|
-
width='50%-1'
|
|
73
|
-
key={record.division.id}
|
|
74
|
-
record={record}
|
|
75
|
-
/>
|
|
76
|
-
))}
|
|
77
|
-
</element>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default Standings;
|
package/src/features/games.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import reduxjsToolkit from '@reduxjs/toolkit';
|
|
3
|
-
const { createAsyncThunk, createSlice, createSelector } = reduxjsToolkit;
|
|
4
|
-
import jsonpatch from 'json-patch';
|
|
5
|
-
|
|
6
|
-
const initialState = {
|
|
7
|
-
loading: false,
|
|
8
|
-
fullUpdateRequired: false,
|
|
9
|
-
error: null,
|
|
10
|
-
selectedId: null,
|
|
11
|
-
games: {},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const fetchGame = createAsyncThunk(
|
|
15
|
-
'games/fetch',
|
|
16
|
-
async ({id, start}) => {
|
|
17
|
-
const diffParams = start ? `/diffPatch?startTimecode=${start}` : '';
|
|
18
|
-
const url = `https://statsapi.mlb.com/api/v1.1/game/${id}/feed/live${diffParams}`;
|
|
19
|
-
const response = await axios.get(url);
|
|
20
|
-
return response.data;
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export const gamesSlice = createSlice({
|
|
25
|
-
name: 'games',
|
|
26
|
-
initialState,
|
|
27
|
-
reducers: {
|
|
28
|
-
setSelectedId(state, action) {
|
|
29
|
-
state.selectedId = action.payload;
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
extraReducers: (builder) => {
|
|
33
|
-
builder.addCase(fetchGame.pending, (state) => {
|
|
34
|
-
state.loading = true;
|
|
35
|
-
});
|
|
36
|
-
builder.addCase(fetchGame.fulfilled, (state, action) => {
|
|
37
|
-
const id = state.selectedId;
|
|
38
|
-
let game = state.games[id];
|
|
39
|
-
let patchError = false;
|
|
40
|
-
if (Array.isArray(action.payload)) {
|
|
41
|
-
action.payload.forEach(obj => {
|
|
42
|
-
if (patchError) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
jsonpatch.apply(game || {}, obj.diff);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
patchError = true;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
game = action.payload;
|
|
54
|
-
}
|
|
55
|
-
if (patchError) {
|
|
56
|
-
state.fullUpdateRequired = true;
|
|
57
|
-
} else {
|
|
58
|
-
state.fullUpdateRequired = false;
|
|
59
|
-
state.error = null;
|
|
60
|
-
state.games[id] = game;
|
|
61
|
-
}
|
|
62
|
-
state.loading = false;
|
|
63
|
-
});
|
|
64
|
-
builder.addCase(fetchGame.rejected, (state, action) => {
|
|
65
|
-
state.fullUpdateRequired = true;
|
|
66
|
-
state.loading = false;
|
|
67
|
-
state.error = action.error;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export const { setSelectedId } = gamesSlice.actions;
|
|
73
|
-
|
|
74
|
-
const gamesRoot = state => state.games;
|
|
75
|
-
|
|
76
|
-
export const selectLoading = createSelector(
|
|
77
|
-
gamesRoot,
|
|
78
|
-
root => root.loading
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
export const selectError = createSelector(
|
|
82
|
-
gamesRoot,
|
|
83
|
-
root => root.error
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
export const selectFullUpdateRequired = createSelector(
|
|
87
|
-
gamesRoot,
|
|
88
|
-
root => root.fullUpdateRequired
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
export const selectSelectedId = createSelector(
|
|
92
|
-
gamesRoot,
|
|
93
|
-
root => root.selectedId
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
export const selectGame = createSelector(
|
|
97
|
-
[gamesRoot, selectSelectedId],
|
|
98
|
-
(root, id) => root.games[id]
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const selectLiveData = createSelector(
|
|
102
|
-
selectGame,
|
|
103
|
-
game => game.liveData
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const selectPlays = createSelector(
|
|
107
|
-
selectLiveData,
|
|
108
|
-
data => data.plays
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
export const selectCurrentPlay = createSelector(
|
|
112
|
-
selectPlays,
|
|
113
|
-
plays => plays.currentPlay
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
export const selectAllPlays = createSelector(
|
|
117
|
-
selectPlays,
|
|
118
|
-
plays => plays.allPlays
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
export const selectBoxscore = createSelector(
|
|
122
|
-
selectLiveData,
|
|
123
|
-
data => data.boxscore?.teams
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
export const selectLineScore = createSelector(
|
|
127
|
-
selectLiveData,
|
|
128
|
-
data => data.linescore
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
export const selectDecisions = createSelector(
|
|
132
|
-
selectLiveData,
|
|
133
|
-
data => data.decisions
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const selectGameData = createSelector(
|
|
137
|
-
selectGame,
|
|
138
|
-
game => game.gameData
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
export const selectGameStatus = createSelector(
|
|
142
|
-
selectGameData,
|
|
143
|
-
game => game.status
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
export const selectTeams = createSelector(
|
|
147
|
-
selectGameData,
|
|
148
|
-
gameData => gameData.teams
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
export const selectVenue = createSelector(
|
|
152
|
-
selectGameData,
|
|
153
|
-
gameData => gameData.venue
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
export const selectStartTime = createSelector(
|
|
157
|
-
selectGameData,
|
|
158
|
-
gameData => gameData.datetime?.dateTime
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
export const selectProbablePitchers = createSelector(
|
|
162
|
-
selectGameData,
|
|
163
|
-
gameData => gameData.probablePitchers
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
export default gamesSlice.reducer;
|
package/src/features/schedule.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import reduxjsToolkit from '@reduxjs/toolkit';
|
|
3
|
-
const { createAsyncThunk, createSlice, createSelector } = reduxjsToolkit;
|
|
4
|
-
import { format } from 'date-fns';
|
|
5
|
-
|
|
6
|
-
const initialState = {
|
|
7
|
-
loading: false,
|
|
8
|
-
error: null,
|
|
9
|
-
data: null,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const fetchSchedule = createAsyncThunk(
|
|
13
|
-
'schedule/fetch',
|
|
14
|
-
async (date) => {
|
|
15
|
-
const dateStr = format(date, 'MM/dd/yyyy');
|
|
16
|
-
const response = await axios.get(`http://statsapi.mlb.com/api/v1/schedule?sportId=1&hydrate=team,linescore&date=${dateStr}`);
|
|
17
|
-
return response.data;
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const scheduleSlice = createSlice({
|
|
22
|
-
name: 'schedule',
|
|
23
|
-
initialState,
|
|
24
|
-
reducers: { },
|
|
25
|
-
extraReducers: (builder) => {
|
|
26
|
-
builder.addCase(fetchSchedule.pending, (state) => {
|
|
27
|
-
state.loading = true;
|
|
28
|
-
});
|
|
29
|
-
builder.addCase(fetchSchedule.fulfilled, (state, action) => {
|
|
30
|
-
state.loading = false;
|
|
31
|
-
state.data = action.payload;
|
|
32
|
-
state.error = null;
|
|
33
|
-
});
|
|
34
|
-
builder.addCase(fetchSchedule.rejected, (state, action) => {
|
|
35
|
-
state.loading = false;
|
|
36
|
-
state.data = null;
|
|
37
|
-
state.error = action.error;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const scheduleSelector = state => state.schedule;
|
|
43
|
-
|
|
44
|
-
export const selectLoading = createSelector(
|
|
45
|
-
scheduleSelector,
|
|
46
|
-
schedule => schedule.loading
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export const selectError = createSelector(
|
|
50
|
-
scheduleSelector,
|
|
51
|
-
schedule => schedule.error
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export const selectData = createSelector(
|
|
55
|
-
scheduleSelector,
|
|
56
|
-
schedule => schedule.data
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export default scheduleSlice.reducer;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import reduxjsToolkit from '@reduxjs/toolkit';
|
|
3
|
-
const { createAsyncThunk, createSlice, createSelector } = reduxjsToolkit;
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
loading: false,
|
|
7
|
-
error: null,
|
|
8
|
-
data: null,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const SEASON = new Date().getFullYear();
|
|
12
|
-
|
|
13
|
-
export const fetchStandings = createAsyncThunk(
|
|
14
|
-
'standings/fetch',
|
|
15
|
-
async () => {
|
|
16
|
-
const url = `https://statsapi.mlb.com/api/v1/standings?leagueId=103,104&season=${SEASON}&standingsTypes=regularSeason&hydrate=division,team`;
|
|
17
|
-
const response = await axios.get(url);
|
|
18
|
-
return response.data;
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const standingsSlice = createSlice({
|
|
23
|
-
name: 'standings',
|
|
24
|
-
initialState,
|
|
25
|
-
reducers: { },
|
|
26
|
-
extraReducers: (builder) => {
|
|
27
|
-
builder.addCase(fetchStandings.pending, (state) => {
|
|
28
|
-
state.loading = true;
|
|
29
|
-
});
|
|
30
|
-
builder.addCase(fetchStandings.fulfilled, (state, action) => {
|
|
31
|
-
state.loading = false;
|
|
32
|
-
state.data = action.payload;
|
|
33
|
-
state.error = null;
|
|
34
|
-
});
|
|
35
|
-
builder.addCase(fetchStandings.rejected, (state, action) => {
|
|
36
|
-
state.loading = false;
|
|
37
|
-
state.data = null;
|
|
38
|
-
state.error = action.error;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const standingsSelector = state => state.standings;
|
|
44
|
-
|
|
45
|
-
export const selectLoading = createSelector(
|
|
46
|
-
standingsSelector,
|
|
47
|
-
standings => standings.loading
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export const selectError = createSelector(
|
|
51
|
-
standingsSelector,
|
|
52
|
-
standings => standings.error
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
export const selectData = createSelector(
|
|
56
|
-
standingsSelector,
|
|
57
|
-
standings => standings.data
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
export default standingsSlice.reducer;
|
|
61
|
-
|
package/src/logger.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {fileURLToPath} from 'node:url';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import winston from 'winston';
|
|
4
|
-
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
|
|
7
|
-
winston.configure({
|
|
8
|
-
transports: [
|
|
9
|
-
new winston.transports.File({
|
|
10
|
-
filename: path.resolve(__dirname, 'playball.log'),
|
|
11
|
-
format: winston.format.combine(
|
|
12
|
-
winston.format.timestamp(),
|
|
13
|
-
winston.format.printf(info => `[${info.timestamp}] ${info.level}: ${info.message}`)
|
|
14
|
-
)
|
|
15
|
-
})
|
|
16
|
-
]
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export default winston;
|
package/src/main.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Provider } from 'react-redux';
|
|
3
|
-
import raf from 'raf';
|
|
4
|
-
|
|
5
|
-
import screen from './screen.js';
|
|
6
|
-
import store from './store/index.js';
|
|
7
|
-
import log from './logger.js';
|
|
8
|
-
|
|
9
|
-
import App from './components/App.js';
|
|
10
|
-
|
|
11
|
-
export default async function startInterface() {
|
|
12
|
-
raf.polyfill();
|
|
13
|
-
|
|
14
|
-
process.on('uncaughtException', function(error) {
|
|
15
|
-
log.error('UNCAUGHT EXCEPTION\n' + JSON.stringify(error) + '\n' + error.stack);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Must be imported dynamically because the import seems to have
|
|
19
|
-
// side effects that block other CLI commands from exiting
|
|
20
|
-
const reactBlessed = await import('react-blessed');
|
|
21
|
-
reactBlessed.render(
|
|
22
|
-
<Provider store={store}>
|
|
23
|
-
<App />
|
|
24
|
-
</Provider>,
|
|
25
|
-
screen()
|
|
26
|
-
);
|
|
27
|
-
}
|
package/src/store/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import reduxjsToolkit from '@reduxjs/toolkit';
|
|
2
|
-
const { configureStore } = reduxjsToolkit;
|
|
3
|
-
|
|
4
|
-
import schedule from '../features/schedule.js';
|
|
5
|
-
import games from '../features/games.js';
|
|
6
|
-
import keys from '../features/keys.js';
|
|
7
|
-
import standings from '../features/standings.js';
|
|
8
|
-
|
|
9
|
-
export default configureStore({
|
|
10
|
-
reducer: {
|
|
11
|
-
schedule,
|
|
12
|
-
games,
|
|
13
|
-
keys,
|
|
14
|
-
standings,
|
|
15
|
-
},
|
|
16
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
17
|
-
serializableCheck: false
|
|
18
|
-
})
|
|
19
|
-
});
|