mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-30 20:45:36 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
20 lines
767 B
TypeScript
20 lines
767 B
TypeScript
import {ENV_CONFIG} from 'common/envs/constants'
|
|
import {CopyLinkOrShareButton} from 'web/components/buttons/copy-link-button'
|
|
import {useUser} from 'web/hooks/use-user'
|
|
import {useT} from 'web/lib/locale'
|
|
|
|
export const ShareProfileButton = (props: {username: string; className?: string}) => {
|
|
const {username, className} = props
|
|
const currentUser = useUser()
|
|
const t = useT()
|
|
const shareUrl = currentUser
|
|
? `https://${ENV_CONFIG.domain}/${username}?referrer=${currentUser.username}`
|
|
: `https://${ENV_CONFIG.domain}/${username}`
|
|
|
|
return (
|
|
<CopyLinkOrShareButton className={className} url={shareUrl} eventTrackingName="shareprofile">
|
|
<div className="ml-2 text-sm">{t('button.share.label', 'Share')}</div>
|
|
</CopyLinkOrShareButton>
|
|
)
|
|
}
|