Skip to content

Combine book-navigator and ia-bookreader web components#1492

Merged
cdrini merged 5 commits intointernetarchive:masterfrom
cdrini:refactor/ia-br-book-navigator
Jan 24, 2026
Merged

Combine book-navigator and ia-bookreader web components#1492
cdrini merged 5 commits intointernetarchive:masterfrom
cdrini:refactor/ia-br-book-navigator

Conversation

@cdrini
Copy link
Contributor

@cdrini cdrini commented Jan 21, 2026

While working on hideable chrome, I will want to later also make the book actions bar be hideable. The positioning of the toolbars is a bit difficult (especially when going fullscreen), and the two layers of web components here made this more difficult. Since we know we long-term want one main wrapping component, ia-bookreader with ia-item-navigator as its shell, combining book-navigator into ia-bookreader removes a decent amount of layers of DOM and helps us get closer to that vision!

Before After
image image

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.70%. Comparing base (7af3b44) to head (815c000).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/ia-bookreader/ia-bookreader.js 77.72% 43 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1492      +/-   ##
==========================================
+ Coverage   69.68%   69.70%   +0.01%     
==========================================
  Files          64       65       +1     
  Lines        5373     5373              
  Branches     1179     1182       +3     
==========================================
+ Hits         3744     3745       +1     
  Misses       1594     1594              
+ Partials       35       34       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cdrini cdrini marked this pull request as ready for review January 21, 2026 06:03
Copy link
Contributor

@jbuckner jbuckner left a comment

Choose a reason for hiding this comment

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

One question about consolidation, but overall looks good!

I only did a quick scan of the ia-bookreader.js updates since it's pretty large and I assume most of it is just consolidating book-navigator.js

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request combines the book-navigator and ia-bookreader web components to reduce DOM layers and simplify the component hierarchy. The book-navigator component has been completely removed, with all its functionality absorbed into ia-bookreader.

Changes:

  • Merged book-navigator component into ia-bookreader, eliminating a layer of DOM nesting
  • Changed property name from itemMD to item for consistency
  • Converted event-based communication to direct property updates within the consolidated component
  • Updated internal property names (e.g., brWidth_brWidth) to follow private naming convention

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/BookNavigator/book-navigator.js Entire file deleted - functionality moved to ia-bookreader.js
src/ia-bookreader/ia-bookreader.js Major refactor: absorbed all book-navigator functionality, converted event emissions to direct property updates
tests/jest/ia-bookreader/ia-bookreader.test.js Updated tests for consolidated component, renamed properties, changed event assertions to direct property/method checks
src/BookReader.js Updated TypeScript type comment to reference IaBookReader instead of BookNavigator
src/BookNavigator/visual-adjustments/visual-adjustments-provider.js Simplified constructor parameter destructuring
src/BookNavigator/viewable-files.js Added JSDoc documentation for constructor parameters
Comments suppressed due to low confidence (2)

tests/jest/ia-bookreader/ia-bookreader.test.js:280

  • The test name includes "@updateSideMenu" with an @ symbol, but this appears to be leftover from when this was an event. Since updateSideMenu is now a direct method call (not an event), remove the @ symbol for clarity.
    tests/jest/ia-bookreader/ia-bookreader.test.js:31
  • The baseHost property is set to https://foo.archive.org (with protocol), but the default value in the constructor is archive.org (without protocol). The itemImage getter prepends "https://" which would result in "https://https://foo.archive.org/..." if baseHost includes the protocol. Consider setting baseHost to just foo.archive.org without the protocol to match the expected usage pattern and default value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cdrini cdrini force-pushed the refactor/ia-br-book-navigator branch from 4225256 to eeafa86 Compare January 24, 2026 01:33
@cdrini cdrini merged commit 5c571e0 into internetarchive:master Jan 24, 2026
10 checks passed
@cdrini cdrini deleted the refactor/ia-br-book-navigator branch January 24, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants