diff --git a/src/react-components/invite-dialog.js b/src/react-components/invite-dialog.js index f28fcf7f0549fe48a9a6bf0522f8129454630918..aa5c511bc6da6f8b41c1d08222ea4d0fec7eb512 100644 --- a/src/react-components/invite-dialog.js +++ b/src/react-components/invite-dialog.js @@ -42,12 +42,13 @@ export default class InviteDialog extends Component { const { entryCode } = this.props; const entryCodeString = pad(entryCode, 6); - const shareLink = `hub.link/${entryCodeString}`; + const shareShortLink = `hub.link/${entryCodeString}`; + const shareFullLink = [location.protocol, "//", location.host, location.pathname].join(""); const tweetText = `Join me now in #hubs!`; - const tweetLink = `https://twitter.com/share?url=${encodeURIComponent( - "https://" + shareLink - )}&text=${encodeURIComponent(tweetText)}`; + const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(shareFullLink)}&text=${encodeURIComponent( + tweetText + )}`; return ( <div className={styles.dialog}> @@ -73,15 +74,15 @@ export default class InviteDialog extends Component { <FormattedMessage id="invite.or_visit" /> </div> <div className={styles.domain}> - <input type="text" readOnly onFocus={e => e.target.select()} value={shareLink} /> + <input type="text" readOnly onFocus={e => e.target.select()} value={shareShortLink} /> </div> <div className={styles.buttons}> - <button className={styles.linkButton} onClick={this.copyClicked.bind(this, "https://" + shareLink)}> + <button className={styles.linkButton} onClick={this.copyClicked.bind(this, "https://" + shareShortLink)}> <span>{this.state.copyButtonActive ? "copied!" : "copy"}</span> </button> {this.props.allowShare && navigator.share && ( - <button className={styles.linkButton} onClick={this.shareClicked.bind(this, "https://" + shareLink)}> + <button className={styles.linkButton} onClick={this.shareClicked.bind(this, shareFullLink)}> <span>{this.state.shareButtonActive ? "sharing..." : "share"}</span> </button> )}