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

Code Review #27

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Code Review #27

wants to merge 29 commits into from

Conversation

mayaajike
Copy link

No description provided.

Copy link

@mellyeliu mellyeliu left a comment

Choose a reason for hiding this comment

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

Overall, great work this week! It was awesome to see you complete so many stretch features.

What’s working well:

  • Clear component names: You’ve done an excellent job naming your components in a clear and descriptive way. This really helps in understanding the purpose of each component at a glance, making the codebase much more navigable.
  • Organized CSS files: Thanks for separating styles into files by component, it enhances maintainability and makes it easier to manage styles as the project grows.
  • Good parent-child structures: You demonstrated a good understanding of component architecture, making the data flow and component responsibilities clear and logical.
  • Effective use of state and props: You’ve demonstrated a solid grasp of managing state and props for displaying the movies in the sidebar.

Areas for improvement:

  • Destructuring props: To make your components even cleaner, let's destructuring props at the beginning of your functional components. This not only reduces the props. repetition throughout the component but also makes the code cleaner and easier to read
  • CSS Class Repetition: I noticed some repetition in the CSS ids. Let's combine styles (eg. button styles) into one unified class
  • Combining commits: Try to combine related changes into fewer commits. This practice can help in keeping the project history more streamlined and meaningful. Tools like git rebase can be really handy for combining commits and cleaning up your commit history before merging.

}
}

const className = Number(props.rating) < 5 ? 'bad' : Number(props.rating) < 7.5 ? 'okay' : 'good'

Choose a reason for hiding this comment

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

instead of allocating a variable for this, we typically like to do this inline:

<div className={{Number(props.rating) < 5 ? 'bad' : Number(props.rating) < 7.5 ? 'okay' : 'good'}}

import './SideBar.css';

const SideBar = (props) => {
const likedMovies = props.likedList;

Choose a reason for hiding this comment

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

typically we like to destructure the props to access them:
const {likedList, watchedList, showing, etc} = props;

import React from 'react';
import './SideBarCard.css';

const SideBarCard = (props) => {

Choose a reason for hiding this comment

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

similarly, prop destructuring preferred

const updatedWatchedList = props.watchedList.filter(movie => movie.id !== props.id);
props.setWatchedList(updatedWatchedList);
}
}else {

Choose a reason for hiding this comment

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

in the future, let's run lint to fix some of these spacing issues

}

#searchTabButton {
background-color: #B19CD9;

Choose a reason for hiding this comment

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

we reuse background-color: #B19CD9; quite a few times here, in the future let's try to capture repeated styles in a separate class so we can avoid repetition

Copy link

@ireneluvsbear ireneluvsbear left a comment

Choose a reason for hiding this comment

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

Nice work!!

}

export default App
export default App;

Choose a reason for hiding this comment

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

you can do export default component App(){...} more to read on React flow component syntax https://fburl.com/6hxctx6w


return (
<>
<header className="header">

Choose a reason for hiding this comment

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

this should have an indent. Somehow format is important for code readebility. things like indentation, empty line,...

src/Modal.css Outdated
color: white;
}

.body-no-scroll {

Choose a reason for hiding this comment

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

let's try to keep the styles name format consistent, bodyNoScroll

// loadButton.style.display = 'none';
} else if (selectedValue === "rating-asc"){
sortByRatingAsc();
}

Choose a reason for hiding this comment

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

can use 'switch case' here when multiple if else

}else {
setMovies(results);
}

Copy link

@hanluc hanluc Jun 20, 2024

Choose a reason for hiding this comment

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

Overall looks good to me! The website looks great to me and functioning well!

Just a few nit on spacing and newlines. I noticed that a lot of functions have series of consecutive newlines, can we delete the newlines to make file structure cleaner?

src/App.jsx Outdated
const loadMore = () => {
setPage(page => page + 1);
};
// setModal(!modal);
Copy link

Choose a reason for hiding this comment

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

Why do we need this line?

@@ -13,7 +14,7 @@ const SideBar = (props) => {
<div className="side-bar-content">
<ul className="side-bar-list">
<div className="liked-movies-div">
<li className="liked-movies">Liked Movies</li>
<li className="conatiner-names">Liked Movies</li>
Copy link

Choose a reason for hiding this comment

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

typo?

src/Modal.css Outdated
height: 100%;
overflow: hidden;
background-color: rgba(225, 225, 225, 0.5);
/* margin-top: 15px; */
Copy link

Choose a reason for hiding this comment

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

remove this unused line?

src/App.jsx Outdated
const apiKey = import.meta.env.VITE_API_KEY;

console.log(likedList);
Copy link

Choose a reason for hiding this comment

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

let's remove the console log stuff before committing.

} else if (likeCount >= 1) {
const heart = document.getElementById(props.id).querySelector('#like-count');
setLikeCount(likeCount - 1);
heart.innerText = `♡`;
Copy link

@hanluc hanluc Jun 20, 2024

Choose a reason for hiding this comment

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

The function is called "increaseLikes", but the likeCount is decreased here. Do you want to update the logic or rename the function?

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.

5 participants