HomePage.jsx 839 B

12345678910111213141516171819202122
  1. import React from 'react';
  2. import { dispatch } from '../../../domain/gameStore';
  3. import { hasSavedGameInfo } from '../../../domain/localStorageMethods';
  4. import DelayedButton from '../../util/DelayedButton';
  5. import GameCreationForm from '../../util/GameCreationForm';
  6. import styles from './HomePage.module.css';
  7. const Rejoin = () => (
  8. <div className={styles.rejoinGame}>
  9. <span className={styles.rejoinGameLabel}>Looks like you were in a game before that you didn't finish!</span>
  10. <DelayedButton onEnd={() => dispatch.rejoinGame()} countDownFormatter={(rem) => `Rejoining in ${rem}s...`}>
  11. Rejoin Game?
  12. </DelayedButton>
  13. </div>
  14. );
  15. export default () => (
  16. <div className={styles.homePage}>
  17. <GameCreationForm afterCreate={(gameId) => dispatch.goToLobby(gameId)} />
  18. {hasSavedGameInfo() && <Rejoin />}
  19. </div>
  20. );