Skip to content

Commit

Permalink
Fixing "main menu" buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Aug 7, 2019
1 parent 9a5a4c5 commit 3c7b11c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/main/services/preact-canvas/components/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface Props {
useMotion: boolean;
bestTime?: number;
useVibration: boolean;
onBack: () => void;
}

interface State {
Expand Down Expand Up @@ -97,7 +98,8 @@ export default class Game extends Component<Props, State> {
gameChangeUnsubscribe,
toRevealTotal,
useMotion,
bestTime: previousBestTime
bestTime: previousBestTime,
onBack
}: Props,
{ playMode, toReveal, animator, renderer, completeTime, bestTime }: State
) {
Expand All @@ -116,7 +118,7 @@ export default class Game extends Component<Props, State> {
/>
{playMode === PlayMode.Won ? (
<Win
onMainMenu={this.onReset}
onMainMenu={onBack}
onRestart={this.onRestart}
time={completeTime}
bestTime={bestTime}
Expand Down Expand Up @@ -153,7 +155,7 @@ export default class Game extends Component<Props, State> {
)}{" "}
{strTryAgain}
</button>
<button class={mainButton} onClick={this.onReset}>
<button class={mainButton} onClick={onBack}>
{isFeaturePhone ? <span class={shortcutKey}>*</span> : ""}{" "}
{strMainMenu}
</button>
Expand Down Expand Up @@ -236,15 +238,10 @@ export default class Game extends Component<Props, State> {
this.onRestart();
}
} else if (event.key === "*") {
this.onReset();
this.props.onBack();
}
}

@bind
private onReset() {
this.props.stateService.reset();
}

@bind
private onRestart() {
this.props.stateService.restart();
Expand Down
1 change: 1 addition & 0 deletions src/main/services/preact-canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export default class Root extends Component<Props, State> {
useMotion={motionPreference}
bestTime={bestTime}
useVibration={vibrationPreference}
onBack={this._onBackClick}
/>
)}
/>
Expand Down

0 comments on commit 3c7b11c

Please sign in to comment.