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'
|
2021-09-24 06:51:17 -04:00
|
|
|
import GameClient from '../game/GameClient.tsx'
|
2021-09-24 00:47:45 -04:00
|
|
|
|
|
|
|
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>
|
2021-09-24 06:51:17 -04:00
|
|
|
<button className="menu-button" onClick={() => setMenuState('play')}>
|
2021-09-24 00:47:45 -04:00
|
|
|
Play
|
|
|
|
</button>
|
|
|
|
</IntroPage>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
case 'play': {
|
|
|
|
return (
|
|
|
|
<Page>
|
2021-09-24 06:51:17 -04:00
|
|
|
<GameClient />
|
2021-09-24 00:47:45 -04:00
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
default: return assertNever(menuState)
|
|
|
|
}
|
2021-09-23 22:37:47 -04:00
|
|
|
}
|