Continue Reading Phase 3: My Books Landing Page Carousel - #13283
Draft
Sadashii wants to merge 6 commits into
Draft
Continue Reading Phase 3: My Books Landing Page Carousel#13283Sadashii wants to merge 6 commits into
Sadashii wants to merge 6 commits into
Conversation
Merge active user loans with past loan history into a unified carousel on the My Books landing page. Previously, the My Loans carousel only displayed active loans retrieved from get_loans_of_user(). Patrons with returned books would see an empty or sparse carousel despite having borrowing history. Key changes: - Extracted get_loan_history_data() from account.py into core/lending.py for reuse across endpoints and template handlers. - Updated My Books landing page logic in mybooks.py to perform a two-pass merge: active loans first (following up to 5 redirect hops), followed by historical loans deduplicated by work key. - Preserved active loan status overlay badges (FormatExpiry macro, waitlist count, ADE notices) and return form buttons (with explicit aria-label) for active bookreader loans. - Consolidated badge and action-row styles into components/carousel.css using Open Library design tokens (soft-green, red-two, button-hover-blue) and z-index variables. - Sorted merged entries with active loans prioritized, followed by loan timestamp descending, preserving total_results count and capping carousel display at 18 books. - Added comprehensive unit and integration test coverage for the merged loans carousel. Closes internetarchive#13272
Implement a lightweight, self-contained localStorage-backed reading tracker in the Open Library frontend. Key changes: - readingHistory.js: new store module implementing addEntry (upserts by OLID, promotes to front on re-read, caps at 20 entries), getHistory (sorted by timestamp descending), and clearHistory. No PII stored, only public book metadata. - ReadButton.html & LoanStatus.html: thread work/cover/author metadata down and attach data-ol-action and data-ol-book JSON attributes to Read/Borrow links. - index.js: register global delegated click listener targeting Read/Borrow links, dynamically importing readingHistory.js on first qualifying click. - readingHistory.test.js: 16 Jest unit tests covering store operations, deduplication, promotion, capping, field coercion, sorting, clearing, and corrupt storage recovery. Closes internetarchive#13273
Merge active user loans with past loan history into a unified carousel on the My Books landing page. Previously, the My Loans carousel only displayed active loans retrieved from get_loans_of_user(). Patrons with returned books would see an empty or sparse carousel despite having borrowing history. Key changes: - Extracted get_loan_history_data() from account.py into core/lending.py for reuse across endpoints and template handlers. - Updated My Books landing page logic in mybooks.py to perform a two-pass merge: active loans first (following up to 5 redirect hops), followed by historical loans deduplicated by work key. - Preserved active loan status overlay badges (FormatExpiry macro, waitlist count, ADE notices) and return form buttons (with explicit aria-label) for active bookreader loans. - Consolidated badge and action-row styles into components/carousel.css using Open Library design tokens (soft-green, red-two, button-hover-blue) and z-index variables. - Sorted merged entries with active loans prioritized, followed by loan timestamp descending, preserving total_results count and capping carousel display at 18 books. - Added comprehensive unit and integration test coverage for the merged loans carousel. Closes internetarchive#13272
Implement the Phase 3 Continue Reading carousel component on the My Books landing page (/account/books/). Key changes: - continueReading.js: client-side module that reads localStorage.ol_read_history via store/readingHistory.getHistory() and dynamically renders carousel card elements for stored books, setting title, cover thumbnail, work link, and Read CTA. - mybooks.html: add #continue-reading-container section (initially hidden) under owners_page block on the My Books landing page. - my-books/index.js: invoke initContinueReading() within initMyBooksAffordances(). - continueReading.test.js: unit test suite covering DOM initialization, empty history guard, card rendering, and HTML escaping.
for more information, see https://pre-commit.ci
Sadashii
force-pushed
the
13274/feature/continue-reading-carousel
branch
from
August 9, 2026 16:40
7cf6711 to
72253cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13274
Feature: Implement client-side "Continue Reading" carousel on the My Books landing page (
/account/books/) backed bylocalStorage.ol_read_history.Note
This is a Draft PR stacked on top of PR #13282 (
13273/feature/client-side-read-tracking).Technical
openlibrary/templates/account/mybooks.html): Added#continue-reading-containersection (initially hidden) beneath the My Loans section forowners_page.openlibrary/plugins/openlibrary/js/my-books/continueReading.js):initContinueReading()to querylocalStorage.ol_read_historyviastore/readingHistory.getHistory().#continue-reading-containerif local reading history exists.openlibrary/plugins/openlibrary/js/my-books/index.js): InvokesinitContinueReading()insideinitMyBooksAffordances().tests/unit/js/continueReading.test.js): Added Jest unit test suite covering DOM initialization, empty history guard, card rendering, and HTML escaping.Testing
Ran Jest unit test suite:
(4/4 tests passing)
Manual Verification Steps:
/account/books/.Screenshot
N/A — Client-side progressive enhancement carousel on My Books landing page.
Stakeholders
@Sadashii @mekarpeles