mirror of
https://github.com/chase-manning/pokemon-js.git
synced 2025-11-03 01:18:58 +00:00
🐛 start menu weird with no pokemon
This commit is contained in:
parent
1f8036130f
commit
4b883dfc9e
1 changed files with 11 additions and 2 deletions
|
|
@ -13,7 +13,12 @@ import {
|
|||
import useEvent from "../app/use-event";
|
||||
import emitter, { Event } from "../app/emitter";
|
||||
import { useState } from "react";
|
||||
import { save, selectName, updateSpecificPokemon } from "../state/gameSlice";
|
||||
import {
|
||||
save,
|
||||
selectName,
|
||||
selectPokemon,
|
||||
updateSpecificPokemon,
|
||||
} from "../state/gameSlice";
|
||||
import PokemonList from "./PokemonList";
|
||||
import * as serviceWorkerRegistration from "../serviceWorkerRegistration";
|
||||
import { DEBUG_MODE } from "../app/constants";
|
||||
|
|
@ -25,6 +30,7 @@ const StartMenu = () => {
|
|||
const disabled = useSelector(selectStartMenuSubOpen);
|
||||
const name = useSelector(selectName);
|
||||
const saving = !!useSelector(selectConfirmationMenu);
|
||||
const allPokemon = useSelector(selectPokemon);
|
||||
|
||||
const [pokemon, setPokemon] = useState(false);
|
||||
|
||||
|
|
@ -46,7 +52,10 @@ const StartMenu = () => {
|
|||
// },
|
||||
{
|
||||
label: "Pokémon",
|
||||
action: () => setPokemon(true),
|
||||
action: () => {
|
||||
if (allPokemon.length === 0) return;
|
||||
setPokemon(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Item",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue