Skip to content

Feature/mini challenge5 - from challenge 4#5

Open
wdonet wants to merge 2 commits intofeature/MiniChallenge4from
feature/miniChallenge5
Open

Feature/mini challenge5 - from challenge 4#5
wdonet wants to merge 2 commits intofeature/MiniChallenge4from
feature/miniChallenge5

Conversation

@wdonet
Copy link

@wdonet wdonet commented Apr 6, 2021

I added this just for checking the incremental changes from last challenge

Copy link
Author

@wdonet wdonet left a comment

Choose a reason for hiding this comment

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

I left a few comments and suggestions

  • All the sections have their own route.
  • Navigation across the sections is implemented correctly.
  • The Global State is persistent across all the sections.
  • The "Mocked Authentication" mechanism works correctly.
  • The "session data" is stored in the Global Context correctly.
  • Videos can be added to the Favorites list.
  • Videos can be removed from the Favorites list.
  • Navigation to Favorite Videos View using a private route is implemented correctly (only authenticated users should access this section).
  • Navigation to the Favorite Video Details View using a private route is implemented correctly (only authenticated users should access this section).
  • Information for the selected favorite video is displayed correctly
  • The list of other favorite videos in the Favorite Video Details View is displayed.
  • Testing coverage is above 70%. (Please include a screenshot of the code coverage report in your PR description).
    • Note: It is below 70

Bonus Points

  • The Add/remove from favorites button should appear when the user passes the mouse over the video card in the list.
  • Integrate with a real authentication provider (such as Auth0, OAuth or Firebase).
  • A 404 section is shown when a route is not found.
  • The Login View is implemented as a modal using React Portals.

Comment on lines +80 to +84
if (index !== -1) {
setFavorite(true);
} else {
setFavorite(false);
}
Copy link
Author

Choose a reason for hiding this comment

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

could be reduced to setFavorite()

Suggested change
if (index !== -1) {
setFavorite(true);
} else {
setFavorite(false);
}
setFavorite(index !== -1);

const isFavorite = () => {
if (favoritesList !== null) {
const index = favoritesList.findIndex(
(element) => element.id.videoId === video.id.videoId
Copy link
Author

Choose a reason for hiding this comment

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

Use defaults for defense coding this case like:

Suggested change
(element) => element.id.videoId === video.id.videoId
({ id = {}} = {}) => id.videoId === video.id.videoId

<p>{snippet.description}</p>
</VideoDescription>
{isLogged ? addFavorites : ''}
{isLogged ? show() : ''}
Copy link
Author

Choose a reason for hiding this comment

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

instead to return an empty string on else case, when you want to render nothing, it is better to return null

@wdonet wdonet changed the title Feature/mini challenge5 Feature/mini challenge5 - from challenge 4 Apr 6, 2021
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.

1 participant