Skip to content

Story 2455: Library Highlight Carousel on Homepage#2510

Open
julhoang wants to merge 6 commits into
developfrom
julia/library-highlight-carousel
Open

Story 2455: Library Highlight Carousel on Homepage#2510
julhoang wants to merge 6 commits into
developfrom
julia/library-highlight-carousel

Conversation

@julhoang

@julhoang julhoang commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Issue: #2455

⚠️ Base branch is #2481 to build on the homepage new changes ⚠️

Summary & Context

Replaces the static "Get started" code-block card on the V3 homepage with a new "Explore battle tested libraries" carousel card, wired to real library data and editor-curated via a new Wagtail setting.

Changes

Library Highlight Carousel component

  • Add _library_highlight_carousel.html — a CSS-only, radio-driven carousel (no JS) mirroring the testimonial card pattern: hidden radios hold state, only the yellow card translates while the meta row (added-in + dots), divider, and CTA stay static and swap per-slide content via inline <style> rules. Prev/next wrap cyclically.
  • Add library-highlight-carousel.css and register it in components.css
  • Each slide shows the library name, category tags (linking to the filtered libraries list), description, "Added in Boost {version}", and a "View documentation" CTA

Homepage wiring

  • Add build_library_highlight_carousel() in ak/homepage.py: shows editor-curated highlighted_libraries first (random order), then fills remaining slots with random flagship/core libraries from the latest release; returns slide dicts with name, category tags, description, version, and docs URL

Editor configuration

  • Add HomepageSettings.highlighted_libraries (M2M to Library) with a Wagtail FieldPanel, scoped — like featured_library — to flagship/core libraries in the latest stable release, A→Z
  • Add migration 0009_homepagesettings_highlighted_libraries

Shared constant & demo

  • Extract FEATURED_LIBRARY_TIERS = [Tier.FLAGSHIP, Tier.CORE] in libraries/models.py and reuse it across ak/homepage.py and core/models.py (featured-library + highlight choosers)
  • Add demo slides and a "Library Highlight Carousel" section to the V3 component demo page

Risks & Considerations

  • The CSS-only carousel relies on a generated inline <style> block keyed by carousel_id; rendering the component twice on one page requires distinct carousel_id values (the homepage and demo already use different ids).

