stacker.news icon indicating copy to clipboard operation
stacker.news copied to clipboard

adding profile share button

Open pory-gone opened this issue 3 months ago • 6 comments

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

Screenshot_2025-09-23_11_33_34 localhost_3000_(iPhone 14 Pro Max) localhost_3000_(iPhone 14 Pro Max) (1) localhost_3000_(iPhone 14 Pro Max) (2)

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

pory-gone avatar Sep 23 '25 09:09 pory-gone

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: image

You can just re-use the Share component instead of repeating the logic this way.

Soxasora avatar Oct 12 '25 14:10 Soxasora

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

pory-gone avatar Oct 12 '25 17:10 pory-gone

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)

Soxasora avatar Oct 12 '25 17:10 Soxasora

okok i get the point, i'll try a different idea

pory-gone avatar Oct 12 '25 20:10 pory-gone

okok i get the point, i'll try a different idea

pory-gone avatar Oct 12 '25 20:10 pory-gone

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 Share component 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.

Istantanea_2025-10-23_19-27-17 Istantanea_2025-10-23_19-27-43

pory-gone avatar Oct 23 '25 17:10 pory-gone