Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app content #2

Merged
merged 12 commits into from
Jun 2, 2020
Merged

Add app content #2

merged 12 commits into from
Jun 2, 2020

Conversation

anna-sunberg
Copy link
Contributor

A simple Pokedex app with two levels of navigation. I've attempted to use the same libs, lint rules etc. as in previous modules to not create extra confusion.

We could add a search filed to the list page if we want more stuff.

There's jest and eslint, and a few tests. We can break some of those later.

@anna-sunberg anna-sunberg requested a review from RikuLa May 27, 2020 12:52
Copy link

@RikuLa RikuLa left a comment

Choose a reason for hiding this comment

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

Really nice app! This was one of my most fun reviews in a long while :D We might want to do some style changes later on ( center the card and loading spinner etc ). I really like the card design in the individual pokemon page!

@@ -6,6 +6,7 @@
"scripts": {
"start": "webpack-dev-server --open --mode development",
"test": "jest",
"eslint": "eslint './**/*.{js,jsx}'",
Copy link

Choose a reason for hiding this comment

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

(nit) the command could be lint rather

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this from the example in some previous module to keep things as familiar as possible for the students.

Copy link

Choose a reason for hiding this comment

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

Allright! 👍

<html lang="en">
<head>
<meta charset="utf-8">
<title>Pokemons</title>
Copy link

Choose a reason for hiding this comment

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

The plural of pokemon is just pokemon ;D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should've known better! 😱

src/Loader.jsx Outdated
@@ -0,0 +1,7 @@
import React from 'react'

const Loader = () => (
Copy link

Choose a reason for hiding this comment

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

Maybe call this LoadingSpinner? Loader sounds like something that loads something

<div className="pokemon-ability">
<div className="pokemon-ability-type">Ability</div>
<div className="pokemon-ability-name">
{normalAbility.ability.name.replace('-', ' ')}
Copy link

Choose a reason for hiding this comment

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

We could extract the dash removing to a helper function, we now do it in three different places. Maybe something like formatAbilityName(nameWithDash: string): string that would do just that

Comment on lines 61 to 66
<div className="pokemon-ability">
<div className="pokemon-ability-type">Hidden ability</div>
<div className="pokemon-ability-name">
{hiddenAbility.ability.name.replace('-', ' ')}
</div>
</div>
Copy link

Choose a reason for hiding this comment

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

This is a duplicate of the normalAbility We can extract these to its own component that takes the title and the abilityName as props

Comment on lines +143 to +153
.pokemon-type-bug {
--pokemon-type-color: #ac2;
}

.pokemon-type-dark {
--pokemon-type-color: #754;
}

.pokemon-type-dragon {
--pokemon-type-color: #73f;
}
Copy link

Choose a reason for hiding this comment

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

Did you do these by hand? All the colors? :O

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😊

const [error, setError] = useState()
useEffect(() => {
setIsLoading(true)
axios
Copy link

Choose a reason for hiding this comment

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

Just curious, why use a library when we could do this with window.fetch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were using axios in the React module so I decided to stick with it.

Copy link

Choose a reason for hiding this comment

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

Yes, that is then good enough for us as well!

await act(async () => {
render(<App />)
})
expect(axiosMock.get).toHaveBeenCalledTimes(1)
Copy link

Choose a reason for hiding this comment

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

We could check the params of what get was called with

})

it('shows error', async () => {
axiosMock.get.mockResolvedValueOnce(Promise.reject(new Error()))
Copy link

Choose a reason for hiding this comment

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

you can also do .mockRejectedValueOnce!

Comment on lines 25 to 26
const previous = pokemons.find(({ id }) => id === pokemon.id - 1)
const next = pokemons.find(({ id }) => id === pokemon.id + 1)
Copy link

Choose a reason for hiding this comment

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

I feel like these should come in as props. A page for a single Pokemon should really not consume ALL the pokemon.

@anna-sunberg
Copy link
Contributor Author

Really nice app! This was one of my most fun reviews in a long while :D We might want to do some style changes later on ( center the card and loading spinner etc ). I really like the card design in the individual pokemon page!

Glad you like it! I made the card based on some design on the Internet.

I cleaned up the code based on your comments 👍

<PokemonPage pokemons={pokemons} />
<PokemonPage pokemonList={pokemons} />
Copy link

Choose a reason for hiding this comment

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

The value of the prop is still pokemons 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not anymore 🙃

Copy link

@RikuLa RikuLa left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@anna-sunberg anna-sunberg merged commit 545da55 into master Jun 2, 2020
@anna-sunberg anna-sunberg deleted the add-app-content branch June 2, 2020 08:04
the-TM added a commit to the-TM/full-stack-open-pokedex that referenced this pull request Jun 9, 2021
Fix bad formating caused by env
Yipee-ki-yay referenced this pull request in Yipee-ki-yay/full-stack-open-pokedex Jul 20, 2021
ptuukkan referenced this pull request in ptuukkan/full-stack-open-pokedex Aug 27, 2021
ptuukkan referenced this pull request in ptuukkan/full-stack-open-pokedex Aug 27, 2021
ptuukkan referenced this pull request in ptuukkan/full-stack-open-pokedex Aug 28, 2021
jassenousiainen added a commit to jassenousiainen/full-stack-open-pokedex that referenced this pull request Oct 6, 2021
cherylli added a commit to cherylli/full-stack-open-pokedex that referenced this pull request Dec 28, 2021
cherylli added a commit to cherylli/full-stack-open-pokedex that referenced this pull request Dec 29, 2021
cherylli added a commit to cherylli/full-stack-open-pokedex that referenced this pull request Dec 29, 2021
iMMoCodes added a commit to iMMoCodes/full-stack-open-pokedex that referenced this pull request Mar 13, 2022
iMMoCodes added a commit to iMMoCodes/full-stack-open-pokedex that referenced this pull request Mar 13, 2022
tuomasrantataro added a commit to tuomasrantataro/full-stack-open-pokedex that referenced this pull request Aug 27, 2022
baxterjimuk referenced this pull request in baxterjimuk/full-stack-open-pokedex Nov 16, 2022
jslindgit pushed a commit to jslindgit/full-stack-open-pokedex that referenced this pull request May 25, 2023
ronaldidro referenced this pull request in ronaldidro/fullstackopen-cicd Aug 6, 2023
Sophies-Creative-hub referenced this pull request in Sophies-Creative-hub/full-stack-open-pokedex Oct 24, 2023
Bonyaha referenced this pull request in Bonyaha/full-stack-open-pokedex Dec 20, 2023
Bonyaha referenced this pull request in Bonyaha/full-stack-open-pokedex Dec 20, 2023
* updated

* test

* test#2

* test#3

* test#4

* test#5

* test#6

* test#7

* updated

* health check#1

* helth check#2

* helth check #3

* final helth check

* test of PR

* test of PR #2

* test of PR #3
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Dec 30, 2023
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Dec 30, 2023
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Dec 30, 2023
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Dec 30, 2023
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Dec 31, 2023
YannisSefsaf referenced this pull request in YannisSefsaf/full-stack-open-pokedex Jan 3, 2024
zoltan-antal referenced this pull request in zoltan-antal/full-stack-open-pokedex Jan 4, 2024
jannepark referenced this pull request in jannepark/full-stack-open-pokedex Apr 20, 2024
David4bay referenced this pull request in David4bay/full-stack-open-pokedex Jul 8, 2024
David4bay referenced this pull request in David4bay/full-stack-open-pokedex Jul 10, 2024
David4bay referenced this pull request in David4bay/full-stack-open-pokedex Jul 14, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 17, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 17, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 17, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 17, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 17, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 18, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 18, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 18, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 18, 2024
edvvarrd added a commit to edvvarrd/full-stack-open-pokedex that referenced this pull request Aug 18, 2024
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