feat: add ShareButton component and sonner(Snackbar for notify users)#126
feat: add ShareButton component and sonner(Snackbar for notify users)#126AnitusA wants to merge 4 commits into
Conversation
|
@AnitusA is attempting to deploy a commit to the lamsta Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new ShareButton component that allows users to share a developer portfolio using the Web Share API, falling back to copying the link to the clipboard if the API is unsupported. It also integrates the sonner library for toast notifications. The review feedback focuses on improving the implementation of the ShareButton component. Key recommendations include managing the clipboard copy timeout within a useEffect hook to prevent memory leaks, simplifying the Web Share API check to avoid unnecessary fallbacks, handling expected AbortError exceptions gracefully, and refactoring styles and prop types for better maintainability and adherence to Tailwind CSS best practices.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| TooltipTrigger, | ||
| } from "@/components/ui/tooltip"; | ||
|
|
||
| export default function ShareButton({ username }: { username: string }) { |
There was a problem hiding this comment.
| } catch (err) { | ||
| console.error("Error sharing:", err); | ||
| } |
There was a problem hiding this comment.
When using navigator.share, if the user cancels the share dialog, it throws a DOMException with the name AbortError. This is expected user behavior and not a technical error, so it shouldn't be logged to the console to avoid unnecessary noise.
| } catch (err) { | |
| console.error("Error sharing:", err); | |
| } | |
| } catch (err) { | |
| if (!(err instanceof DOMException && err.name === "AbortError")) { | |
| console.error("Error sharing:", err); | |
| } | |
| } |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>


📝 Description
This PR introduces a native sharing feature for developer portfolios.
✨ New Features
🛠️ Bug Fixes & Improvements
🚀 Technical Changes
📸 UI Changes