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

Tweet button in invite

parent e5a7f713
No related branches found
No related tags found
No related merge requests found
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
} }
:local(.link-button) { :local(.link-button) {
@extend %action-button;
@extend %action-button-selected; @extend %action-button-selected;
min-width: auto;
margin-top: 4px; margin-top: 4px;
flex: 1;
@media (max-height: 370px) { @media (max-height: 370px) {
display: none; display: none;
...@@ -115,8 +118,9 @@ ...@@ -115,8 +118,9 @@
:local(.buttons) { :local(.buttons) {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%;
button { button, a {
margin: 0 12px; margin: 0 12px;
} }
} }
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
"link.connect_headset": "Connect Mobile Headset", "link.connect_headset": "Connect Mobile Headset",
"link.cancel": "cancel", "link.cancel": "cancel",
"invite.enter_via": "Enter via ", "invite.enter_via": "Enter via ",
"invite.tweet": "tweet",
"invite.and_enter_code": " with code:", "invite.and_enter_code": " with code:",
"invite.or_visit": "or visit", "invite.or_visit": "or visit",
"spoke.primary_tagline": "make your space", "spoke.primary_tagline": "make your space",
......
...@@ -44,6 +44,11 @@ export default class InviteDialog extends Component { ...@@ -44,6 +44,11 @@ export default class InviteDialog extends Component {
const entryCodeString = pad(entryCode, 6); const entryCodeString = pad(entryCode, 6);
const shareLink = `hub.link/${entryCodeString}`; const shareLink = `hub.link/${entryCodeString}`;
const tweetText = `Join me now in #hubs!`;
const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(
"https://" + shareLink
)}&text=${encodeURIComponent(tweetText)}`;
return ( return (
<div className={styles.dialog}> <div className={styles.dialog}>
<div className={styles.attachPoint} /> <div className={styles.attachPoint} />
...@@ -80,6 +85,12 @@ export default class InviteDialog extends Component { ...@@ -80,6 +85,12 @@ export default class InviteDialog extends Component {
<span>{this.state.shareButtonActive ? "sharing..." : "share"}</span> <span>{this.state.shareButtonActive ? "sharing..." : "share"}</span>
</button> </button>
)} )}
{this.props.allowShare &&
!navigator.share && (
<a href={tweetLink} className={styles.linkButton} target="_blank" rel="noopener noreferrer">
<FormattedMessage id="invite.tweet" />
</a>
)}
</div> </div>
</div> </div>
); );
......
...@@ -67,8 +67,10 @@ class SceneUI extends Component { ...@@ -67,8 +67,10 @@ class SceneUI extends Component {
render() { render() {
const sceneUrl = [location.protocol, "//", location.host, location.pathname].join(""); const sceneUrl = [location.protocol, "//", location.host, location.pathname].join("");
const text = `${this.props.sceneName} in #hubs`; const tweetText = `${this.props.sceneName} in #hubs`;
const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(sceneUrl)}&text=${encodeURIComponent(text)}`; const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(sceneUrl)}&text=${encodeURIComponent(
tweetText
)}`;
return ( return (
<IntlProvider locale={lang} messages={messages}> <IntlProvider locale={lang} messages={messages}>
......
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