Repository navigation
feat(content-index): client-side filtering + MusicLibrary songs - #55
Merged
Merged
Conversation
Pulls the current SahajCloud schema, which adds WmWebConfig.audiences (the fixed audience set the public site passes to the lectures /for-audience feed) and the custom-block definitions (ContentIndexBlock with pageFilters/userChoiceFilters/songFilters), both consumed by the content-index filtering work. Also carries unrelated upstream drift (atlas-manager role, Region.slug, Client field renames). Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Asserts all 10 pages.content block types resolve to a converter function, and that no stale converter keys linger. A future CMS block addition now fails a test instead of silently hitting RichText's `unknown` fallback. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The /lectures/:id route (pages/lectures/[id]/(full)/) already exists and matchDocumentRoute already matches it — only the outbound cmsHref builder was stubbed to null. Build /lectures/:id from a document id, mirroring the meditations builder. Also lights up lecture cards in the showcase block (intended). Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Extend the content-index data model for interactive filtering: - ContentIndexBlockFields gains pageFilters/userChoiceFilters/songFilters (CMS schema mirror) and a resolvedTracks field for the songs type. - ResolvedCardItem gains `tags` (facets: page-tag enum labels, or lecture user-choice titles) used by client-side filter pills. - contentIndexCard now routes lectures to /lectures/:id and attaches page/lecture facets; PAGE_TAG_LABELS maps the page-tag enum to labels. - New contentIndexTrack maps a Song doc to an AudioPlayer Track (album credit/artwork, songTag slugs; duration 0 — no CMS field). Also updates the showcase test: lectures now resolve to cards. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Server-side resolution for the interactive content-index: - Widen per-type queries (QUERY_BY_TYPE): pages gain `tags`; songs gain url/tags + album (artist/artwork) and song-tag populate at depth 2; lectures pass the site's audiences to /for-audience. - Branch the resolve: songs → resolvedTracks (MusicLibrary), all other types → resolvedItems (card grid). Shared fetchContentIndexDocs handles the query build + graceful degrade. - ResolveOptions.audiences threads WmWebConfig.audiences from both +data sites; lectures with no audiences short-circuit to empty (the feed 400s on an empty param). Audience ids fold into the cache key. - WEB_CONFIG_SELECT selects `audiences`. Verified against the live CMS: pages/songs return the expected populated shapes; the /for-audience feed returns a fixed player projection with a `thumbnailUrl` string (no `thumbnail` relationship) — so contentIndexCard falls back to `thumbnailUrl` for the lecture card image. That feed omits per-lecture userChoices, so lecture filter pills are gated on an upstream SahajCloud field (follow-up); cards + /lectures/:id links work today. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
New organism for pages/lectures content-index blocks: a server-resolved ContentGrid plus a multi-select filter pill row derived from the items' own tags. SSR renders the full list (SEO-friendly); hydration wires the pill toggles (pure useState, no ClientOnly). - "All" pill clears the selection; facet pills toggle with OR semantics, aria-pressed, and >=44px touch targets (mobile-first). - No pill row when no facets are present (degrades to a plain grid — the current lecture-feed state). - tags are stripped before ContentGrid (ContentCard forwards unknown props to the DOM). - deriveFacets / filterByFacets exported as pure helpers for node-only unit tests; Ladle story covers pills / no-facets / empty. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the single static grid in the content-index converter with a
type switch:
songs → MusicLibrary (playback + its own tag filtering); filters
derived from the tracks' song-tag slugs, each with a
music glyph (SongTag has no icon).
pages/lectures → ContentIndex (filterable card grid with pills)
meditations → static card grid (client filtering deferred)
Empty / unresolved lists still render nothing.
Refs #54
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- content-index: fold the two near-identical resolvers into a generic resolveContentIndex(fields, options, mapper) helper. - cms-blocks: extract the card href type-dispatch into a cardHref helper. - ContentIndex: extract pillClassName; collapse the filter+strip into a single memo. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per code review: contentIndexTrack derived the track thumbnail only from the album's artwork, so a song whose album has no artwork (or an unpublished/bare-id album) lost its thumbnail even when the Song document carries its own thumbnailURL. Select that field and fall back to it. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | eda27af | Commit Preview URL Branch Preview URL |
Jul 01 2026, 08:22 PM |
Closed
2 tasks
Replace ContentIndex's hand-rolled pill buttons with the shared Button atom (shape="square", primary when active / ghost when inactive), via a small internal Pill wrapper. Keeps the >=44px touch target with min-h-11 since Button's `sm` size alone doesn't guarantee it. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
fadeInOnLoad held the whole card at opacity-0 until the thumbnail's onLoad fired — but a card with an empty thumbnailSrc renders a placeholder, not an <img>, so onLoad never fired and the card stayed invisible forever. This surfaced in the content-index grids (ContentGrid forces fadeInOnLoad), where pages/lectures often have no image. Start imageLoaded=true when there's no image src to wait for, and also reveal the card on img onError (broken URL). Adds ContentCard tests. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Instead of a blank card when a CMS thumbnail is missing, render a non-animated teal Placeholder with a centered white Logo in a fixed 16:9 box, so imageless cards read consistently in the grid. Complements the fadeInOnLoad visibility fix. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The Masonry container was a shrink-to-fit flex child (flex justify-center wrapper + max-w-full), so react-masonry-css's 100%/columns widths collapsed to the cards' min-content — filtering to one item (or a short title) shrank the whole grid and its cards (measured: a card dropping from 264px to 47px). Make the wrapper a plain block and the Masonry w-full so columns stay a consistent fraction of the available width regardless of how many items are shown. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Render the pages/lectures content-index (ContentIndex) with the same full-bleed + Container maxWidth="xl" (6xl) treatment as ContentTextBox, so the filterable grid breaks out of the narrow prose column and has more room (measured: grid 864px -> 1120px, cards 264px -> 349px). The full-bleed wrapper owns the vertical spacing, so ContentIndex no longer needs BLOCK_SPACING. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying wemeditate-design with
|
| Latest commit: |
eda27af
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b7e5db33.wm-design.pages.dev |
| Branch Preview URL: | https://feat-content-index-filtering.wm-design.pages.dev |
The songs content-index rendered an empty MusicLibrary: a Song is an upload, and its `url`/`thumbnailURL` are virtual fields the upload afterRead hook derives from `filename`. Without `select[filename]` the CMS returns them null, so `contentIndexTrack` dropped every track (url-less). Same for related image uploads — `populate[images][filename]` lets the album artwork's url compute (a url-only populate returns null). Verified against the live CMS: /music-for-meditation now resolves all 27 tracks with playable audio + album cover art. Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A `type: meditations` block resolves to user-choice *categories* (a
duration/mood picker), not meditation docs — so it 400'd and rendered
nothing. Two fixes:
- Strip any `depth` the CMS bakes into the computed endpoint before
appending ours. Duplicate `depth` params parse to an array and the
backend 400s ("populate required when depth > 1"). Pre-existing on main.
- Widen the meditations query to select each category's four time-of-day
meditation slots (depth 2, populating meditation title/thumbnail/
duration + image filename), then flatten via meditationCardsFromUser
Choices: merge the referenced meditations into a deduped card grid and
tag each with the user-choice(s) that reference it.
The meditations branch now feeds the same ContentIndex organism as
pages/lectures, with the user-choices as filter pills. Verified against
the live CMS: /meditate-now renders 9 meditation cards with 5 min /
5-10 min / 10-15 min pills.
Refs #54
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
From the /finalize-pr code-review pass: - Omit a meditation card's duration badge when it rounds to under a minute (sub-minute `duration`, or an explicit `durationMinutes` of 0) — a "0 min" badge is meaningless. - Fold the block `type` into the content-index cache key so two blocks that share an endpoint+locale can't collide and return the wrong shape from cache (a songs Track[] vs a card list). Refs #54 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
15 tasks
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.
Summary
Makes the
content-indexrich-text block interactive across all four content types: the list is resolved once server-side (SEO-friendly, KV-cached) and filtered client-side with multi-select pills.ContentIndexorganism (masonry card grid + filter pills derived from each item's tags).MusicLibrary(playback + tag filtering); tracks resolve with playable audio + album art.Changes
server/content-index.ts— per-typeselect/populate/depth; strip any CMS-bakeddepthbefore appending ours (duplicatedepthparams 400 the backend);resolveContentIndexnow takes atransform(docs)so meditations can expand 1-category→many-cards;typefolded into the cache key.lib/cms-blocks.ts—contentIndexCard/contentIndexTrackmappers,meditationCardsFromUserChoicesflatten+dedupe, page/lecture facet tags,filename-aware song image resolution.components/organisms/ContentIndex/— new organism; pills built on theButtonatom (square/ghost).components/organisms/RichText/blockConverters.tsx— dispatchcontent-indexby type (songs → MusicLibrary; everything else → ContentIndex).components/molecules/ContentCard/ContentGrid— branded imageless fallback; keep column width independent of item count.lib/cms-routes.ts— enable thelecturesoutbound route builder (/lectures/:id).Test Results
pnpm lint)pnpm exec tsc --noEmit)pnpm test:run)pnpm build)Manual verification
/inspiration(pages) — toggle filter pills; single-item filter keeps card width consistent./music-for-meditation(songs) — MusicLibrary renders all tracks with playable audio; tag filters work./meditate-now(meditations) — grid of meditation cards with "5 min / 5-10 min / 10-15 min" category pills; play buttons link to/meditations/:id.Notes for reviewer
label("Feel harmony-10 min-Neelam") because the meditations' publictitleis null upstream. Not a code bug — clean titles appear once the CMS populatestitle.Song'surl/thumbnailURLare Payload afterRead virtuals derived fromfilename, so the query mustselect[filename](andpopulate[images][filename]) or they returnnulland every track is dropped.userChoices, so lecture pills are dormant until feat(lectures): include per-lecture userChoices in the /for-audience feed SahajCloud#526 lands;WmWebConfig.audiencesis currently empty, so the lectures path is inactive.depth400 on/meditate-nowwas pre-existing onmain; fixed here.Closes #54
🤖 Generated with Claude Code