Skip to content

Add Recently Viewed Companies section to Dashboard - #81

Closed
arnavgoel17 wants to merge 1 commit into
pari-28:mainfrom
arnavgoel17:feat/32-recently-viewed-companies
Closed

arnavgoel17 wants to merge 1 commit into
pari-28:mainfrom
arnavgoel17:feat/32-recently-viewed-companies

Conversation

@arnavgoel17

@arnavgoel17 arnavgoel17 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #32

📌 Related Issue

Closes #32 — [FEAT] Add Recently Viewed Companies Section.


📝 Description

Track recently visited company preparation pages and display them on the dashboard.

Changes

  • src/use-cases/recent-companies.ts (new): pure logic for the feature.
    • pushRecent(list, company, max=5) — pure helper that moves a company to the
      front, drops duplicate ids (by id), and caps to 5 (most-recent-first).
    • getRecentCompanies() — reads & defensively parses localStorage.
    • recordRecentCompany(company) — read/modify/write round-trip to localStorage.
  • src/components/CompanyPrep.tsx: calls recordRecentCompany(company) when a
    user opens a company guide (the "View Guide" click).
  • src/components/Dashboard.tsx: adds a Recently Viewed Companies section
    that loads on mount, lists up to 5 companies (most-recent-first), shows a
    relative "Viewed X minutes ago" recency, handles empty state, and navigates to
    the company tab + records a re-view on click. Reuses the existing dark theme,
    rounded-3xl card, and company-card visual style for consistency.

Acceptance Criteria

  • ✅ Recently viewed companies update correctly (recorded on open).
  • ✅ Maximum of 5 items displayed (enforced in pushRecent cap + .slice(0, 5)).
  • ✅ Responsive UI (grid cards, empty-state fallback, "View all" link).
  • ✅ No duplicate entries (deduped by id in pushRecent).
  • ✅ Persisted using localStorage.

🚀 Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • UI/UX improvement
  • Performance improvement
  • Documentation update
  • Refactoring
  • Security enhancement
  • Breaking change

🧪 Testing

How the changes were validated:

  • Tested locally
  • Existing tests pass (npm test ✓)
  • Added/updated tests (self-check)

npm test on this repo is a smoke stub (0 unit tests found. Smoke test passed.).
Because the repo has no test framework wired up (no vitest/jest config;
self-check.ts lives only on the unmerged #76 branch, not on main), a formal
test suite could not be added without first introducing a new test dependency —
which this issue's scope (frontend-only feature) does not request.

Instead, the pure-domain logic (pushRecent: dedupe-by-id, most-recent-first,
cap-at-5, custom-max) was verified with a throwaway tsx self-check (plain
node:assert), run in-repo and then removed; all assertions passed.

Run: npm run lint (tsc --noEmit), npm run build (vite + esbuild) — both green.

Backend only: no. Frontend only: yes (Dashboard.tsx, CompanyPrep.tsx, new
use-cases/recent-companies.ts).


📸 Screenshots / Demo

N/A — new dashboard card; visually consistent with neighboring "Recently Solved"
section (same bg-slate-900/40 card + rounded-3xl treatment). Empty state shows a
Building2 icon placeholder.

View State
Dashboard, no companies viewed Recently Viewed Companies card with empty-state placeholder
Dashboard, after viewing 3 companies 3 cards listed most-recent-first with recency timestamp
After viewing a 6th company list capped at 5, oldest evicted

✅ Checklist

  • My code follows the project's coding style.
  • I have performed a self-review of my code.
  • I have tested my changes locally.
  • I have not introduced unrelated changes.
  • Documentation has been updated where necessary (inline comments + PR body).
  • My changes do not introduce new warnings or errors (npm run lint clean,
    npm run build clean).
  • This PR is linked to the appropriate issue (Fixes #32).

Pre-Push Checklist

  • npm run lint — clean (tsc --noEmit, exit 0).
  • npm run build — passes (vite 1693 modules transformed, dist emitted).
  • npm test — passes (smoke).
  • Branch is up to date with main (branched fresh from origin/main,
    git diff --stat = 3 files, 139 insertions, 15 deletions).
  • Commits use a clear imperative subject referencing the issue; no
    AI/co-author markers added.
  • Scope isolation respected: only the single repo pari-28/PrepVerse
    touched; only files needed for this issue modified.
  • Scope: Dashboard.tsx, CompanyPrep.tsx, new use-cases/recent-companies.ts —
    frontend only.

Add a localStorage-backed recent companies list (max 5, most-recent-first,
deduplicated) and surface a 'Recently Viewed Companies' section on the
Dashboard that navigates to the company guide when clicked.

Closes pari-28#32
@arnavgoel17
arnavgoel17 requested a review from pari-28 as a code owner August 28, 2026 14:32
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@arnavgoel17 is attempting to deploy a commit to the Pari's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the frontend Frontend development label Aug 28, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale because it has been inactive for 30 days. It will be closed in 7 days if no further activity occurs.

@github-actions github-actions Bot added the stale label Sep 28, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Closing this pull request due to inactivity.

@github-actions github-actions Bot closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend development stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add Recently Viewed Companies Section

1 participant