playball 3.0.0 → 3.1.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.
Files changed (65) hide show
  1. package/README.md +62 -0
  2. package/bin/playball.js +1 -1
  3. package/dist/cli.js +31 -0
  4. package/dist/components/AllPlays.js +20 -60
  5. package/dist/components/App.js +19 -45
  6. package/dist/components/AtBat.js +8 -33
  7. package/dist/components/Bases.js +10 -25
  8. package/dist/components/Count.js +10 -25
  9. package/dist/components/FinishedGame.js +26 -60
  10. package/dist/components/Game.js +25 -57
  11. package/dist/components/GameList.js +32 -83
  12. package/dist/components/Grid.js +20 -47
  13. package/dist/components/HelpBar.js +6 -20
  14. package/dist/components/InningDisplay.js +6 -20
  15. package/dist/components/LineScore.js +10 -31
  16. package/dist/components/LiveGame.js +22 -41
  17. package/dist/components/LoadingSpinner.js +12 -34
  18. package/dist/components/Matchup.js +11 -29
  19. package/dist/components/PreviewGame.js +18 -40
  20. package/dist/components/Standings.js +23 -45
  21. package/dist/config.js +126 -0
  22. package/dist/features/games.js +32 -67
  23. package/dist/features/keys.js +10 -25
  24. package/dist/features/schedule.js +16 -31
  25. package/dist/features/standings.js +14 -28
  26. package/dist/hooks/useKey.js +8 -20
  27. package/dist/logger.js +9 -20
  28. package/dist/main.js +20 -28
  29. package/dist/package.js +5 -0
  30. package/dist/screen.js +16 -22
  31. package/dist/store/index.js +14 -27
  32. package/dist/style/index.js +2 -9
  33. package/dist/utils.js +8 -0
  34. package/package.json +14 -6
  35. package/.eslintrc.json +0 -33
  36. package/CODE_OF_CONDUCT.md +0 -76
  37. package/demo.cast +0 -95
  38. package/demo.gif +0 -0
  39. package/src/components/AllPlays.jsx +0 -107
  40. package/src/components/App.jsx +0 -43
  41. package/src/components/AtBat.jsx +0 -41
  42. package/src/components/Bases.jsx +0 -22
  43. package/src/components/Count.jsx +0 -24
  44. package/src/components/FinishedGame.jsx +0 -76
  45. package/src/components/Game.jsx +0 -60
  46. package/src/components/GameList.jsx +0 -166
  47. package/src/components/Grid.jsx +0 -91
  48. package/src/components/HelpBar.jsx +0 -19
  49. package/src/components/InningDisplay.jsx +0 -19
  50. package/src/components/LineScore.jsx +0 -52
  51. package/src/components/LiveGame.jsx +0 -47
  52. package/src/components/LoadingSpinner.jsx +0 -49
  53. package/src/components/Matchup.jsx +0 -41
  54. package/src/components/PreviewGame.jsx +0 -54
  55. package/src/components/Standings.jsx +0 -78
  56. package/src/features/games.js +0 -165
  57. package/src/features/keys.js +0 -38
  58. package/src/features/schedule.js +0 -59
  59. package/src/features/standings.js +0 -60
  60. package/src/hooks/useKey.js +0 -13
  61. package/src/logger.js +0 -16
  62. package/src/main.js +0 -23
  63. package/src/screen.js +0 -14
  64. package/src/store/index.js +0 -18
  65. package/src/style/index.js +0 -15
package/README.md CHANGED
@@ -46,6 +46,68 @@ key | action
46
46
  ----|--------
47
47
  <kbd>&darr;</kbd>/<kbd>j</kbd>, <kbd>&uarr;</kbd>/<kbd>k</kbd> | scroll list of all plays
48
48
 
