|
@@ -36,15 +36,6 @@ const DEFAULTS = {
|
|
|
};
|
|
|
|
|
|
const PRESETS = {
|
|
|
- URBAN_AMERICA: {
|
|
|
- ...DEFAULTS,
|
|
|
- generationMethod: URBAN,
|
|
|
- countryLock: "us",
|
|
|
- },
|
|
|
- URBAN_GLOBAL: {
|
|
|
- ...DEFAULTS,
|
|
|
- generationMethod: URBAN,
|
|
|
- },
|
|
|
FAST_FROZEN: {
|
|
|
...DEFAULTS,
|
|
|
timer: 30,
|
|
@@ -52,18 +43,9 @@ const PRESETS = {
|
|
|
generationMethod: RANDOM_STREET_VIEW,
|
|
|
gameMode: FROZEN,
|
|
|
},
|
|
|
- COUNTRY_RACE: {
|
|
|
- ...DEFAULTS,
|
|
|
- scoreMethod: COUNTRY_RACE,
|
|
|
- },
|
|
|
- FROZEN_COUNTRY_RACE: {
|
|
|
- ...DEFAULTS,
|
|
|
- timer: 30,
|
|
|
- gameMode: FROZEN,
|
|
|
- scoreMethod: COUNTRY_RACE,
|
|
|
- },
|
|
|
BOOTLEG_GG_DUEL: {
|
|
|
...DEFAULTS,
|
|
|
+ timer: 120,
|
|
|
clockMode: RACE,
|
|
|
scoreMethod: RAMP,
|
|
|
},
|
|
@@ -112,17 +94,19 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
|
|
|
const countryLookup = useCountryLookup(generationMethod);
|
|
|
|
|
|
const [presetOpen, setPresetOpen] = useState(false);
|
|
|
+ const [selectedPreset, setSelectedPreset] = useState(DEFAULTS);
|
|
|
const setPreset = useCallback(
|
|
|
- ({
|
|
|
- timer: newTimer,
|
|
|
- rounds: newRounds,
|
|
|
- countryLock: newCountryLock,
|
|
|
- generationMethod: newGenMethod,
|
|
|
- gameMode: newGameMode,
|
|
|
- clockMode: newClockMode,
|
|
|
- scoreMethod: newScoreMethod,
|
|
|
- roundPointCap: newRoundPointCap,
|
|
|
- }) => {
|
|
|
+ preset => {
|
|
|
+ const {
|
|
|
+ timer: newTimer,
|
|
|
+ rounds: newRounds,
|
|
|
+ countryLock: newCountryLock,
|
|
|
+ generationMethod: newGenMethod,
|
|
|
+ gameMode: newGameMode,
|
|
|
+ clockMode: newClockMode,
|
|
|
+ scoreMethod: newScoreMethod,
|
|
|
+ roundPointCap: newRoundPointCap,
|
|
|
+ } = preset;
|
|
|
setTimer(newTimer);
|
|
|
setRounds(newRounds);
|
|
|
setCountryLock(newCountryLock);
|
|
@@ -131,6 +115,7 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
|
|
|
setClockMode(newClockMode);
|
|
|
setScoreMethod(newScoreMethod);
|
|
|
setRoundPointCap(newRoundPointCap);
|
|
|
+ setSelectedPreset(preset);
|
|
|
},
|
|
|
[]
|
|
|
);
|
|
@@ -172,7 +157,7 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
|
|
|
<div className={styles.buttoncontainer}>
|
|
|
<Dropdown
|
|
|
buttonClass={styles.favbutton}
|
|
|
- selected={DEFAULTS}
|
|
|
+ selected={selectedPreset}
|
|
|
onClick={() => setPresetOpen(o => !o)}
|
|
|
onSelect={v => {
|
|
|
setPresetOpen(false);
|
|
@@ -183,25 +168,13 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
|
|
|
<Item value={DEFAULTS} display="⭐">
|
|
|
Default
|
|
|
</Item>
|
|
|
- <Item value={PRESETS.URBAN_AMERICA} display="⭐">
|
|
|
- Urban America
|
|
|
- </Item>
|
|
|
- <Item value={PRESETS.URBAN_GLOBAL} display="⭐">
|
|
|
- Urban Global
|
|
|
- </Item>
|
|
|
- <Item value={PRESETS.FAST_FROZEN} display="⭐">
|
|
|
+ <Item value={PRESETS.FAST_FROZEN} display="🧊">
|
|
|
Fast Frozen
|
|
|
</Item>
|
|
|
- <Item value={PRESETS.COUNTRY_RACE} display="⭐">
|
|
|
- Country Race
|
|
|
- </Item>
|
|
|
- <Item value={PRESETS.FROZEN_COUNTRY_RACE} display="⭐">
|
|
|
- Frozen Country Race
|
|
|
- </Item>
|
|
|
- <Item value={PRESETS.BOOTLEG_GG_DUEL} display="⭐">
|
|
|
- Legally Distinct from Geoguessr Duels
|
|
|
+ <Item value={PRESETS.BOOTLEG_GG_DUEL} display="⚔️">
|
|
|
+ Duel
|
|
|
</Item>
|
|
|
- <Item value={PRESETS.GUN_GAME} display="⭐">
|
|
|
+ <Item value={PRESETS.GUN_GAME} display="🔫">
|
|
|
Gun Game
|
|
|
</Item>
|
|
|
</Dropdown>
|
|
@@ -280,8 +253,8 @@ const GameCreationForm = ({ afterCreate, lastSettings = null }) => {
|
|
|
<Item value={TIME_BANK} display="🏦">
|
|
|
Time Bank
|
|
|
</Item>
|
|
|
- <Item value={RACE} display="⚔️">
|
|
|
- Duel
|
|
|
+ <Item value={RACE} display="🏎️">
|
|
|
+ Race
|
|
|
</Item>
|
|
|
</Dropdown>
|
|
|
<Dropdown
|