feat: Add toast feedback for Commit Streaks copy button#711
Conversation
|
@ni2-vsv11 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds user-facing toast notifications for the “copy streak stats” action by integrating the sonner toast library and mounting a global toaster in the app layout.
Changes:
- Add
sonnerdependency and render<Toaster />in the root layout. - Update
handleCopyto useasync/awaitand show success/error toasts. - Improve UX for unsupported clipboard environments with an explicit error toast.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/components/StreakTracker.tsx | Uses sonner to toast success/failure for clipboard copy, refactors copy handler to async/await. |
| src/app/layout.tsx | Adds <Toaster /> so toast messages can render globally. |
| package.json | Adds sonner dependency required for new toast functionality. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| setCopied(true); | ||
|
|
||
| toast.success("Streak stats copied to clipboard!"); | ||
|
|
||
| setTimeout(() => setCopied(false), 2000); |
| `Longest streak: ${data.longest} days`, | ||
| `Active days: ${data.totalActiveDays}` | ||
| ].join('\n'); | ||
| const handleCopy = async () => { |
| } catch { | ||
| toast.error("Failed to copy streak stats."); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Thanks for your first PR on DevTrack! 🎉
A maintainer will review it within 48 hours. While you wait:
- Make sure CI is passing (type-check + lint)
- Double-check the PR description is filled out and the issue is linked
- Feel free to ask questions in Discussions if you need help
If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors!
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
The sonner toast integration is a great improvement, but two issues need fixing before merge:
-
Missing EOF newline in
layout.tsx: The PR removes the trailing newline (}with no newline at end of file). All files must end with a newline — this will block CI. -
Indentation in
StreakTracker.tsx: ThehandleCopyfunction starts at column 0 instead of being indented 2 spaces inside the component body. Please align it with the rest of the component methods.
|
Two issues to fix: 1. Missing EOF newline in 2. Indentation bug in |
b28b5d0 to
94735b7
Compare
9e7e3ef to
00fd2bb
Compare
|
Addressed all requested review changes ✅
Please review again. |
Related Issue
Closes #709
Summary
Added toast feedback for the Commit Streaks copy button to improve user interaction and accessibility.
Changes Made
Testing
Screenshots