2021-09-23 22:37:47 -04:00
|
|
|
import React from 'react'
|
|
|
|
|
2021-09-24 00:47:45 -04:00
|
|
|
import assertNever from '~/common/assertNever.ts'
|
|
|
|
|
2021-09-23 23:34:33 -04:00
|
|
|
import IntroPage from '../components/IntroPage.tsx'
|
2021-09-24 00:47:45 -04:00
|
|
|
import Page from '../components/Page.tsx'
|
|
|
|
import Game from '../game/Game.tsx'
|
|
|
|
|
|
|
|
type MenuState = 'menu' | 'play'
|
2021-09-23 22:37:47 -04:00
|
|
|
|
|
|
|
export default function AppPage() {
|
2021-09-24 00:47:45 -04:00
|
|
|
const [menuState, setMenuState] = React.useState<MenuState>('menu')
|
|
|
|
|
|
|
|
switch (menuState) {
|
|
|
|
case 'menu': {
|
|
|
|
return (
|
|
|
|
<IntroPage>
|
|
|
|
<button onClick={() => setMenuState('play')}>
|
|
|
|
Play
|
|
|
|
</button>
|
|
|
|
</IntroPage>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
case 'play': {
|
|
|
|
return (
|
|
|
|
<Page>
|
|
|
|
<Game />
|
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
default: return assertNever(menuState)
|
|
|
|
}
|
2021-09-23 22:37:47 -04:00
|
|
|
}
|