diff --git a/components/share.js b/components/share.js index 26f459f23..3f6f7f60c 100644 --- a/components/share.js +++ b/components/share.js @@ -98,3 +98,22 @@ export function CrosspostDropdownItem ({ item }) { ) } + +export function ShareProfileDropdownItem ({ user }) { + const { me } = useMe() + const toaster = useToast() + const url = referrurl(`/${user.name}`, me) + + return ( + { + await share(`@${user.name}'s profile on Stacker News`, url, toaster) + }} + > + + share profile + + ) +} + +export { referrurl, share } diff --git a/components/user-header.js b/components/user-header.js index ef30f15e2..7331e9960 100644 --- a/components/user-header.js +++ b/components/user-header.js @@ -31,6 +31,7 @@ import GithubIcon from '@/svgs/github-fill.svg' import TwitterIcon from '@/svgs/twitter-fill.svg' import { UNKNOWN_LINK_REL } from '@/lib/constants' import ItemPopover from './item-popover' +import Share, { ShareProfileDropdownItem } from './share' const MEDIA_URL = process.env.NEXT_PUBLIC_MEDIA_URL || `https://${process.env.NEXT_PUBLIC_MEDIA_DOMAIN}` @@ -182,8 +183,12 @@ function NymView ({ user, isMe, setEditting }) { return (
@{user.name}
- {isMe && - } + {isMe && ( + <> + + + + )} {!isMe && me && }
) @@ -193,6 +198,7 @@ export function NymActionDropdown ({ user, className = 'ms-2' }) { return (
+