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>
|
Warning Review limit reached
More reviews will be available in 39 minutes and 9 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR optimizes image generation from 2K to 1K resolution in Gemini requests with matching test updates, then adds conditional story image rendering to commit pages and PR article components using Next.js Image with consistent 3:2 aspect ratio styling and responsive sizing. ChangesStory image generation and display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
| 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
|
Vercel preview — built from |
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