Skip to content

Conversation

@OpenStaxClaude
Copy link
Contributor

@OpenStaxClaude OpenStaxClaude commented Jan 9, 2026

Summary

This PR adds a new audiobook purchase option box to the book details pages that appears above the Individual and Bookstore print options when an audiobook link is configured in the CMS.

Changes

Frontend (os-webview)

  • Import faVolumeUp icon from FontAwesome for audiobook representation
  • Fetch audiobook_link from CMS API using new hook
  • Add audiobook entry to purchase options array (appears first when present)
  • Update grid layout to accommodate 3 boxes instead of 2
  • Add translations for "Audiobook" and "Purchase options" (English and Spanish)
  • Add analytics tracking with "Audiobook" label for click tracking

UI Changes

When an audiobook link is configured:

  • Audiobook box appears first (top position)
  • Icon: Volume/speaker icon (faVolumeUp)
  • Header: "Audiobook"
  • Button: "Purchase options" (primary style)
  • Individual and Bookstore boxes follow below

When no audiobook link is configured:

  • Component behaves exactly as before (backwards compatible)
  • Only shows Individual and Bookstore boxes

Responsive Design

  • Desktop: 3-column grid layout when audiobook is present
  • Mobile: Vertical stack of boxes
  • Uses dynamic boxes-${contentArray.length} class for flexible styling

Testing

  • Verify audiobook box appears when CMS audiobook_link is populated
  • Verify audiobook box does NOT appear when audiobook_link is empty
  • Verify audiobook box appears first (above Individual and Bookstore)
  • Verify layout works on desktop with 3 boxes
  • Verify layout works on mobile with 3 boxes
  • Verify clicking audiobook button navigates to correct URL
  • Verify analytics tracking fires with "Audiobook" label
  • Verify translations work (English and Spanish)
  • Verify icon displays correctly (volume/speaker icon)

Related

Screenshots

Mockup available in Jira ticket CORE-1476


🤖 Generated with Claude Code

This adds a new audiobook purchase option box that appears above the
Individual and Bookstore print options when an audiobook link is
configured in the CMS.

Changes:
- Import faVolumeUp icon for audiobook representation
- Fetch audiobook_link from CMS API
- Add audiobook entry to purchase options (appears first when present)
- Update button styling to accommodate 3 boxes in grid layout
- Add translations for "Audiobook" and "Purchase options" (en/es)
- Add specific analytics tracking for audiobook clicks

The audiobook box only appears when the book has an audiobook_link
configured in the CMS, ensuring backwards compatibility.

Related to: CORE-1476

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

// Add audiobook option at the beginning if link is available
if (audiobookLink) {
content.unshift({
Copy link
Member

Choose a reason for hiding this comment

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

i think we would prefer the audiobook box at the end of the list

padding: $normal-margin;
width: max-content;

&.boxes-3 {
Copy link
Member

Choose a reason for hiding this comment

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

did you add this class and then not use it anywhere? whats up with that?

Per review feedback, the audiobook option now appears after Individual
and Bookstore boxes instead of before them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor Author

@OpenStaxClaude OpenStaxClaude left a comment

Choose a reason for hiding this comment

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

Fixed! The audiobook box now appears at the end of the list. Changed from content.unshift() to content.push() in commit 5151f9d.

Copy link
Contributor Author

@OpenStaxClaude OpenStaxClaude left a comment

Choose a reason for hiding this comment

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

The boxes-3 class is being used - it's dynamically applied via template literals on lines 39 and 83:

<div className={`phone-version boxes boxes-${contentArray.length}`}>
<div className={`larger-version boxes boxes-${contentArray.length}`}>

When there are 3 items in the contentArray (which happens when an audiobook link is present), the class becomes boxes-3, which triggers the 3-column grid layout in the SCSS.

@TomWoodward TomWoodward marked this pull request as ready for review January 9, 2026 20:33
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