Skip to content

fix(diagram): implement share button functionality with clipboard copy and toast feedback (closes #410)#416

Open
aaryan498 wants to merge 1 commit intoMuneerali199:mainfrom
aaryan498:feature/share-functionality-in-diagram-studio-button
Open

fix(diagram): implement share button functionality with clipboard copy and toast feedback (closes #410)#416
aaryan498 wants to merge 1 commit intoMuneerali199:mainfrom
aaryan498:feature/share-functionality-in-diagram-studio-button

Conversation

@aaryan498
Copy link
Copy Markdown

Fix: Share Button Not Working on Diagram Studio Page

This PR fixes the non-functional Share button on the Diagram Studio page.

Previously, clicking the Share button produced no action or feedback, making it misleading for users who expected a sharing functionality.


Changes Implemented

  • Added a click handler for the Share button

  • Implemented clipboard copy functionality using:

    navigator.clipboard.writeText(window.location.href)
  • Added toast notifications to provide user feedback

    • Success toast when link is copied
    • Error toast if clipboard copy fails
  • Implemented a temporary UI state change:

    • Button text changes to "Link Copied ✓" for 2 seconds after clicking

Result

When the Share button is clicked:

  1. The current page URL is copied to the clipboard
  2. A success toast notification appears
  3. The button text temporarily updates to indicate success

This improves usability and feedback, ensuring the button performs a meaningful action.


Files Modified

app/diagram/page.tsx

UI Behavior After Fix

  • Share button copies the current page link
  • Displays toast notification: "Link copied to clipboard"
  • Button text temporarily changes to "Link Copied ✓"

Screenshots

Code Changes:

Screenshot (841) Screenshot (838)

Before:

Screenshot (850)
  • Share button appeared clickable but performed no action.

After:

Screenshot (840)
  • Clicking the button copies the link and shows feedback.

Testing

Verified that:

  • Clipboard copy works correctly
  • Toast notification appears on success
  • Error handling works if clipboard access fails
  • Button state resets after 2 seconds

Related Issue

Closes #410

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 6, 2026

@aaryan498 is attempting to deploy a commit to the muneerali199's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 6, 2026

👷 Deploy request for docmagic-muneer pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cbf3551

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 6, 2026

👷 Deploy request for docmagic1 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cbf3551

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.

1 participant