From c9aa942a61803713aa12bc6d3b998ad2ab9566ca Mon Sep 17 00:00:00 2001 From: Oskar Rough Date: Tue, 23 Jan 2024 10:17:15 +0100 Subject: [PATCH] Fix continue button on splash screen Was missing the right scope. --- src/ui/components/slay-the-web.js | 18 ++++++++++++------ src/ui/components/splash-screen.js | 4 ++-- src/ui/styles/app.css | 9 --------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ui/components/slay-the-web.js b/src/ui/components/slay-the-web.js index 1731da0f..7de25035 100644 --- a/src/ui/components/slay-the-web.js +++ b/src/ui/components/slay-the-web.js @@ -23,8 +23,9 @@ export default class SlayTheWeb extends Component { const initialGameMode = urlParams.has('debug') ? GameModes.gameplay : GameModes.splash this.state = {gameMode: initialGameMode} - this.handleWin = this.handleWin.bind(this) this.handleNewGame = this.handleNewGame.bind(this) + this.handleContinue = this.handleContinue.bind(this) + this.handleWin = this.handleWin.bind(this) this.handleLoose = this.handleLoose.bind(this) } @@ -47,12 +48,17 @@ export default class SlayTheWeb extends Component { this.setState({gameMode: GameModes.splash}) } - render(props, {gameMode}) { - if (gameMode === GameModes.splash) + render() { + const {gameMode} = this.state + if (gameMode === GameModes.splash) { return html`<${SplashScreen} onNewGame=${this.handleNewGame} onContinue=${this.handleContinue} />` - if (gameMode === GameModes.gameplay) - return html` <${GameScreen} onWin=${this.handleWin} onLoose=${this.handleLoose} /> ` - if (gameMode === GameModes.win) return html` <${WinScreen} onNewGame=${this.handleNewGame} /> ` + } + if (gameMode === GameModes.gameplay) { + return html`<${GameScreen} onWin=${this.handleWin} onLoose=${this.handleLoose} /> ` + } + if (gameMode === GameModes.win) { + return html`<${WinScreen} onNewGame=${this.handleNewGame} /> ` + } } } diff --git a/src/ui/components/splash-screen.js b/src/ui/components/splash-screen.js index 133eb2ed..8d141a23 100644 --- a/src/ui/components/splash-screen.js +++ b/src/ui/components/splash-screen.js @@ -18,8 +18,8 @@ export default class SplashScreen extends Component {