Skip to content

feat: Implement RecentActivity feed on dashboard - #30

Open
derekliutao-cmd wants to merge 2 commits into
coopfinance:mainfrom
derekliutao-cmd:feat/recent-activity-feed
Open

feat: Implement RecentActivity feed on dashboard#30
derekliutao-cmd wants to merge 2 commits into
coopfinance:mainfrom
derekliutao-cmd:feat/recent-activity-feed

Conversation

@derekliutao-cmd

Copy link
Copy Markdown
Contributor

Summary

Closes #2

Implements the RecentActivity component on the dashboard as specified in the bounty issue.

Changes

src/types/index.ts — Added NotificationType and Notification interfaces.

src/components/dashboard/recent-activity.tsx — Full implementation:

  • ✅ Fetches notifications via React Query (useQuery) keyed on connected wallet address
  • ✅ Scrollable feed with 4 distinct activity type icons (💰 contribution, 🏧 loan, 🗳️ vote, 📤 distribution) using lucide-react
  • ✅ Relative timestamps via date-fns formatDistanceToNow
  • ✅ Subtle separator lines between items
  • ✅ "Connect your wallet to see activity" state when no wallet connected
  • ✅ "No recent activity" empty state
  • ✅ "Mark all read" button (calls PATCH /api/notifications/:id/read) shown only when unread items exist
  • ✅ Unread indicators (blue dot + subtle background highlight)
  • ✅ Mock data included with clear // TODO: connect to API comments for backend integration
  • ✅ No TypeScript errors (valid TS, correct imports)

Implementation Notes

  • Uses existing project dependencies only (@tanstack/react-query, date-fns, lucide-react, axios)
  • Follows existing codebase patterns (same styling, component structure, hook usage)
  • The markAllRead mutation invalidates the query cache for automatic refresh
  • Loading and error states handled gracefully

@derekliutao-cmd

Copy link
Copy Markdown
Contributor Author

Hi @Mona-i! I noticed PR #23 (merged) also touched the RecentActivity component. My PR #30 provides a standalone, focused implementation with:

  • React Query for data fetching with 60s auto-refresh
  • Separate markAllRead mutation with cache invalidation
  • Proper loading/empty states
  • Mock data with clear TODO comments for API integration

Happy to adjust if there's any overlap concern. Thanks for reviewing!

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.

[Frontend] Implement RecentActivity feed on dashboard

1 participant