fix(site): show story illustrations on detail views + generate 1K images#67
Conversation
PRArticle (side panel + full PR page) and the commit detail page showed the headline, standfirst, and body but never rendered story.imageUrl, so images appeared only in the feed. Add the 3:2 illustration after the standfirst on both, matching PRFeedItem's Image usage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2K (~2048px) exceeds our largest render (feed hero 720px CSS / ~1440px retina; side panel ~480px), costing ~50% more per image ($0.101 vs $0.067) and producing heavier Blob uploads for resolution we never show. 1K covers all display sizes. Per the Gemini docs, gemini-3.1-flash-image may already cap the preview model at 1K regardless, so this also aligns intent with actual output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| site/src/components/PRArticle.tsx | Adds conditional image block after standfirst; correctly uses fill+aspect-ratio container, variant-aware sizes hint, and priority={variant==='page'} to address LCP on the full-page view. |
| site/src/app/commit/[sha]/[slug]/page.tsx | Mirrors the PRArticle image block for the commit detail route; sizes hint (672px) matches the max-w-2xl container; priority is always set since this is always a full-page render. |
| cli/src/image/generator.ts | Switches imageSize from '2K' to '1K' with a clear comment; aligns with display sizes (max 720px CSS / ~1440px on 2x) and reduces generation cost. |
| cli/src/image/generator.test.ts | Test expectation updated from '2K' to '1K' to match the generator change; no other test logic affected. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[story.imageUrl?] -->|undefined| B[Skip image block]
A -->|present| C[Render image container\naspectRatio 3/2, relative, overflow-hidden]
C --> D{Which component?}
D -->|PRArticle variant=panel| E[sizes: 480px\npriority: false\nlazy-loaded]
D -->|PRArticle variant=page| F[sizes: 720px\npriority: true\npreloaded]
D -->|CommitStoryPage| G[sizes: 672px\npriority: true\npreloaded]
E --> H[next/image fill + object-cover + unoptimized]
F --> H
G --> H
Reviews (2): Last reviewed commit: "perf(site): eager-load the above-the-fol..." | Re-trigger Greptile
The full-page/commit detail illustration sits above the fold and is a likely LCP element; without priority Next.js lazy-loads it, delaying the largest paint. Set priority on the page variant and commit detail image (adds a preload hint); the side panel stays lazy since it can open below the fold. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
Two related image fixes.
1. Illustrations missing from story detail views
PRArticle(the side panel and the full PR page) and the commit detail page rendered headline → standfirst → body but never referencedstory.imageUrl— only the feed (PRFeedItem) did. So feature images showed in the feed but vanished the moment you opened a story.site/src/components/PRArticle.tsx— renders the 3:2 illustration after the standfirst (covers the side panel viavariant="panel"and the full PR page viavariant="page").site/src/app/commit/[sha]/[slug]/page.tsx— same, for the commit detail page (which renders its own layout, notPRArticle).Both reuse
PRFeedItem'snext/imagesetup (fill,object-cover,unoptimized, 3:2 aspect).2. Generate 1K images instead of 2K
generator.tsrequestedimageSize: '2K'. Our largest render is the feed hero at 720px CSS (~1440px on a 2× display); the side panel is ~480px. 2K (~2048px) is bigger than anything we display, costs ~50% more per image ($0.101 → $0.067 on Gemini 3.1 Flash Image), and makes heavier Blob uploads. Switched to1K, which fully covers our display sizes.Per the Gemini image docs + pricing, and a forum report that the preview model may cap at 1K anyway — so this also aligns intent with actual output.
aspectRatio: '3:2'is unchanged (and a supported value).Test plan
yarn workspace @gitpulse/cli test— 138 passed (updated generator test asserts1K)yarn workspace @gitpulse/site typecheck— cleanNote: existing stories keep their already-generated (2K)
imageUrls — the 1K size applies to newly generated images.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests