Skip to content

feat: add recently viewed snippets dashboard section #128 - #140

Open
Cashman-Exchange wants to merge 1 commit into
SudiptaPaul-31:mainfrom
Cashman-Exchange:fix/issue-128-recently-viewed-snippets
Open

feat: add recently viewed snippets dashboard section #128#140
Cashman-Exchange wants to merge 1 commit into
SudiptaPaul-31:mainfrom
Cashman-Exchange:fix/issue-128-recently-viewed-snippets

Conversation

@Cashman-Exchange

Copy link
Copy Markdown
Contributor

Overview

This PR adds a Recently Viewed Snippets section on the dashboard so users can quickly reopen snippets they opened earlier. History is persisted across sessions in localStorage, with a clear-history action and a graceful empty state.

Related Issue

Closes #128

Changes

🕒 Recently Viewed Persistence

  • [ADD] lib/recent-snippets-storage.ts

    • Client-side localStorage history (codely_recent_snippets).
    • Dedupes by snippet id, keeps newest first, caps at 12 entries.
    • Supports record / read / clear with corrupt-payload safety.
  • [ADD] lib/recent-snippets-storage.test.ts

    • Coverage for empty state, dedupe, max size, clear, and invalid storage payloads.

📊 Dashboard UI

  • [ADD] app/dashboard/page.tsx

    • New dashboard page with quick links and the Recently Viewed section.
  • [ADD] components/RecentlyViewedSnippets.tsx

    • Responsive card grid, relative “viewed” timestamps, click-to-reopen links (/snippets#id).
    • Empty state with browse CTA.
    • Clear history action.

🔗 View Tracking & Reopen

  • [MODIFY] app/snippets/page.tsx

    • Restored the empty snippets page (required for reopen).
    • Records a recent view when a snippet is opened/edited.
    • Supports /snippets#id deep links from dashboard and collections.
  • [MODIFY] app/collections/page.tsx

    • Records a recent view when using Collection View.
  • [MODIFY] components/Sidebar.tsx

    • Adds Dashboard nav item; removes duplicate Collections entry.
  • [MODIFY] components/WalletConnect.tsx

    • Removes orphaned duplicate code that prevented the app from compiling/booting.

Verification Results

npx jest lib/recent-snippets-storage.test.ts --testEnvironment=node --no-coverage
✅ 6/6 passed

Live acceptance check:
✅ /dashboard 200 — Recently Viewed section present
✅ /snippets 200 — reopen + view recording wired
✅ Empty state + Clear history available in client bundle
✅ Persistence smoke: record → reorder/dedupe → clear
Acceptance Criteria Status
Visible on dashboard ✅ Recently Viewed section on /dashboard
Clickable entries ✅ Cards link to /snippets#id and reopen
Persistent history ✅ localStorage across sessions until cleared
Clear option available ✅ Clear history button
Graceful empty state ✅ Placeholder + browse CTA when empty

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Cashman-Exchange is attempting to deploy a commit to the Sudipta 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Cashman-Exchange Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Recently Viewed Snippets Section

1 participant