You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
724 B

4 years ago
import './App.css';
import IntroPage from '../IntroPage/IntroPage';
import GamePage from '../GamePage/GamePage';
import apiStore, { EGameStage } from '../../store/apiStore/apiStore';
type AppProps = {
onEnterGame?: () => void,
};
const App: React.FC<AppProps> = observer((props) => {
let content = <></>;
switch (apiStore.gameStage) {
case EGameStage.Start: {
content = <IntroPage onEnterGame={() => {
apiStore.startNewGame();
} } />;
break;
}
case EGameStage.Process: {
content = <GamePage onExitGame={() => apiStore.setGameStage(EGameStage.Start) } />;
break;
}
}
return (
<div className="App">
{content}
</div>
);
});
export default App;