Skip to content

London | ITP-May-2025 | Hibo Sharif | Module-Data-Group | Sprint2 | Book Library #249

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

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

Conversation

hibosharif202504
Copy link

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

  • Fixed typos and syntax errors (library to myLibrary, missing bracket, etc.)
  • Corrected input handling (e.g., used author.value instead of repeating title.value)
  • Switched to forEach for cleaner loop over book entries
  • Improved form validation with .trim() checks
  • Integrated localStorage for saving and loading books
  • Reset form and auto-collapse after submission
  • Fixed button issues (clicks to click, corrected delete button logic)
  • Improved read status toggle logic and UI rendering
    -Ensured the table clears properly before re-rendering
  • I have added changes to the style.css file to improve the form layout by centring it, adding padding, and giving it a clean, rounded background style. Button and label spacing is also adjusted to ensure better readability and alignment throughout the form.

Questions

Ask any questions you have for your reviewer.

@hibosharif202504 hibosharif202504 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 28, 2025
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 3, 2025
@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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 3, 2025
@hibosharif202504 hibosharif202504 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 4, 2025
Copy link
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 great! Well done!

Comment on lines 30 to 48
titleEl.value.trim() === "" ||
authorEl.value.trim() === "" ||
pagesEl.value.trim() === ""

) {
alert("Please fill all fields!");
return false;
} else {
let book = new Book(title.value, author.value, pages.value, check.checked);
}
let pageCount = parseInt(pagesEl.value.trim());
if (pageCount <= 0 || isNaN(pageCount)) {
alert("Please enter a valid page number");
return false;
}
let book = new Book(
titleEl.value.trim(),
authorEl.value.trim(),
pageCount,
checkEl.checked
);
Copy link
Contributor

Choose a reason for hiding this comment

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

For better performance (reduce number of function calls) and reducing the chance of using raw input accidently, we could stored the pre-processed/sanitized/normalized input in some variables first, and reference the variables in other part of the function.

  const cleanTitle = title.value.trim();
  ...
  const book = new Book(cleanTitle, cleanAuthor, pageCount, checkEl.checked);

@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 5, 2025
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