-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow sharing photos from the chat log #653
Conversation
|
e12003c
to
6815a01
Compare
@@ -89,9 +85,9 @@ export default class InviteDialog extends Component { | |||
)} | |||
{this.props.allowShare && | |||
!navigator.share && ( | |||
<a href={tweetLink} className={styles.linkButton} target="_blank" rel="noopener noreferrer"> | |||
<button className={styles.linkButton} onClick={this.shareClicked.bind(this, shortLink)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have written this to be onClick=() => this.shareClicked(shortLink)
but this is probably OK -- i find i don't use bind
anymore due to the property syntax. (currying the second arg is interesting tho, very FP :))
src/react-components/presence-log.js
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might consider rolling this routine into phoenix-utils.js
, its where I've tried to centralize references to RETICULUM_SERVER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason getReticulumFetchUrl(landingPageUrl.pathname.replace(".png", ".html"))
wouldn't work? also might be worth future proofing this for other file extensions by just dropping the file extension instead of assumign .png
src/react-components/presence-log.js
Outdated
body: PropTypes.object, | ||
className: PropTypes.string, | ||
hubId: PropTypes.string | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chat-message.js
is a thing so maybe photo-message.js
should be too
@@ -0,0 +1,17 @@ | |||
export function share(opts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default
perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh I figured there might be other share utils at some point
@@ -0,0 +1,17 @@ | |||
export function share(opts) { | |||
if (navigator.share) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a comment
// Use navigator.share otherwise just post to Twitter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! minor comments
Adds a share button to the "Foo took a photo" chatlog messages.
This uses
navigator.share
if available, otherwise falls back to twitter. I also reworked how we were sharing to twitter in other places to use twitter intents popup, which is a bit nicer style wise.todo: