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

Awesome Book: Using modules with ES6 #1

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

Conversation

miltonHenschel
Copy link
Owner

  • Use ES6 syntax and arrow functions
  • Divide code into modules
  • Display the current date below the navigation bar.

@miltonHenschel miltonHenschel temporarily deployed to github-pages December 13, 2022 06:50 — with GitHub Pages Inactive
@miltonHenschel miltonHenschel temporarily deployed to github-pages December 13, 2022 07:25 — with GitHub Pages Inactive
Copy link

@Olamarx Olamarx left a comment

Choose a reason for hiding this comment

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

Hi @miltonHenschel,

Good job so far, indeed you have spent time on this project!
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • All linters passed ✔️
  • Add and remove ✔️

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

return books;
}

static addBooks(newBook) {
Copy link

Choose a reason for hiding this comment

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

  • Kindly make use of ES6 arrow function for your approach to be of latest and it would help you in React module.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Please @Olamarx I didn't succeed to change the static functions to arrow functions. The last I checked, it's not possible to do that in classes. 😁 Please could you help me to achieve that? Thanks in advance.

modules/ui.js Outdated
let newId = 0;

class UI {
static showBooks() {
Copy link

Choose a reason for hiding this comment

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

  • Kindly make use of the ES6 arrow function for your approach to be of the latest and it would help you in React module. Apply this to others too, please.

Comment on lines +67 to +70
const timeDisplay = () => {
const timeInfo = document.querySelector('#time-info');
timeInfo.innerHTML = `${DateTime.now().toLocaleString(DateTime.DATETIME_MED)}`;
};
Copy link

@Olamarx Olamarx Dec 13, 2022

Choose a reason for hiding this comment

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

  • This function is not working. Kindly take a second look. You can use += instead of = alone. Just a suggestion.

Copy link

@Olamarx Olamarx left a comment

Choose a reason for hiding this comment

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

Hi @miltonHenschel,

Good job so far, indeed you have spent time on this project!
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • All linters passed ✔️
  • Add and remove ✔️

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@miltonHenschel miltonHenschel temporarily deployed to github-pages December 13, 2022 08:53 — with GitHub Pages Inactive
@miltonHenschel miltonHenschel temporarily deployed to github-pages December 13, 2022 14:44 — with GitHub Pages Inactive
Copy link

@Gopxfs Gopxfs left a comment

Choose a reason for hiding this comment

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

♻️ STATUS: REQUIRED CHANGES ♻️

Hi @miltonHenschel 👋,

You've done well implementing some of the requested changes 👏 , but there are still some which haven't been addressed yet.

Highlights 🚀

✔️ No linter errors.
✔️ Great code structure. Well done!
✔️ Implemented some of the changes requested by the previous reviewer.

Required Changes ♻️

Check the comments under the review.

Optional suggestions 🗒️

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me @Gopxfs in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

Comment on lines 2 to 13
static getBooks() {
let books;
const localBook = localStorage.getItem('local');
if (!localBook) {
books = [];
} else {
books = JSON.parse(localBook);
}
return books;
}

static addBooks(newBook) {
Copy link

Choose a reason for hiding this comment

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

As requested by the previous reviewer, please use arrow functions instead of normal functions 😉.
Tip: you could have something like this:

image

Check this link to learn more about arrow functions.

As you are using static functions, adapting the code I showed above may introduce you to new errors or even stop your code from working 😄. To overpass that, try this code:

image

It will probably work as you expect and avoid unintended errors while using the modern syntax 😉.

modules/ui.js Outdated
Comment on lines 6 to 9
class UI {
static showBooks() {
const books = LocalStore.getBooks();
books.forEach((newBook) => {
Copy link

Choose a reason for hiding this comment

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

Please also make sure to update this class methods.

@miltonHenschel miltonHenschel temporarily deployed to github-pages December 14, 2022 12:57 — with GitHub Pages Inactive
Copy link

@GzimAsani GzimAsani left a comment

Choose a reason for hiding this comment

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

STATUS: APPROVED 💯

There is nothing else to say than it's time to merge... 🥳

Cheers and Happy coding! 👏 💻 🍷
Feel free to leave any questions or comments in the PR thread if something is not 100% clear.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

You can also consider:

  • N/A

Please be reminded to not open a new pull request after you get a review, only use the same one 💭

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.

_As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

Copy link

@brytebee brytebee left a comment

Choose a reason for hiding this comment

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

Hi, @miltonHenschel👋,

Highlights💡

  • Good commit message.✔️
  • Good PR Summary.✔️
  • Great UI design.✔️
  • App functions as it should.✔️

STATUS: APPROVED 🕺🥳

Congratulations🍾🥳!! Your project is ready for presentation! There is nothing else to say other than... it's time to merge it :shipit:

Optional Suggestions:

  • N/A

Good luck! 🎉


Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me @brytebee in your question so I can receive the notification.

Use @brytebee on slack for faster responses.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

}
}

// static deleteBooks()

Choose a reason for hiding this comment

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

  • Optional: kindly remove unused codes.

books = books.filter((bk) => JSON.stringify(bk.id) !== id);
localStorage.setItem('local', JSON.stringify(books)); // LOCAL STORAGE
UI.deleteBookFromList(e.target);
// window.location.reload();

Choose a reason for hiding this comment

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

  • Optional: kindly remove unused codes throughout this file.

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.

None yet

5 participants