|
@@ -1,30 +1,9 @@
|
|
|
import React, { useState } from "react";
|
|
|
import Loading from "../../util/Loading";
|
|
|
-import Button from "../../util/Button";
|
|
|
import PlayerNameInput from "./PlayerNameInput";
|
|
|
+import NewGameInput from "./NewGame"
|
|
|
import JoinGameInput from "./JoinGameInput";
|
|
|
import { createGame, joinGame } from "../../../domain/GGSHService";
|
|
|
-import ms from "pretty-ms";
|
|
|
-
|
|
|
-const NewGame = ({ onCreateGame, cannotCreateGame, timer, setTimer }) => {
|
|
|
- return (
|
|
|
- <div className="new-game">
|
|
|
- <div className="new-game__dropdown">
|
|
|
- <div className="new-game__dropdown-button">
|
|
|
- Round Timer: {ms(timer * 1000)}
|
|
|
- </div>
|
|
|
- <div className="new-game__dropdown-items">
|
|
|
- <div className="new-game__dropdown-option" onClick={() => setTimer(30)}>30 Seconds</div>
|
|
|
- <div className="new-game__dropdown-option" onClick={() => setTimer(300)}>5 Minutes</div>
|
|
|
- <div className="new-game__dropdown-option" onClick={() => setTimer(3600)}>1 Hour</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <Button className="new-game__btn" onClick={onCreateGame} disabled={cannotCreateGame}>
|
|
|
- Create New Game
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- );
|
|
|
-};
|
|
|
|
|
|
const PreGame = ({ initPlayerName, onGameJoined }) => {
|
|
|
const [loading, setLoading] = useState(false);
|
|
@@ -56,7 +35,7 @@ const PreGame = ({ initPlayerName, onGameJoined }) => {
|
|
|
<div className="pre-game">
|
|
|
<PlayerNameInput {...{ playerName, onChangePlayerName }} />
|
|
|
<hr className="pre-game__divider"/>
|
|
|
- <NewGame {...{ onCreateGame, cannotCreateGame, timer, setTimer }} />
|
|
|
+ <NewGameInput {...{ onCreateGame, cannotCreateGame, timer, setTimer }} />
|
|
|
<hr className="pre-game__divider"/>
|
|
|
<JoinGameInput {...{ gameId, onChangeGameId, onJoinGame, cannotJoinGame }} />
|
|
|
</div>
|