-
-
Notifications
You must be signed in to change notification settings - Fork 142
Birmingham | 25-ITP-Sept | Joy Opachavalit | Sprint 2 | Feature/Book Library #336
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
base: main
Are you sure you want to change the base?
Birmingham | 25-ITP-Sept | Joy Opachavalit | Sprint 2 | Feature/Book Library #336
Conversation
cjyuan
left a comment
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.
Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md
Update index.html and script.js as per feedbacks. |
cjyuan
left a comment
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.
Changes look great.
| authorCell.innerHTML = myLibrary[i].author; | ||
| pagesCell.innerHTML = myLibrary[i].pages; | ||
| const table = document.getElementById("display"); | ||
| table.innerHTML = "<tr><th>Title</th><th>Author</th><th>Pages</th><th>Read</th><th>Actions</th></tr>"; |
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.
Could also just clear <tbody>.
Note: There was a <tbody> in the original HTML code.
| myLibrary.forEach((book, index) => { | ||
| const row = table.insertRow(); | ||
| row.innerHTML = ` | ||
| <td>${book.title}</td> | ||
| <td>${book.author}</td> | ||
| <td>${book.pages}</td> | ||
| <td><button class="btn btn-success toggle-read" data-index="${index}">${book.check ? "Yes" : "No"}</button></td> | ||
| <td><button class="btn btn-warning delete-book" data-index="${index}">Delete</button></td> | ||
| `; | ||
| }); |
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.
If title and author contain special characters such as '<' and '&' they could messed up the HTML output.
| const index = e.target.dataset.index; | ||
| myLibrary.splice(index, 1); | ||
| render(); | ||
| alert("Book deleted successfully."); |
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.
Currently when the alert dialog box appears, the UI is still showing the deleted item. The UI is only updated after the user closes the dialog box.
Can you figure out how to make the alert dialog box appear only after the UI is updated?
Notes:
- This change is optional.
- In practice, it might not be a good idea to use
alert()to show any message.
Learners, PR Template
Self checklist
Changelist