Skip to content

Add a recently-viewed commitments rail to the My Commitments page #968

Description

@1nonlypiece

📌 Description

There's a recently-viewed concept for the marketplace, but the My Commitments page (src/app/commitments/page.tsx) has none, so jumping back to a commitment you just inspected requires re-finding it in the grid.

This issue adds a recently-viewed commitments rail scoped to the user's own commitments.

🎯 Requirements and Context

This is a feature / enhancement task for the CommitLabs frontend (Next.js + TypeScript). It must be implemented cleanly, fully typed, accessible, and well tested — and must not regress existing behavior.

  • Track recently-viewed commitment ids (bounded, deduped) and render a rail above/within the page.
  • Each entry navigates to the detail page; reuse compact card primitives.
  • Handle entries for commitments no longer present gracefully.
  • Persist locally; keyboard navigable rail.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b feature/my-commitments-recently-viewed

2. Implement the change

  • Primary files to add or modify:
    • src/app/commitments/page.tsx — recently-viewed rail.
    • src/components/RecentlyViewedCommitments.tsx — new component.
    • src/app/commitments/[id]/page.tsx — record view.
  • Add focused tests in src/components/RecentlyViewedCommitments.test.tsx using Jest / Vitest + React Testing Library (happy-dom), covering rendering, interaction, and the edge cases below.
  • Add documentation in docs/RECENTLY_VIEWED.md describing the feature, props/API, accessibility behavior, and a usage example; cross-link it from the relevant README/docs.
  • Keep the diff small and reviewer-friendly; reuse existing primitives, hooks, and the typed API client instead of duplicating logic.

3. Cover edge cases

  • records on detail view
  • bounded + deduped
  • missing commitment handled
  • rail keyboard navigable

4. Test and commit

  • Run the suite (e.g. pnpm test / pnpm vitest run) and ensure new lines are covered.
  • Verify keyboard navigation, focus handling, and prefers-reduced-motion where relevant.

Example commit message

feat: recently-viewed commitments rail

✅ Guidelines

  • Minimum 95% test coverage on the new/changed lines.
  • Clear, reviewer-friendly documentation (props/API + usage example + accessibility notes).
  • No regressions to existing components, routes, or tests.
  • Fully typed (no any), accessible (labels, roles, live regions where relevant).
  • Timeframe: 96 hours.

🏷️ Labels

type-feature · type-enhancement · area-frontend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the CommitLabs contributor Discord to coordinate, ask questions, and get unblocked fast: https://discord.gg/WV7tdYkJk
  • Please introduce yourself in the channel before you start so we can avoid duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful reviews — reach out any time you're blocked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions