feat(homepage): 'What's Happening Now' activity feed widget#12863
feat(homepage): 'What's Happening Now' activity feed widget#12863mekarpeles wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “What’s Happening Now” homepage section powered by a Lit web component and a new internal FastAPI endpoint, intended to show recent public reading-log activity in a rotating 3-card feed.
Changes:
- Added a homepage partial (
home/activity_feed.html) and wired it into the homepage template. - Introduced
GET /api/internal/activity.jsonto return recent public reading-log activity enriched with Solr work metadata. - Added and exported a new Lit component
<ol-activity-feed>that fetches/paginates and renders the activity cards, including a Follow action.
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 |
|---|---|
| openlibrary/templates/home/index.html | Inserts the new activity-feed partial into the homepage layout. |
| openlibrary/templates/home/activity_feed.html | Defines the homepage section wrapper and instantiates <ol-activity-feed>. |
| openlibrary/fastapi/internal/api.py | Adds the new activity feed JSON endpoint and response models. |
| openlibrary/components/lit/OLActivityFeed.js | Implements the Lit activity feed component, auto-advance behavior, and follow button logic. |
| openlibrary/components/lit/index.js | Exports the new Lit component. |
fdf0bbe to
e090359
Compare
Adds a sliding-window activity feed to the Open Library homepage showing recent public reading log activity. Three vertically-stacked cards are shown at once, auto-advancing every 15 seconds. Patrons can follow each other directly from the feed. - FastAPI endpoint: GET /api/internal/activity.json (paginated, public-only) - Lit web component: <ol-activity-feed> with auto-advance timer and manual navigation; exhausted queue shows "More →" link to /trending - Homepage partial: home/activity_feed.html wired into home/index.html - Filters to public reading logs only (public_readlog preference check) - Solr enrichment for title/cover/author via add_solr_works_async Closes #12861
…ow DOM Replace hardcoded hex values with CSS custom properties from the OL token system (--primary-blue, --link-blue, --white, --dark-grey, --border-radius-*, --font-size-body-medium) so the component tracks the design system automatically. Fallback values keep the component functional in any context that hasn't loaded the token stylesheet. [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
- Use `.isoformat()` for datetime fields so `new Date()` parses reliably across all browsers (was: str() → "YYYY-MM-DD HH:MM:SS", non-ISO) - Add `viewer-username` attribute to <ol-activity-feed>; pass it from the homepage partial via ctx.user — document.body.dataset.username is only set for librarians/admins on specific pages, not the homepage - Follow URL: use `/follows.json` to match the delegate route encoding (was: `/follows` which does not resolve via web.py delegate) - Move Bookshelves import to module level; add noqa for `import web` which must be deferred (infogami request context not available at load)
e090359 to
368b807
Compare
|
Hi — I'm Pierre, an AI-assisted PR health agent running on behalf of @mekarpeles. Resolved a merge conflict in Master had added: from openlibrary.core.bestbook import Bestbook
from openlibrary.core.follows import PubSubThis branch added: from openlibrary.core.bookshelves import BookshelvesResolution: kept all three imports in alphabetical order. All three are actively used in the file (verified before resolving). This was a pure import-ordering conflict with no semantic ambiguity. Safeguards: Confirmed all commits authored by @mekarpeles. Zero unresolved review threads. Used To reverse: |
Summary
Adds a mobile-first "What's Happening Now" activity feed to the Open Library homepage, showing recent public reading log activity in a sliding 3-card window.
GET /api/internal/activity.json— paginated, filters to patrons withpublic_readlog: yes, Solr-enriched with title/cover/author<ol-activity-feed>— 3 stacked cards, auto-advances every 15s, manual right-arrow advance, "More →" link to/trendingwhen exhausted. Uses design system CSS tokens (--primary-blue,--border-radius-*, etc.) for all interactive elements.home/activity_feed.htmlwired intohome/index.htmlbetween the welcome section and trending carouselPOST /people/{key}/follows, redirects anonymous users to loginCloses
Closes #12861
Related
Files changed
openlibrary/fastapi/internal/api.pyGET /api/internal/activity.jsonendpointopenlibrary/components/lit/OLActivityFeed.js<ol-activity-feed>Lit componentopenlibrary/components/lit/index.jsopenlibrary/templates/home/activity_feed.htmlopenlibrary/templates/home/index.htmlAPI response shape
{ "activity": [ { "type": "shelf_change", "shelf_id": 2, "shelf_label": "is Currently Reading", "username": "jsmith", "avatar_url": "https://...", "work_key": "/works/OL123W", "title": "The Great Gatsby", "cover_id": 12345, "author": "F. Scott Fitzgerald", "updated": "2026-06-04T12:00:00" } ], "page": 1 }Verification
JS build: webpack compiled with 0 errors (
make js)Linting: ruff ✅, eslint ✅, codespell ✅
except A, B:Python 2 syntax incore/db.py(and other files) causes aSyntaxErroron startup. This is unrelated to our 5 changed files. Tracking in #12861 comment.Checklist
internal/api.pypublic_readlog: yespatrons