|
@@ -5,6 +5,7 @@ import Loading from "./Loading";
|
|
import Button from "./Button";
|
|
import Button from "./Button";
|
|
import { createGame } from "../../domain/apiMethods";
|
|
import { createGame } from "../../domain/apiMethods";
|
|
import Dropdown from "./Dropdown";
|
|
import Dropdown from "./Dropdown";
|
|
|
|
+import { MAP_CRUNCH, RANDOM_STREET_VIEW } from "../../domain/genMethods";
|
|
|
|
|
|
const Container = styled.div`
|
|
const Container = styled.div`
|
|
display: flex;
|
|
display: flex;
|
|
@@ -32,6 +33,7 @@ export default ({ afterCreate }) => {
|
|
const [timer, setTimer] = useState(300);
|
|
const [timer, setTimer] = useState(300);
|
|
const [rounds, setRounds] = useState(5);
|
|
const [rounds, setRounds] = useState(5);
|
|
const [onlyAmerica, setOnlyAmerica] = useState(false);
|
|
const [onlyAmerica, setOnlyAmerica] = useState(false);
|
|
|
|
+ const [genMethod, setGenMethod] = useState(MAP_CRUNCH);
|
|
|
|
|
|
if (loading) {
|
|
if (loading) {
|
|
return <Loading/>
|
|
return <Loading/>
|
|
@@ -39,7 +41,7 @@ export default ({ afterCreate }) => {
|
|
|
|
|
|
const onCreateGame = async () => {
|
|
const onCreateGame = async () => {
|
|
setLoading(true);
|
|
setLoading(true);
|
|
- const gameId = await createGame(timer, rounds, onlyAmerica);
|
|
|
|
|
|
+ const gameId = await createGame(timer, rounds, onlyAmerica, genMethod);
|
|
if (afterCreate) {
|
|
if (afterCreate) {
|
|
afterCreate(gameId);
|
|
afterCreate(gameId);
|
|
}
|
|
}
|
|
@@ -79,6 +81,15 @@ export default ({ afterCreate }) => {
|
|
>
|
|
>
|
|
{onlyAmerica ? "Just America" : "All Countries" }
|
|
{onlyAmerica ? "Just America" : "All Countries" }
|
|
</Dropdown>
|
|
</Dropdown>
|
|
|
|
+ <Dropdown
|
|
|
|
+ options={{
|
|
|
|
+ "Map Crunch": MAP_CRUNCH,
|
|
|
|
+ "Random Street View": RANDOM_STREET_VIEW,
|
|
|
|
+ }}
|
|
|
|
+ onChange={setGenMethod}
|
|
|
|
+ >
|
|
|
|
+ Generator: {genMethod === MAP_CRUNCH ? "Map Crunch" : "RSV" }
|
|
|
|
+ </Dropdown>
|
|
</DropdownContainer>
|
|
</DropdownContainer>
|
|
<StartButton onClick={onCreateGame}>
|
|
<StartButton onClick={onCreateGame}>
|
|
Create New Game
|
|
Create New Game
|