Skip to content

feat: Consolidate sidebar buy options into unified Buy button dropdown#13113

Open
Sadashii wants to merge 5 commits into
internetarchive:masterfrom
Sadashii:12826/feat/consolidate-sidebar-buy-options-into-buy-button
Open

feat: Consolidate sidebar buy options into unified Buy button dropdown#13113
Sadashii wants to merge 5 commits into
internetarchive:masterfrom
Sadashii:12826/feat/consolidate-sidebar-buy-options-into-buy-button

Conversation

@Sadashii

@Sadashii Sadashii commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #12867

Consolidates the sidebar WorldCat/library locate links and purchase/affiliate options into the unified "Buy" split-popover button on the edition and work pages, and removes the legacy sidebar vendor panels completely on desktop and mobile.

Technical

  • Updated databarWork.html to render the "Buy" button popover containing asynchronous store options.
  • Refactored AffiliateLinks.html.jinja and AffiliateLinksLoadingIndicator.html to use div containers and render a flat list of stores with full-row clickability.
  • Positioned the Buy button icons (left-aligned cart, right-aligned arrow with divider border) and centered label text correctly.
  • Ensured responsiveness: full-width on mobile tray (width: 100%) and 240px on desktop.
  • Made the entire .editionCover left column sticky on desktop to keep actions visible during scroll.

Testing

  • Run pytest suite: uv run --with-requirements requirements_test.txt pytest openlibrary/tests/test_templates.py
  • Verify locally that the "Buy" button behaves responsively and displays correctly.

Screenshot

screen-capture.webm

Stakeholders

@mekarpeles @lokesh

@Sadashii
Sadashii force-pushed the 12826/feat/consolidate-sidebar-buy-options-into-buy-button branch from b59e86d to a36b303 Compare July 17, 2026 07:19
@Sadashii
Sadashii marked this pull request as ready for review July 17, 2026 07:21
Copilot AI review requested due to automatic review settings July 17, 2026 07:21

Copilot AI 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.

Pull request overview

Consolidates “Buy” affordances into the unified Buy popover on edition pages by removing the legacy sidebar vendor panels and restyling affiliate link options for a flatter, full-row-clickable dropdown list. This aligns the edition page CTA area with the newer popover-based UI patterns.

Changes:

  • Removes the legacy mobile/desktop vendor panels from the edition page and renders affiliate links inside an <ol-popover> Buy dropdown.
  • Refactors affiliate links markup (loading indicator + store list) to use <div> containers and a flat list layout with prices aligned right.
  • Adds CSS for the Buy popover (trigger + content) and makes the left “editionCover” column sticky on desktop.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
static/css/components/work.css Makes the edition cover/tool column sticky on desktop for persistent CTAs.
static/css/components/read-panel.css Adds styling for the Buy popover dropdown and custom Buy button layout.
openlibrary/templates/type/edition/view.html Removes the legacy mobile vendor panel from the edition page layout.
openlibrary/macros/LoanStatus.html Removes the post injection point previously used for rendering the lists widget within LoanStatus.
openlibrary/macros/databarWork.html Adds the Buy <ol-popover> and relocates the lists widget rendering after the CTA area.
openlibrary/macros/AffiliateLinksLoadingIndicator.html Switches the async loading wrapper from <span> to <div>.
openlibrary/macros/AffiliateLinks.html.jinja Refactors affiliate link items into full-row clickable blocks with name/price alignment and updated disclaimer styling hook.
openlibrary/i18n/messages.pot Updates extracted string references and reintroduces “Buy this book” for the new popover aria-label.
docker/Dockerfile.olbase Touches node_modules before make to avoid rebuild churn during image build.
bundlesize.config.json Adjusts bundlesize max for admin CSS bundle.

Comment on lines +5 to +8
$# Buy button is primary (blue) only when no digital access and a WorldCat URL exists
$ availability = (page.availability or {}) if hasattr(page, 'availability') else {}
$ _has_digital = bool(page.get('ocaid') or availability.get('is_readable') or availability.get('status') == 'open' or availability.get('is_lendable') or availability.get('is_previewable'))
$ buy_is_primary = editions_page and not _has_digital and bool(worldcat_url)

$if editions_page:
<ol-popover class="buy-popover" aria-label="$_('Buy this book')">
<button slot="trigger" type="button" class="cta-btn cta-btn--w-icon cta-btn--buy">
Comment on lines +336 to +350
.cta-btn--buy {
position: relative;
background-color: var(--grey-464646);
color: var(--white);
margin-top: 0;
height: 37px;
padding: 0 var(--spacing-inset-sm);
display: flex;
align-items: center;
justify-content: center;
}

.cta-btn--buy:hover {
background-color: var(--dark-grey);
}
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.

2 participants