Peer-Testing Guidelines

  1. Pull this branch and run docker compose exec web python manage.py migrate.
  2. Open http://localhost:8000/ and homepage now shows the "Explore battle tested libraries" carousel; click the prev/next chevrons and pagination dots and confirm the card slides while the meta row, divider, and CTA stay in place and wrap cyclically at the ends.
  3. With JavaScript disabled, reload http://localhost:8000/ and confirm the carousel still renders and the radio/label navigation still switches slides.
  4. In the Wagtail admin (http://localhost:8000/admin/), open Settings → Homepage Settings, add one or more libraries to Highlighted libraries, save, and reload the homepage — confirm the curated libraries appear first.
Screenshot 2026-06-30 at 3 29 59 PM 5. Clear all highlighted libraries and reload — confirm the carousel falls back to random flagship/core libraries from the latest release. 6. Verify the component in isolation at http://localhost:8000/v3/demo/components/#library-highlight-carousel. 7. Check category tags link to the filtered libraries list and the "View documentation" CTA points at the correct library docs.

Screenshots

Before After
Screenshot 2026-06-30 at 6 06 30 PM Screenshot 2026-06-30 at 3 31 03 PM

Self-review Checklist

  • Tag at least one team member from each team to review this PR
  • Link this PR to the related GitHub Project ticket

Frontend

  • UI implementation matches Figma design
  • Tested in light and dark mode
  • Responsive / mobile verified
  • Accessibility checked (keyboard navigation, etc.)
  • Ensure design tokens are used for colors, spacing, typography, etc. – No hardcoded values
  • Test without JavaScript (if applicable)
  • No console errors or warnings

Summary by CodeRabbit

  • New Features

    • Added a new “Library Highlight” carousel on the homepage and in the V3 examples page.
    • Featured libraries now show tags, descriptions, version info, and documentation links in a more visual format.
  • Bug Fixes

    • Improved homepage layout sizing to better prevent overflow in the top section.
    • Updated featured library selection to use the latest stable releases when available.
  • Chores

    • Added support for highlighting selected libraries in homepage settings.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@julhoang, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e48e5e60-f392-4775-81c8-6e55186b5c3a

📥 Commits

Reviewing files that changed from the base of the PR and between 4a739ca and d8b38e1.

📒 Files selected for processing (12)
  • ak/homepage.py
  • ak/views.py
  • core/migrations/0009_homepagesettings_highlighted_libraries.py
  • core/models.py
  • core/views.py
  • libraries/models.py
  • static/css/v3/components.css
  • static/css/v3/library-highlight-carousel.css
  • static/css/v3/v3-homepage.css
  • templates/v3/examples/_v3_example_section.html
  • templates/v3/homepage.html
  • templates/v3/includes/_library_highlight_carousel.html
📝 Walkthrough

Walkthrough

This PR replaces the homepage "Get Started" code card with a new "Library Highlight" carousel showing editor-curated and randomly selected libraries. Changes include a new HomepageSettings field/migration, form/query scoping via a shared FEATURED_LIBRARY_TIERS constant, a carousel builder function, and a CSS-only carousel template with styling.

Changes

Library Highlight Carousel

Layer / File(s) Summary
Featured tier constant
libraries/models.py, ak/homepage.py
Adds FEATURED_LIBRARY_TIERS constant and uses it in place of hardcoded Tier lists for tier filtering.
Carousel data builder and context wiring
ak/homepage.py, ak/views.py
Removes build_get_started_code/HELLO_WORLD_SNIPPET and adds build_library_highlight_carousel(limit=3), combining curated and random libraries into slide dicts; wires result into HomepageView context as library_highlight_carousel.
HomepageSettings model, form, migration
core/models.py, core/migrations/0009_...py
Adds highlighted_libraries M2M field with Wagtail panel, scopes featured_library/highlighted_libraries querysets via FEATURED_LIBRARY_TIERS, and adds the migration.
Demo slides and examples section
core/views.py, templates/v3/examples/_v3_example_section.html
Adds demo_library_highlight_slides context data (Beast, Asio, Hana) and a new example section demonstrating the carousel.
Carousel template markup
templates/v3/includes/_library_highlight_carousel.html
New CSS-only carousel include: radio-state style block, header/nav, translating track, meta row/dots, divider, CTA buttons, and empty state.
Homepage integration and styling
templates/v3/homepage.html, static/css/v3/components.css, static/css/v3/library-highlight-carousel.css, static/css/v3/v3-homepage.css
Replaces the Get Started card include with the carousel include, adds new stylesheet import/definitions (including dark mode), and adjusts masonry grid sizing to accommodate the carousel.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related issues

Possibly related PRs

  • boostorg/website-v2#2480: Overlaps with removal/rework of ak/homepage.py "Get started" pieces and tier selection logic in get_v3_featured_library().

Suggested reviewers: julioest, herzog0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main homepage carousel change.
Description check ✅ Passed The description includes the required issue, context, changes, risks, screenshots, and checklist sections, with concrete implementation and testing details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch julia/library-highlight-carousel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@julhoang
julhoang changed the base branch from develop to julia/homepage-search-popular-terms June 30, 2026 22:36
@julhoang
julhoang force-pushed the julia/library-highlight-carousel branch from 5c91f7a to 249333e Compare June 30, 2026 22:39
@julhoang
julhoang marked this pull request as ready for review July 1, 2026 01:07
@julhoang
julhoang force-pushed the julia/homepage-search-popular-terms branch from 8d97155 to 5f915df Compare July 3, 2026 00:10
@julhoang julhoang linked an issue Jul 3, 2026 that may be closed by this pull request
@jlchilders11
jlchilders11 self-requested a review July 7, 2026 17:13
@herzog0
herzog0 self-requested a review July 7, 2026 17:34

@herzog0 herzog0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Heya! Pre-approving with some optional feedback :)

Comment thread ak/homepage.py Outdated
Comment thread ak/homepage.py Outdated
.order_by("?")
)

remaining_slots = limit - len(libraries)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

