-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
miltonHenschel
commented
Dec 13, 2022
- Use ES6 syntax and arrow functions
- Divide code into modules
- Display the current date below the navigation bar.
There was a problem hiding this 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.
modules/localStore.js
Outdated
return books; | ||
} | ||
|
||
static addBooks(newBook) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.
const timeDisplay = () => { | ||
const timeInfo = document.querySelector('#time-info'); | ||
timeInfo.innerHTML = `${DateTime.now().toLocaleString(DateTime.DATETIME_MED)}`; | ||
}; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
There was a problem hiding this 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.
modules/localStore.js
Outdated
static getBooks() { | ||
let books; | ||
const localBook = localStorage.getItem('local'); | ||
if (!localBook) { | ||
books = []; | ||
} else { | ||
books = JSON.parse(localBook); | ||
} | ||
return books; | ||
} | ||
|
||
static addBooks(newBook) { |
There was a problem hiding this comment.
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:
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:
It will probably work as you expect and avoid unintended errors while using the modern syntax 😉.
modules/ui.js
Outdated
class UI { | ||
static showBooks() { | ||
const books = LocalStore.getBooks(); | ||
books.forEach((newBook) => { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
There was a problem hiding this 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
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() |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.