Skip to content

Commit 712d2fb

Browse files
committed
Export component, cleanup
1 parent 48012c2 commit 712d2fb

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

src/oceans/ui.jsx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,10 +1113,10 @@ let UnwrappedPredict = class Predict extends React.Component {
11131113
export const Predict = Radium(UnwrappedPredict); // Exported for unit tests.
11141114

11151115
class PondPanel extends React.Component {
1116-
onPondPanelClick(e) {
1116+
onPondPanelClick = e => {
11171117
setState({pondPanelShowing: false});
11181118
e.stopPropagation();
1119-
}
1119+
};
11201120

11211121
render() {
11221122
const state = getState();
@@ -1128,10 +1128,7 @@ class PondPanel extends React.Component {
11281128
return (
11291129
<div>
11301130
{!state.pondClickedFish && (
1131-
<div
1132-
style={styles.pondPanelLeft}
1133-
onClick={e => this.onPondPanelClick(e)}
1134-
>
1131+
<div style={styles.pondPanelLeft} onClick={this.onPondPanelClick}>
11351132
{state.pondExplainGeneralSummary && (
11361133
<div>
11371134
<div style={styles.pondPanelPreText}>
@@ -1242,7 +1239,7 @@ class PondPanel extends React.Component {
12421239
}
12431240
}
12441241

1245-
let Pond = class Pond extends React.Component {
1242+
let UnwrappedPond = class Pond extends React.Component {
12461243
constructor(props) {
12471244
super(props);
12481245
}
@@ -1364,13 +1361,10 @@ let Pond = class Pond extends React.Component {
13641361
}
13651362
};
13661363

1367-
onPondPanelButtonClick(e) {
1364+
onPondPanelButtonClick = e => {
13681365
const state = getState();
13691366

1370-
if (
1371-
state.appMode === AppMode.FishShort ||
1372-
state.appMode === AppMode.FishLong
1373-
) {
1367+
if ([AppMode.FishShort, AppMode.FishLong].includes(state.appMode)) {
13741368
setState({
13751369
pondPanelShowing: !state.pondPanelShowing
13761370
});
@@ -1383,14 +1377,13 @@ let Pond = class Pond extends React.Component {
13831377
}
13841378

13851379
e.stopPropagation();
1386-
}
1380+
};
13871381

13881382
render() {
13891383
const state = getState();
13901384

13911385
const showInfoButton =
1392-
(state.appMode === AppMode.FishShort ||
1393-
state.appMode === AppMode.FishLong) &&
1386+
[AppMode.FishShort, AppMode.FishLong].includes(state.appMode) &&
13941387
state.pondFish.length > 0 &&
13951388
state.recallFish.length > 0;
13961389
const recallIconsStyle = showInfoButton
@@ -1399,14 +1392,14 @@ let Pond = class Pond extends React.Component {
13991392

14001393
return (
14011394
<Body>
1402-
<div onClick={e => this.onPondClick(e)} style={styles.pondSurface} />
1395+
<div onClick={this.onPondClick} style={styles.pondSurface} />
14031396
<div style={recallIconsStyle}>
14041397
<FontAwesomeIcon
14051398
icon={faCheck}
14061399
style={{
14071400
...styles.recallIcon,
14081401
...{borderTopLeftRadius: 8, borderBottomLeftRadius: 8},
1409-
...(!state.showRecallFish ? styles.bgGreen : {})
1402+
...(state.showRecallFish ? {} : styles.bgGreen)
14101403
}}
14111404
onClick={this.toggleRecall}
14121405
/>
@@ -1446,18 +1439,12 @@ let Pond = class Pond extends React.Component {
14461439
>
14471440
New Word
14481441
</Button>
1449-
<Button
1450-
style={styles.finishButton}
1451-
onClick={() => state.onContinue()}
1452-
>
1442+
<Button style={styles.finishButton} onClick={state.onContinue}>
14531443
Finish
14541444
</Button>
14551445
</div>
14561446
) : (
1457-
<Button
1458-
style={styles.continueButton}
1459-
onClick={() => state.onContinue()}
1460-
>
1447+
<Button style={styles.continueButton} onClick={state.onContinue}>
14611448
Continue
14621449
</Button>
14631450
)}
@@ -1479,7 +1466,7 @@ let Pond = class Pond extends React.Component {
14791466
);
14801467
}
14811468
};
1482-
Pond = Radium(Pond);
1469+
export const Pond = Radium(UnwrappedPond); // Exported for unit tests.
14831470

14841471
let Guide = class Guide extends React.Component {
14851472
onShowing() {

0 commit comments

Comments
 (0)