From 6815a01be98d460431a39c45727ad0dbf09eb744 Mon Sep 17 00:00:00 2001 From: netpro2k Date: Thu, 1 Nov 2018 22:07:40 -0700 Subject: [PATCH] Use photo landing page for tweet + include hub url --- src/react-components/presence-log.js | 26 ++++++++++++++++++++------ src/react-components/ui-root.js | 6 ++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/react-components/presence-log.js b/src/react-components/presence-log.js index 7249ef70c2..5dc6664d13 100644 --- a/src/react-components/presence-log.js +++ b/src/react-components/presence-log.js @@ -6,8 +6,19 @@ import { FormattedMessage } from "react-intl"; import ChatMessage from "./chat-message"; import { share } from "../utils/share"; -function SpawnPhotoMessage({ name, body: { src: url }, className, maySpawn }) { - const onShareClicked = share.bind(null, { url, title: "Check out this photo from #hubs" }); +function SpawnPhotoMessage({ name, body: { src: url }, className, maySpawn, hubId }) { + let landingPageUrl = new URL(url); + const [hostname, port] = process.env.RETICULUM_SERVER.split(":"); + console.log(hostname, port, landingPageUrl.port); + landingPageUrl.hostname = hostname; + if (port) landingPageUrl.port = port; + landingPageUrl.pathname = landingPageUrl.pathname.replace(".png", ".html"); + landingPageUrl = landingPageUrl.toString(); + + const onShareClicked = share.bind(null, { + url: landingPageUrl, + title: `Taken in #hubs, join me at https://hub.link/${hubId}` + }); return (
{maySpawn &&
- + @@ -34,7 +45,8 @@ SpawnPhotoMessage.propTypes = { name: PropTypes.string, maySpawn: PropTypes.bool, body: PropTypes.object, - className: PropTypes.string + className: PropTypes.string, + hubId: PropTypes.string }; function ChatBody(props) { @@ -48,7 +60,8 @@ ChatBody.propTypes = { export default class PresenceLog extends Component { static propTypes = { entries: PropTypes.array, - inRoom: PropTypes.bool + inRoom: PropTypes.bool, + hubId: PropTypes.string }; constructor(props) { @@ -101,6 +114,7 @@ export default class PresenceLog extends Component { className={classNames(entryClasses, styles.media)} body={e.body} maySpawn={e.maySpawn} + hubId={this.props.hubId} /> ); } diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index 7a3987d2bb..012afee70e 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -1027,12 +1027,14 @@ class UIRoot extends Component { {(!entryFinished || this.isWaitingForAutoExit()) && (
- +
{dialogContents}
)} - {entryFinished && } + {entryFinished && ( + + )} {entryFinished && (