limit here won't be enforced if an admin set more than 3 libraries as highlighted, cause remaining_slots will be negative and bypass the filter below. Any issues with that or do you think we should accept as many highlighted libraries as an admin wishes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes I think we should allow admin to highlight more than the limits as there are no harm in it. Does that work with you @herzog0 ?

Comment thread templates/v3/includes/_library_highlight_carousel.html Outdated

@jlchilders11 jlchilders11 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pre approving, couple of small nits for efficiency but great work overall :)

Comment thread ak/homepage.py Outdated
Comment thread ak/homepage.py Outdated
@julhoang
julhoang force-pushed the julia/homepage-search-popular-terms branch from 5f915df to da79fd3 Compare July 8, 2026 19:06
Base automatically changed from julia/homepage-search-popular-terms to develop July 8, 2026 19:11
@julhoang
julhoang force-pushed the julia/library-highlight-carousel branch from cb3e235 to 4a739ca Compare July 9, 2026 18:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
ak/homepage.py (1)

187-187: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

N+1 queries on first_boost_version in the slide loop.

library.first_boost_version executes 3 queries per library (exists(), order_by().first(), and the .version FK access without select_related). With 3 libraries on a high-traffic homepage, that's 9 extra queries per page load — and order_by("?") prevents result caching.

Batch-query the first versions in a single pass instead:

⚡ Proposed batch query to eliminate N+1
     library_versions = {
         lv.library_id: lv
         for lv in LibraryVersion.objects.filter(library__in=libraries, version=latest)
     }

+    # Batch-query the first Boost version per library (replaces per-library first_boost_version calls)
+    first_versions = {}
+    for lv in (
+        LibraryVersion.objects.filter(library__in=libraries)
+        .select_related("version")
+        .order_by("library_id", "version__release_date", "version__name")
+    ):
+        if lv.library_id not in first_versions:
+            first_versions[lv.library_id] = lv.version
+
     slides = []
     for library in libraries:
         lv = library_versions.get(library.id)
-        first_version = library.first_boost_version
+        first_version = first_versions.get(library.id)
         slides.append(
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ak/homepage.py` at line 187, The homepage slide loop is triggering N+1
queries through library.first_boost_version, so replace the per-library lookup
with a batched prefetch/query that resolves first boost versions for all
libraries at once. Update the logic around the slide loop and the
first_boost_version access so it reuses a single query result map instead of
calling exists(), order_by().first(), and version FK loading repeatedly for each
library.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@templates/v3/includes/_library_highlight_carousel.html`:
- Around line 17-53: The single-slide case in library_highlight_carousel
currently skips the inline state rules, so the CSS defaults keep the added-in
text and CTA hidden. Update the template logic around the carousel state styles
and radio-driven overrides so that the visible “Added in” span and documentation
CTA are still shown when total == 1. Use the existing carousel_id, total, and
slide loop in _library_highlight_carousel.html to add a dedicated single-slide
override instead of relying only on the :checked rules.

---

Nitpick comments:
In `@ak/homepage.py`:
- Line 187: The homepage slide loop is triggering N+1 queries through
library.first_boost_version, so replace the per-library lookup with a batched
prefetch/query that resolves first boost versions for all libraries at once.
Update the logic around the slide loop and the first_boost_version access so it
reuses a single query result map instead of calling exists(),
order_by().first(), and version FK loading repeatedly for each library.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a240b474-3690-4637-b243-89f9ce5d0169

📥 Commits

Reviewing files that changed from the base of the PR and between 37dfedd and 4a739ca.

📒 Files selected for processing (12)
  • ak/homepage.py
  • ak/views.py
  • core/migrations/0009_homepagesettings_highlighted_libraries.py
  • core/models.py
  • core/views.py
  • libraries/models.py
  • static/css/v3/components.css
  • static/css/v3/library-highlight-carousel.css
  • static/css/v3/v3-homepage.css
  • templates/v3/examples/_v3_example_section.html
  • templates/v3/homepage.html
  • templates/v3/includes/_library_highlight_carousel.html

Comment thread templates/v3/includes/_library_highlight_carousel.html
@julhoang
julhoang force-pushed the julia/library-highlight-carousel branch from ee51305 to 92173c1 Compare July 9, 2026 21:17
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.

Task: Library Highlight Carousel — Homepage

3 participants