Skip to content

London | 26-ITP-May | Zadri Abdule | Sprint 2 | Book - library - #520

Open
Zadri415 wants to merge 9 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-2/book-library
Open

London | 26-ITP-May | Zadri Abdule | Sprint 2 | Book - library#520
Zadri415 wants to merge 9 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-2/book-library

Conversation

@Zadri415

@Zadri415 Zadri415 commented Aug 6, 2026

Copy link
Copy Markdown

Learners, PR Template

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

  • index.html — fix form input types and wiring (changed submit button to call addBook()).
  • script.js — fixes for seeding, add-book handling, read state (use boolean), rendering, toggle read, and delete logic.

Questions

N/A

@Zadri415 Zadri415 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Flows The name of the module. labels Aug 6, 2026

@cjyuan cjyuan left a comment

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.

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 Aug 7, 2026
@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2026

@cjyuan cjyuan left a comment

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.

Changes look good.

There are a few improvements you could still make.

Comment on lines +12 to +13
#toast {
position: fixed;

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.

Why not prepare the CSS in style.css?

Comment thread debugging/book-library/index.html Outdated
/>
<div class="col">
<label for="pages">Pages:</label>
<input type="number" class="form-control" id="pages" name="pages" min="1" required />

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.

Could you find out why the browser is not enforcing the constraint min="1" required? Currently a user could submit page count suchas-123and12.345`.

Comment thread debugging/book-library/script.js Outdated
// Preprocessing / validation:
// - reject empty or whitespace-only title/author (checked AFTER trim, not before)
// - reject non-numeric or non-positive page counts
if (!title || !author || !pagesRaw || !Number.isFinite(pages) || pages <= 0) {

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.

  • Do you know why checking !pageRaw is optional?

  • What type of number should a page count be?

Comment thread debugging/book-library/script.js Outdated
Comment on lines +50 to +53
titleInput.value = "";
authorInput.value = "";
pagesInput.value = "";
checkInput.checked = false;

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.

If the input elements are inside a <form>, we could also just reset the form with one function call.

Comment on lines +60 to +61
const table = document.getElementById("display");
const tbody = table.getElementsByTagName("tbody")[0];

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.

Note: We could also use document.querySelector() to select the specific tbody element directly.

Comment on lines +100 to +101
const idx = myLibrary.indexOf(book);
if (idx === -1) return;

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.

We could also obtain the index of the current book from the second parameter of the function pass to forEach() on line 66.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you for the feedback. I have updated both files.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2026
@Zadri415 Zadri415 closed this Aug 17, 2026
@cjyuan

cjyuan commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

May I know why you closed this PR?

@Zadri415

Zadri415 commented Aug 17, 2026 via email

Copy link
Copy Markdown
Author

@github-actions

This comment has been minimized.

@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 17, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 17, 2026
@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 17, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 17, 2026
@cjyuan

cjyuan commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

The validation boot does not recognise duplicated PRs for any backlog in ITP.

Currently you have two book library PRs. If you want to continue to work on this PR, you would need to close the other PR first. Otherwise the validation bot will reject this PR.

@Zadri415 Zadri415 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected labels Aug 18, 2026

@cjyuan cjyuan left a comment

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.

Changes look good.

There are some improvements you could still make though.

// Native "required"/"min"/"step" already ran before this handler fires
// (see bookForm's submit listener below), so this is a second layer
// for things HTML attributes can't express, like whitespace-only text.
if (!title || !author || !pagesRaw || !Number.isFinite(pages) || pages <= 0) {

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.

  • Do you know why checking !pageRaw is optional?

  • Why not just check if pages is a whole number?

Comment on lines +117 to +125
bookForm.addEventListener("submit", (event) => {
event.preventDefault();
addBook();
});

document.addEventListener("DOMContentLoaded", () => {
populateStorage();
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.

Good job in placing all code that runs once on page load at the end of the file. Doing so could make locating and managing them easier.

A better practice would be to keep them in a single function. For example, you could put it inside the page load callback or create a function named init() or setup() and call it once when the page loads.

@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 Aug 18, 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. Module-Data-Flows The name of the module. 🏕 Priority Mandatory This work is expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants