Skip to content

Project-Calvin#8

Open
Cnkh6069 wants to merge 5 commits intorocketacademy:mainfrom
Cnkh6069:main
Open

Project-Calvin#8
Cnkh6069 wants to merge 5 commits intorocketacademy:mainfrom
Cnkh6069:main

Conversation

@Cnkh6069
Copy link

@Cnkh6069 Cnkh6069 commented Nov 9, 2024

Work in progress, trying to get the images to sync and the additional features.


The page will reload when you make changes.
You may also see any lint errors in the console.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE readme

- add the ability to create, read, update, delete a score. Betting mechanism.
- implment admin mode for the deletion and manual updating of score. Change state/UI.
- 2 ways to do: have a main where menu where the student choose to be a player or admin. Have a button for admin login for hard coded login.
What we recommend to achieve the API request, is use jsonbin.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing we can add is how to install and how to run the app!

import Button from "react-bootstrap/Button";

function App() {
//generating a random pokemon name from the json file.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is a bit redundant. It is not directly over the function that's being called. And the function name also tells me what is happening

const [score, setScore] = useState(0);
const [hpLeft, setHpLeft] = useState(6);

//7. When the round ends, give the user an option to play again or restart the game.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first thing I read, but labeled with 7. - confusing! Also, then name handleRestart captures this information already


//7. When the round ends, give the user an option to play again or restart the game.
const handleRestart = () => {
setCurrentPokemon(getRandomPokemon()); // Reset with new Pokemon

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setCurrentPokemon(getRandomPokemon()); // Reset with new Pokemon
setCurrentPokemon(getRandomPokemon());

useEffect(() => {
const scramble = () => {
const letters = currPokemon.split("");
const shuffledLetters = letters.sort(() => 0.5 - Math.random());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where I would want to see a comment, as the math here does not mean anything to me reading the code

@@ -0,0 +1,38 @@
import { useState } from "react";
import Button from "react-bootstrap/Button";
//When the user makes a guess, add that guess to the App component's guessedPokemon state.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant comment

setCurrGuess(text);
};
return (
//input field for player to input guesses

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//input field for player to input guesses

pokeType: "Normal/Flying",
pokeImage:
"https://www.pokemon.com/static-assets/content-assets/cms2/img/pokedex/detail/021.png",
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice data structure


export const getRandomPokemon = () => {
const randomPokedex = pokedex[randomIndex].pokeName.toLowerCase();
//Lowercase words for simplicity

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//Lowercase words for simplicity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants