feat(dashboard): RecentlyViewed enrichment — images, NutriScore badges, time pills (#964)#970
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📸 PR ScreenshotsCaptured 6 screenshots (3 mobile, 3 desktop) for 3 changed page(s):
📥 Download screenshots from workflow artifacts. Captured by PR Screenshots workflow • 2026-03-19 |
Bundle Size Report
✅ Bundle size is within acceptable limits. |
There was a problem hiding this comment.
Pull request overview
This PR enriches the dashboard’s RecentlyViewed compact list by adding product thumbnails, Nutri-Score badges, a styled relative-time pill, and staggered entrance animations, along with an updated “View history” link label and new i18n strings.
Changes:
- Render OFF thumbnail images (via
next/image) with a fallback when no image is available. - Show
NutriScoreBadge(sm) whennutri_score_labelis present; style the relative time as a pill. - Add
animate-slide-in-rightwith per-row staggered delays; rename “View all” to “View history” and add i18n keys/tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/styles/globals.css | Adds --animate-slide-in-right motion token and reformats existing keyframes blocks. |
| frontend/src/components/dashboard/RecentlyViewed.tsx | Adds thumbnail + NutriScore badge + time pill; wraps rows for staggered slide-in animation; updates link label to dashboard.viewHistory. |
| frontend/src/components/dashboard/RecentlyViewed.test.tsx | Adds tests for image rendering/fallback, NutriScoreBadge presence, time pill styling, and staggered animation delay; updates link text expectation. |
| frontend/messages/en.json | Adds dashboard.viewHistory translation. |
| frontend/messages/pl.json | Adds dashboard.viewHistory translation. |
| frontend/messages/de.json | Adds dashboard.viewHistory translation. |
| <Link | ||
| href="/app/search" | ||
| className="inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline" | ||
| > | ||
| {t("dashboard.viewAll")} | ||
| {t("dashboard.viewHistory")} | ||
| <ArrowRight className="h-3 w-3" aria-hidden="true" /> | ||
| </Link> |
| return ( | ||
| <Link | ||
| <div | ||
| key={product.product_id} | ||
| href={`/app/product/${product.product_id}`} | ||
| data-testid="recently-viewed-item" | ||
| className="card hover-lift-press flex items-center gap-3 px-3 py-2.5 transition-shadow hover:shadow-md" | ||
| className="animate-slide-in-right" | ||
| style={{ animationDelay: `${index * 30}ms`, animationFillMode: "both" }} | ||
| > |
| {/* Product thumbnail or score circle fallback */} | ||
| {product.image_thumb_url ? ( | ||
| <Image | ||
| src={product.image_thumb_url} | ||
| alt={product.product_name} | ||
| width={36} | ||
| height={36} | ||
| className="h-9 w-9 shrink-0 rounded-lg object-cover" | ||
| loading="lazy" | ||
| /> | ||
| ) : ( | ||
| <div | ||
| className={`flex h-9 w-9 shrink-0 items-center justify-center rounded-full ${band?.bgColor ?? "bg-muted"}`} | ||
| > | ||
| <span | ||
| className={`text-xs font-bold tabular-nums ${band?.textColor ?? "text-foreground-secondary"}`} | ||
| > | ||
| {tryVit ?? "–"} | ||
| </span> | ||
| </div> | ||
| )} |
Summary
Enriches the RecentlyViewed compact list with product thumbnail images, NutriScore badges, styled time pills, and staggered slide-in-right animations.
Changes
Tests
Closes #964