49
+ ### Configuration
50
+
51
+ Playball can be configured using the `config` subcommand. To list the current configuration values run the subcommand with no additional arguments:
52
+
53
+ ```shell
54
+ playball config
55
+ ```
56
+
57
+ You should see output similar to:
58
+
59
+ ```
60
+ color.ball = green
61
+ color.favorite-star = yellow
62
+ color.in-play-no-out = blue
63
+ color.in-play-out = white
64
+ color.in-play-runs-bg = white
65
+ color.in-play-runs-fg = black
66
+ color.on-base = yellow
67
+ color.other-event = white
68
+ color.out = red
69
+ color.strike = red
70
+ color.strike-out = red
71
+ color.walk = green
72
+ favorites =
73
+ ```
74
+
75
+ To get the value of a single setting pass the key as an additional argument:
76
+
77
+ ```shell
78
+ playball config color.strike
79
+ ```
80
+
81
+ To change a setting pass the key and value as arguments:
82
+
83
+ ```shell
84
+ playball config color.strike blue
85
+ ```
86
+
87
+ To revert a setting to its default value provide the key and the `--unset` flag:
88
+
89
+ ```shell
90
+ playball config color.strike --unset
91
+ ```
92
+
93
+ This table summarizes the available settings:
94
+
95
+ key | description | default | allowed values
96
+ ----|-------------|---------|---------------
97
+ `color.ball` | Color of dots representing balls in top row of game view | green | One of the following: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `grey`. Any of those colors may be prefixed by `bright-` or `light-` (for example `bright-green`). The exact color used will depend on your terminal settings. The value `default` may be used to specify the default text color for your terminal. Finally hex colors (e.g `#FFA500`) can be specified. If your terminal does not support true color, the closest supported color may be used.
98
+ `color.favorite-star` | Color of star indiciating favorite team in schedule and standing views | yellow | _See above_
99
+ `color.in-play-no-out` | Color of result where ball was put in play and no out was made (single, double, etc) in list of plays in game view | blue | _See above_
100
+ `color.in-play-out` | Color of result where ball was put in play and an out was made (flyout, fielder's choice, etc) in list of plays in game view | white | _See above_
101
+ `color.in-play-runs-bg` | Background color for score update in list of plays in game view | white | _See above_
102
+ `color.in-play-runs-fg` | Foreground color for score update in list of plays in game view | black | _See above_
103
+ `color.on-base` | Color of diamonds representing runners on base in top row of game view | yellow | _See above_
104
+ `color.other-event` | Color of other events (mound visit, injury delay, etc) in list of plays in game view | white | _See above_
105
+ `color.out` | Color of dots representing outs in top row of game view | red | _See above_
106
+ `color.strike` | Color of dots representing strikes in top row of game view | red | _See above_
107
+ `color.strike-out` | Color of result where play ends on a strike (strike out) in list of plays in game view | red | _See above_
108
+ `color.walk` | Color of result where play ends on a ball (walk, hit by pitch) in list of plays in game view | green | _See above_
109
+ `favorites` | Teams to highlight in schedule and standings views | | Any one of the following: `ATL`, `AZ`, `BAL`, `BOS`, `CHC`, `CIN`, `CLE`, `COL`, `CWS`, `DET`, `HOU`, `KC`, `LAA`, `LAD`, `MIA`, `MIL`, `MIN`, `NYM`, `NYY`, `OAK`, `PHI`, `PIT`, `SD`, `SEA`, `SF`, `STL`, `TB`, `TEX`, `TOR`, `WSH`. Or a comma-separated list of multiple (e.g. `SEA,MIL`)
110
+
49
111
  ### Development
50
112
  ```
51
113
  git clone https://github.com/paaatrick/playball.git
package/bin/playball.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require('..');
2
+ import '../dist/cli.js';
package/dist/cli.js ADDED
@@ -0,0 +1,31 @@
1
+ /* eslint no-console: 0 */
2
+ import { Command } from 'commander';
3
+ import updateNotifier from 'update-notifier';
4
+ import * as config from "./config.js";
5
+ import main from "./main.js";
6
+ import pkg from "./package.js";
7
+ const program = new Command();
8
+ const notifier = updateNotifier({
9
+ pkg,
10
+ updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
11
+ });
12
+
13
+ program.name(pkg.name).description(pkg.description).version(pkg.version).action(main).hook('postAction', () => notifier.notify({
14
+ isGlobal: true
15
+ }));
16
+ program.command('config').description('Set or get configration values').argument('[key]').argument('[value]').option('--unset', 'Unset configuration value').action((key, value, options) => {
17
+ if (options.unset) {
18
+ config.unset(key);
19
+ return;
20
+ }
21
+ if (!key) {
22
+ for (const [key, value] of Object.entries(config.getAll())) {
23
+ console.log(`${key} = ${value}`);
24
+ }
25
+ } else if (!value) {
26
+ console.log(config.get(key));
27
+ } else {
28
+ config.set(key, value);
29
+ }
30
+ });
31
+ program.parse();
@@ -1,133 +1,93 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _alternateRenderers = require("react-redux/lib/alternate-renderers");
11
-
12
- var _games = require("../features/games");
13
-
14
- var _style = _interopRequireDefault(require("../style"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
1
+ import React from 'react';
2
+ import { useSelector } from "react-redux/lib/alternate-renderers.js";
3
+ import { selectAllPlays, selectTeams } from "../features/games.js";
4
+ import { get } from "../config.js";
5
+ import style from "../style/index.js";
18
6
  function getPlayResultColor(play) {
19
7
  var _play$playEvents;
20
-
21
8
  const lastPlay = (_play$playEvents = play.playEvents[play.playEvents.length - 1]) === null || _play$playEvents === void 0 ? void 0 : _play$playEvents.details;
22
-
23
9
  if (!lastPlay) {
24
- return 'white';
10
+ return get('color.other-event');
25
11
  } else if (lastPlay.isBall) {
26
- return 'green';
12
+ return get('color.walk');
27
13
  } else if (lastPlay.isStrike) {
28
- return 'red';
14
+ return get('color.strike-out');
29
15
  } else if (lastPlay.isInPlay && !play.about.hasOut) {
30
- return 'blue';
16
+ return get('color.in-play-no-out');
31
17
  } else {
32
- return 'white';
18
+ return get('color.in-play-out');
33
19
  }
34
20
  }
35
-
36
21
  function formatOut(out) {
37
- return ` {bold}${out} out{/bold}`;
22
+ return ` {bold}${out} out{/}`;
38
23
  }
39
-
40
24
  function AllPlays() {
41
- const plays = (0, _alternateRenderers.useSelector)(_games.selectAllPlays);
42
- const teams = (0, _alternateRenderers.useSelector)(_games.selectTeams);
43
-
44
- const formatScoreDetail = scoreObj => ' {bold}{white-bg}{black-fg} ' + `${teams.away.abbreviation} ${scoreObj.awayScore} - ` + `${teams.home.abbreviation} ${scoreObj.homeScore}` + ' {/black-fg}{/white-bg}{/bold}';
45
-
25
+ const plays = useSelector(selectAllPlays);
26
+ const teams = useSelector(selectTeams);
27
+ const formatScoreDetail = scoreObj => ` {bold}{${get('color.in-play-runs-bg')}-bg}{${get('color.in-play-runs-fg')}-fg} ` + `${teams.away.abbreviation} ${scoreObj.awayScore} - ` + `${teams.home.abbreviation} ${scoreObj.homeScore}` + ' {/}';
46
28
  let inning = '';
47
29
  const lines = [];
48
30
  plays && plays.slice().reverse().forEach((play, playIdx, plays) => {
49
31
  let lastPlay;
50
-
51
32
  if (playIdx < plays.length - 1) {
52
33
  lastPlay = plays[playIdx + 1];
53
34
  }
54
-
55
35
  const playInning = play.about.halfInning + ' ' + play.about.inning;
56
-
57
36
  if (playInning !== inning) {
58
37
  inning = playInning;
59
-
60
38
  if (lines.length > 0) {
61
39
  lines.push('');
62
40
  }
63
-
64
- lines.push(`{bold}[${inning.toUpperCase()}]{/bold}`);
41
+ lines.push(`{bold}[${inning.toUpperCase()}]{/}`);
65
42
  }
66
-
67
43
  if (play.about.isComplete) {
68
44
  const color = getPlayResultColor(play);
69
- let line = `{${color}-fg}[${play.result.event}]{/${color}-fg} ${play.result.description}`;
70
-
45
+ let line = `{${color}-fg}[${play.result.event}]{/} ${play.result.description}`;
71
46
  if (play.about.hasOut) {
72
47
  const lastOut = play.playEvents[play.playEvents.length - 1].count.outs;
73
-
74
48
  if (lastOut !== play.count.outs) {
75
49
  line += formatOut(play.count.outs);
76
50
  }
77
51
  }
78
-
79
52
  if (play.about.isScoringPlay) {
80
53
  line += formatScoreDetail(play.result);
81
54
  }
82
-
83
55
  lines.push(line);
84
56
  }
85
-
86
57
  play.playEvents && play.playEvents.slice().reverse().forEach((event, eventIdx, events) => {
87
58
  if (event.type === 'action') {
88
59
  var _event$count;
89
-
90
60
  let line = '';
91
-
92
61
  if (event.details.event) {
93
- line += `[${event.details.event}] `;
62
+ line += `{${get('color.other-event')}-fg}[${event.details.event}]{/} `;
94
63
  }
95
-
96
64
  line += event.details.description;
97
-
98
65
  if (event.isScoringPlay || event.details.isScoringPlay) {
99
66
  line += formatScoreDetail(event.details);
100
67
  }
101
-
102
68
  const currentOut = (_event$count = event.count) === null || _event$count === void 0 ? void 0 : _event$count.outs;
103
69
  let prevOut = lastPlay ? lastPlay.count.outs : 0;
104
-
105
70
  if (eventIdx < events.length - 1) {
106
71
  var _events$count;
107
-
108
72
  prevOut = (_events$count = events[eventIdx + 1].count) === null || _events$count === void 0 ? void 0 : _events$count.outs;
109
73
  }
110
-
111
74
  if (currentOut > prevOut) {
112
75
  line += formatOut(currentOut);
113
76
  }
114
-
115
77
  lines.push(line);
116
78
  }
117
79
  });
118
80
  });
119
- return /*#__PURE__*/_react.default.createElement("box", {
81
+ return /*#__PURE__*/React.createElement("box", {
120
82
  content: lines.join('\n'),
121
83
  focused: true,
122
84
  mouse: true,
123
85
  keys: true,
124
86
  vi: true,
125
87
  scrollable: true,
126
- scrollbar: _style.default.scrollbar,
88
+ scrollbar: style.scrollbar,
127
89
  alwaysScroll: true,
128
90
  tags: true
129
91
  });
130
92
  }
131
-
132
- var _default = AllPlays;
133
- exports.default = _default;
93
+ export default AllPlays;
@@ -1,68 +1,42 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _alternateRenderers = require("react-redux/lib/alternate-renderers");
11
-
12
- var _GameList = _interopRequireDefault(require("./GameList"));
13
-
14
- var _HelpBar = _interopRequireDefault(require("./HelpBar"));
15
-
16
- var _games = require("../features/games");
17
-
18
- var _Game = _interopRequireDefault(require("./Game"));
19
-
20
- var _useKey = _interopRequireDefault(require("../hooks/useKey"));
21
-
22
- var _Standings = _interopRequireDefault(require("./Standings"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
1
+ import React, { useState } from 'react';
2
+ import { useDispatch } from "react-redux/lib/alternate-renderers.js";
3
+ import GameList from "./GameList.js";
4
+ import HelpBar from "./HelpBar.js";
5
+ import { setSelectedId } from "../features/games.js";
6
+ import Game from "./Game.js";
7
+ import useKey from "../hooks/useKey.js";
8
+ import Standings from "./Standings.js";
30
9
  const SCHEDULE = 'schedule';
31
10
  const STANDINGS = 'standings';
32
11
  const GAME = 'game';
33
-
34
12
  function App() {
35
- const [view, setView] = (0, _react.useState)(SCHEDULE);
36
- const dispatch = (0, _alternateRenderers.useDispatch)();
37
- (0, _useKey.default)('c', () => {
13
+ const [view, setView] = useState(SCHEDULE);
14
+ const dispatch = useDispatch();
15
+ useKey('c', () => {
38
16
  setView(SCHEDULE);
39
- dispatch((0, _games.setSelectedId)(null));
17
+ dispatch(setSelectedId(null));
40
18
  }, {
41
19
  key: 'C',
42
20
  label: 'Schedule'
43
21
  });
44
- (0, _useKey.default)('s', () => setView(STANDINGS), {
22
+ useKey('s', () => setView(STANDINGS), {
45
23
  key: 'S',
46
24
  label: 'Standings'
47
25
  });
48
-
49
26
  const handleGameSelect = game => {
50
- dispatch((0, _games.setSelectedId)(game.gamePk));
27
+ dispatch(setSelectedId(game.gamePk));
51
28
  setView(GAME);
52
29
  };
53
-
54
- return /*#__PURE__*/_react.default.createElement("element", null, /*#__PURE__*/_react.default.createElement("element", {
30
+ return /*#__PURE__*/React.createElement("element", null, /*#__PURE__*/React.createElement("element", {
55
31
  top: 0,
56
32
  left: 0,
57
33
  height: "100%-1"
58
- }, view === STANDINGS && /*#__PURE__*/_react.default.createElement(_Standings.default, null), view === SCHEDULE && /*#__PURE__*/_react.default.createElement(_GameList.default, {
34
+ }, view === STANDINGS && /*#__PURE__*/React.createElement(Standings, null), view === SCHEDULE && /*#__PURE__*/React.createElement(GameList, {
59
35
  onGameSelect: handleGameSelect
60
- }), view === GAME && /*#__PURE__*/_react.default.createElement(_Game.default, null)), /*#__PURE__*/_react.default.createElement("element", {
36
+ }), view === GAME && /*#__PURE__*/React.createElement(Game, null)), /*#__PURE__*/React.createElement("element", {
61
37
  top: "100%-1",
62
38
  left: 0,
63
39
  height: 1
64
- }, /*#__PURE__*/_react.default.createElement(_HelpBar.default, null)));
40
+ }, /*#__PURE__*/React.createElement(HelpBar, null)));
65
41
  }
66
-
67
- var _default = App;
68
- exports.default = _default;
42
+ export default App;
@@ -1,67 +1,42 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _alternateRenderers = require("react-redux/lib/alternate-renderers");
11
-
12
- var _games = require("../features/games");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
1
+ import React from 'react';
2
+ import { useSelector } from "react-redux/lib/alternate-renderers.js";
3
+ import { selectCurrentPlay } from "../features/games.js";
16
4
  function AtBat() {
17
- const currentPlay = (0, _alternateRenderers.useSelector)(_games.selectCurrentPlay);
5
+ const currentPlay = useSelector(selectCurrentPlay);
18
6
  const playEvents = currentPlay.playEvents;
19
7
  const playResult = currentPlay.about.isComplete ? currentPlay.result.description : '';
20
8
  let content = '';
21
-
22
9
  if (playResult) {
23
10
  content += `${playResult}\n\n`;
24
11
  }
25
-
26
12
  if (playEvents && playEvents.length) {
27
13
  content += playEvents.slice().reverse().map(event => {
28
14
  let line = '';
29
-
30
15
  if (event.isPitch) {
31
- var _event$pitchData, _event$details, _event$details$type, _event$details2;
32
-
16
+ var _event$pitchData, _event$details, _event$details2;
33
17
  line = `[${event.details.description}] `;
34
-
35
18
  if ((_event$pitchData = event.pitchData) !== null && _event$pitchData !== void 0 && _event$pitchData.startSpeed) {
36
19
  line += `${event.pitchData.startSpeed} MPH `;
37
20
  }
38
-
39
- if ((_event$details = event.details) !== null && _event$details !== void 0 && (_event$details$type = _event$details.type) !== null && _event$details$type !== void 0 && _event$details$type.description) {
21
+ if ((_event$details = event.details) !== null && _event$details !== void 0 && (_event$details = _event$details.type) !== null && _event$details !== void 0 && _event$details.description) {
40
22
  line += event.details.type.description;
41
23
  }
42
-
43
24
  if (!((_event$details2 = event.details) !== null && _event$details2 !== void 0 && _event$details2.isInPlay)) {
44
25
  line += `{|} ${event.count.balls}-${event.count.strikes}`;
45
26
  }
46
27
  } else {
47
28
  var _event$details3;
48
-
49
29
  if ((_event$details3 = event.details) !== null && _event$details3 !== void 0 && _event$details3.event) {
50
30
  line += `[${event.details.event}] `;
51
31
  }
52
-
53
32
  line += event.details.description;
54
33
  }
55
-
56
34
  return line;
57
35
  }).join('\n');
58
36
  }
59
-
60
- return /*#__PURE__*/_react.default.createElement("box", {
37
+ return /*#__PURE__*/React.createElement("box", {
61
38
  content: content,
62
39
  tags: true
63
40
  });
64
41
  }
65
-
66
- var _default = AtBat;
67
- exports.default = _default;
42
+ export default AtBat;
@@ -1,38 +1,23 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _alternateRenderers = require("react-redux/lib/alternate-renderers");
11
-
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _games = require("../features/games");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const formatBase = (offense, base) => base in offense ? '{yellow-fg}◆{/yellow-fg}' : '◇';
19
-
1
+ import React from 'react';
2
+ import { useSelector } from "react-redux/lib/alternate-renderers.js";
3
+ import PropTypes from 'prop-types';
4
+ import { get } from "../config.js";
5
+ import { selectLineScore } from "../features/games.js";
6
+ const formatBase = (offense, base) => base in offense ? `{${get('color.on-base')}-fg}◆{/}` : '◇';
20
7
  function Bases({
21
8
  align
22
9
  }) {
23
10
  const {
24
11
  offense
25
- } = (0, _alternateRenderers.useSelector)(_games.selectLineScore);
12
+ } = useSelector(selectLineScore);
26
13
  const content = ` ${formatBase(offense, 'second')}\n` + `${formatBase(offense, 'third')} ${formatBase(offense, 'first')}`;
27
- return /*#__PURE__*/_react.default.createElement("box", {
14
+ return /*#__PURE__*/React.createElement("box", {
28
15
  align: align,
29
16
  content: content,
30
17
  tags: true
31
18
  });
32
19
  }
33
-
34
20
  Bases.propTypes = {
35
- align: _propTypes.default.oneOf(['left', 'center', 'right'])
21
+ align: PropTypes.oneOf(['left', 'center', 'right'])
36
22
  };
37
- var _default = Bases;
38
- exports.default = _default;
23
+ export default Bases;
@@ -1,36 +1,21 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _alternateRenderers = require("react-redux/lib/alternate-renderers");
11
-
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _games = require("../features/games");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
1
+ import React from 'react';
2
+ import { useSelector } from "react-redux/lib/alternate-renderers.js";
3
+ import PropTypes from 'prop-types';
4
+ import { get } from "../config.js";
5
+ import { selectLineScore } from "../features/games.js";
18
6
  const formatCount = (count, total) => '● '.repeat(count) + '○ '.repeat(total - count);
19
-
20
7
  function Count({
21
8
  align
22
9
  }) {
23
- const linescore = (0, _alternateRenderers.useSelector)(_games.selectLineScore);
24
- const content = `B: {green-fg}${formatCount(linescore.balls, 4)}{/green-fg}\n` + `S: {red-fg}${formatCount(linescore.strikes, 3)}{/red-fg}\n` + `O: {red-fg}${formatCount(linescore.outs, 3)}{/red-fg}`;
25
- return /*#__PURE__*/_react.default.createElement("box", {
10
+ const linescore = useSelector(selectLineScore);
11
+ const content = `B: {${get('color.ball')}-fg}${formatCount(linescore.balls, 4)}{/}\n` + `S: {${get('color.strike')}-fg}${formatCount(linescore.strikes, 3)}{/}\n` + `O: {${get('color.out')}-fg}${formatCount(linescore.outs, 3)}{/}`;
12
+ return /*#__PURE__*/React.createElement("box", {
26
13
  align: align,
27
14
  content: content,
28
15
  tags: true
29
16
  });
30
17
  }
31
-
32
18
  Count.propTypes = {
33
- align: _propTypes.default.oneOf(['left', 'center', 'right'])
19
+ align: PropTypes.oneOf(['left', 'center', 'right'])
34
20
  };
35
- var _default = Count;
36
- exports.default = _default;
21
+ export default Count;