Skip to content

Birmingham | ITP-Jan | Roman Sanaye | Sprint 2 | Book Library#436

Open
RomanSanaye wants to merge 3 commits intoCodeYourFuture:mainfrom
RomanSanaye:book-library
Open

Birmingham | ITP-Jan | Roman Sanaye | Sprint 2 | Book Library#436
RomanSanaye wants to merge 3 commits intoCodeYourFuture:mainfrom
RomanSanaye:book-library

Conversation

@RomanSanaye
Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Fixed bugs in the Book Library application according to the assignment requirements.
The application now correctly:

  • Loads and displays books on page load
  • Adds new books using the form
  • Validates input fields before submission
  • Toggles read/unread status correctly
  • Deletes books from the list
  • Updates the UI dynamically after changes

Questions

No questions at this time.

@RomanSanaye RomanSanaye added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 14, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a 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/CodeYourFuture/Module-Data-Flows/blob/general-review-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 16, 2026
@RomanSanaye
Copy link
Copy Markdown
Author

Hi @cjyuan , I hope you well.
Thanks for the feedback, I’ve reviewed the general feedback link and applied relevant improvements to my book library code (validation, trimming, type conversion, and textContent updates).

@RomanSanaye RomanSanaye added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good.

@@ -1,103 +1,122 @@
let myLibrary = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Safer to declare it using const.

Comment on lines +24 to +29
// =====> DOM elements
const title = document.getElementById("title");
const author = document.getElementById("author");
const pages = document.getElementById("pages");
const check = document.getElementById("check");
const bookForm = document.getElementById("book-form");
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan Apr 17, 2026

Choose a reason for hiding this comment

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

  • Could consider declaring these at the beginning of this file to keep all shared variables in one place.

  • Why not rename all these constants to better reflect they are DOM elements? (bookForm is a good name)

Comment on lines +31 to +35
// =====> Form submit
bookForm.addEventListener("submit", function (e) {
e.preventDefault();
submit();
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better to perform this in the window's on load event listener so that all code that needs to be executed once on page load in located in one place.

Comment on lines +115 to 117
alert(`Deleted: ${book.title}`);
myLibrary.splice(index, 1);
render();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The alert message is shown before the book is actually deleted; the deletion only occurs after the alert dialog is dismissed. This introduces a risk that the operation may not complete (e.g., if the user closes the browser before dismissing the alert).

In general, it’s better to display a confirmation message only after the associated operation has successfully completed.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants