Skip to content
Snippets Groups Projects
Commit 5c6e4074 authored by Greg Fodor's avatar Greg Fodor
Browse files

Use full link for tweets

parent b686d07a
No related branches found
No related tags found
No related merge requests found
......@@ -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>
)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment