Skip to content

feat(frontend): responsive stats grid and recently viewed improvements (#706)#741

Merged
ericsocrat merged 3 commits intomainfrom
feat/706-dashboard-responsive
Mar 8, 2026
Merged

feat(frontend): responsive stats grid and recently viewed improvements (#706)#741
ericsocrat merged 3 commits intomainfrom
feat/706-dashboard-responsive

Conversation

@ericsocrat
Copy link
Owner

Summary

Closes #706 — Makes the dashboard responsive for mobile and adds a "View all" link with horizontal scrolling for the recently viewed section.

Changes

Stats Grid (responsive)

  • Changed from fixed grid-cols-4 to grid-cols-2 gap-2 sm:grid-cols-4 sm:gap-3 — 2 columns on mobile, 4 on desktop

Recently Viewed Section

  • Added "View all →" link in header (uses existing dashboard.viewAll i18n key, links to /app/search)
  • Changed product list to horizontal scroll on mobile (flex overflow-x-auto snap-x snap-mandatory) with min-w-[280px] cards
  • Reverts to vertical layout on sm: breakpoint (sm:flex-col sm:overflow-visible)

Already Complete (no changes needed)

  • Quick actions — already responsive (grid-cols-2 sm:grid-cols-4)
  • Empty stateEmptyDashboard component already exists with scan + browse CTAs
  • Welcome greetingDashboardGreeting component already exists
  • i18n keysdashboard.viewAll already present in en/pl/de

Verification

npx tsc --noEmit        → 0 errors
npx vitest run page     → 22/22 tests pass (3 new/updated)

Tests Added/Updated

  • Updated: "renders stats grid with responsive 2-col mobile / 4-col desktop classes" — asserts grid-cols-2 and sm:grid-cols-4
  • New: "renders 'View all' link in recently viewed section" — asserts link text and href
  • New: "renders recently viewed list with horizontal scroll container" — asserts overflow-x-auto and snap-x classes

Files Changed

File Change
frontend/src/app/app/page.tsx Responsive stats grid + recently viewed horizontal scroll + "View all" link
frontend/src/app/app/page.test.tsx 1 updated + 2 new tests

Copilot AI review requested due to automatic review settings March 7, 2026 22:37
@vercel
Copy link

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tryvit Ready Ready Preview, Comment Mar 8, 2026 9:26am

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the dashboard’s mobile responsiveness by adjusting the stats grid layout and making the “Recently viewed” section easier to browse on small screens, while adding a “View all” navigation affordance.

Changes:

  • Updated the stats grid to use a 2-column layout on mobile and 4 columns on larger breakpoints.
  • Added a “View all →” link to the Recently Viewed header (links to /app/search).
  • Switched Recently Viewed items to a horizontal, snap-scrolling list on mobile, reverting to a vertical list at sm:.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
frontend/src/app/app/page.tsx Makes stats grid responsive; adds “View all” link; converts recently viewed list to horizontal scroll on mobile.
frontend/src/app/app/page.test.tsx Updates/adds tests to assert responsive grid classes, “View all” link, and horizontal scroll container.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Bundle Size Report

Metric Value
Main baseline 3471 KB
This PR 3471 KB
Delta +0 KB (+0.0%)
JS chunks 135
Hard limit 4000 KB

✅ Bundle size is within acceptable limits.

Copilot AI review requested due to automatic review settings March 8, 2026 09:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

</h2>
<Link
href="/app/search"
className="text-sm font-medium text-brand-primary hover:underline"
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “View all” link only has a hover style; keyboard users won’t get an equivalent focus affordance. Consider adding a focus-visible: style (e.g., underline and/or focus ring) so the link is clearly visible when tabbed to.

Suggested change
className="text-sm font-medium text-brand-primary hover:underline"
className="text-sm font-medium text-brand-primary hover:underline focus-visible:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-brand-primary"

Copilot uses AI. Check for mistakes.
subtitle={new Date(p.viewed_at).toLocaleDateString()}
allergenWarnings={allergenMap[p.product_id] ?? []}
/>
<div key={p.product_id} className="min-w-[280px] flex-shrink-0 snap-start sm:min-w-0 sm:flex-shrink">
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The responsive class sm:flex-shrink may not exist depending on the Tailwind version/config (common utilities are shrink / shrink-0 in newer Tailwind). If it’s not recognized, flex-shrink-0 will remain in effect at sm: and up. Use the project’s standard shrink utility (e.g., sm:shrink) or otherwise ensure the responsive override is a valid Tailwind class.

Suggested change
<div key={p.product_id} className="min-w-[280px] flex-shrink-0 snap-start sm:min-w-0 sm:flex-shrink">
<div key={p.product_id} className="min-w-[280px] flex-shrink-0 snap-start sm:min-w-0 sm:shrink">

Copilot uses AI. Check for mistakes.
Comment on lines +205 to +212
it("renders 'View all' link in recently viewed section", async () => {
render(<DashboardPage />, { wrapper: createWrapper() });
await waitFor(() => {
expect(screen.getByText(/Recently Viewed/)).toBeInTheDocument();
});
const viewAllLink = screen.getByText("View all →").closest("a");
expect(viewAllLink).toHaveAttribute("href", "/app/search");
});
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getByText(...).closest("a") is brittle and can yield null (leading to less clear failures) if the markup changes (e.g., the text is wrapped/split). Prefer querying the anchor directly via getByRole("link", { name: "View all →" }) (or a case-insensitive regex name) to make the test more robust and readable.

Copilot uses AI. Check for mistakes.
@ericsocrat ericsocrat merged commit 8b6f87b into main Mar 8, 2026
16 of 18 checks passed
@ericsocrat ericsocrat deleted the feat/706-dashboard-responsive branch March 8, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(frontend): dashboard — responsive stats grid, quick actions, and new user empty state

2 participants