adding profile share button
Description
fix #2573
Added a profile sharing feature that allows users to share profile links across all platforms.
- Share button in the user header component visible on all user profiles
- Share option in the action dropdown menu for viewing other users' profiles
- Smart referral logic that adds referral links (
/r/{username}) only when sharing via mobile Web Share API - Cross-platform compatibility with Web Share API on touch devices and clipboard copy fallback on desktop
Screenshots
Additional Context
The implementation reuses existing share infrastructure from share.js for consistency
Checklist
Are your changes backward compatible? Please answer below: Yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below: 7/10
For frontend changes: Tested on mobile, light and dark mode? Please answer below: Yes
Did you introduce any new environment variables? If so, call them out explicitly here: NaN
Did you use AI for this? If so, how much did it assist you? i used AI to check if a share-logic was already implemented
I personally don't like having two share buttons, have you considered getting inspiration from posts?
So something like this, but maybe you can find a better placement:
You can just re-use the Share component instead of repeating the logic this way.
I understand! With this new implementation I reuse the share component and I eliminated the share profile button stand-alone, adding the button for the function in the drop-down menu. If you prefer something more similar to what you recommended, I'll get to work.
It's pretty good, I don't know how to feel about the icon in the dropdown but it's okay. What about your own profile? This way the user can't share their profile (unless they grab the URL)
okok i get the point, i'll try a different idea
okok i get the point, i'll try a different idea
I've updated the implementation. I was thinking of a mix of what you showed me and the one similar to the one on posts, I'm not sure about the icon yet.
- Removed the duplicated logic in
ShareProfileDropdownItem - Reused the existing
Sharecomponent instead of repeating code - Added a share button next to "edit nym" so users can share their own profile
- Kept the dropdown option for sharing other users' profiles
The share button now works consistently with how it's implemented for posts. Let me know if you want any other changes.