Skip to content

[Feature]: Add "Recently Viewed" Models History using LocalStorage #52

@nitishchaubeyy

Description

@nitishchaubeyy

Description

Users often jump between different AI models while researching. To improve navigation, we should implement a "Recently Viewed" section at the bottom of the main directory and model detail pages.

Expected Behavior

  1. Track Views: Create a custom hook useRecentlyViewed() that reads from and writes to the browser's localStorage.
  2. Save History: Whenever a user visits /models/[slug], append that model's basic data (slug, name, avatar) to the localStorage array (keeping a maximum of 5 recent items to avoid bloat).
  3. Display: Create a RecentlyViewed component that maps through this local array and displays mini-cards linking back to those models.
  4. Hydration Safety: Ensure the component only renders on the client side (after useEffect) to prevent Next.js hydration mismatch errors.

Constraints

  • Pure client-side feature. No API routes or Supabase updates needed.
  • Prevent duplicate models from appearing in the history array.

Labels

enhancement, good first issue, frontend, local-storage

I would like to work on this under Nsoc 26 Kindly assign this to me!
@AditthyaSS

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions