Skip to content

feat: Add toast feedback for Commit Streaks copy button#711

Open
ni2-vsv11 wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
ni2-vsv11:enhancement/commit-streak-toast
Open

feat: Add toast feedback for Commit Streaks copy button#711
ni2-vsv11 wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
ni2-vsv11:enhancement/commit-streak-toast

Conversation

@ni2-vsv11
Copy link
Copy Markdown

Related Issue

Closes #709

Summary

Added toast feedback for the Commit Streaks copy button to improve user interaction and accessibility.

Changes Made

  • Added success toast notification after successful copy action
  • Added error toast notification when clipboard copy fails
  • Preserved existing UI and button behavior
  • Improved feedback consistency across interactions

Testing

  • Tested successful clipboard copy locally
  • Tested clipboard failure handling
  • Verified no UI regressions

Screenshots

image

Copilot AI review requested due to automatic review settings May 22, 2026 12:05
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@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.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 22, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sonner dependency and render <Toaster /> in the root layout.
  • Update handleCopy to use async/await and 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.

Comment thread src/components/StreakTracker.tsx Outdated
Comment on lines +302 to +306
setCopied(true);

toast.success("Streak stats copied to clipboard!");

setTimeout(() => setCopied(false), 2000);
Comment thread src/components/StreakTracker.tsx Outdated
`Longest streak: ${data.longest} days`,
`Active days: ${data.totalActiveDays}`
].join('\n');
const handleCopy = async () => {
Comment thread src/components/StreakTracker.tsx Outdated
} catch {
toast.error("Failed to copy streak stats.");
}
};
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sonner toast integration is a great improvement, but two issues need fixing before merge:

  1. 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.

  2. Indentation in StreakTracker.tsx: The handleCopy function starts at column 0 instead of being indented 2 spaces inside the component body. Please align it with the rest of the component methods.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Two issues to fix:

1. Missing EOF newline in src/app/layout.tsx
The diff ends with +}\ No newline at end of file. Please add a trailing newline.

2. Indentation bug in StreakTracker.tsx
const handleCopy = async () => { is at column 0 instead of 2 spaces. It's inside the component body — please indent it correctly.

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level:beginner GSSoC: Beginner difficulty (20 pts) labels May 23, 2026
@ni2-vsv11 ni2-vsv11 force-pushed the enhancement/commit-streak-toast branch from b28b5d0 to 94735b7 Compare May 23, 2026 19:10
@ni2-vsv11 ni2-vsv11 force-pushed the enhancement/commit-streak-toast branch from 9e7e3ef to 00fd2bb Compare May 23, 2026 19:21
@ni2-vsv11
Copy link
Copy Markdown
Author

Addressed all requested review changes ✅

  • Fixed indentation in StreakTracker.tsx
  • Added trailing newline in layout.tsx
  • Resolved merge conflicts with latest main

Please review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:beginner GSSoC: Beginner difficulty (20 pts) type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] [Enhancement] Add toast feedback for Commit Streaks copy button

3 participants