From 42988daa59540ddb73d425aad0f27ad1372b3ceb Mon Sep 17 00:00:00 2001 From: Jessop Breth Date: Thu, 4 Oct 2018 09:39:14 -0400 Subject: [PATCH] adds LBRY app sharing to socialShare --- src/renderer/component/copyableText/index.js | 10 ++ src/renderer/component/copyableText/view.jsx | 63 +++++++++++++ src/renderer/component/socialShare/view.jsx | 98 +++++++++++++------- src/renderer/modal/modalSocialShare/view.jsx | 5 +- src/renderer/page/file/view.jsx | 22 +++-- src/renderer/scss/_gui.scss | 1 + 6 files changed, 155 insertions(+), 44 deletions(-) create mode 100644 src/renderer/component/copyableText/index.js create mode 100644 src/renderer/component/copyableText/view.jsx diff --git a/src/renderer/component/copyableText/index.js b/src/renderer/component/copyableText/index.js new file mode 100644 index 000000000..f759811aa --- /dev/null +++ b/src/renderer/component/copyableText/index.js @@ -0,0 +1,10 @@ +import { connect } from 'react-redux'; +import { doNotify } from 'lbry-redux'; +import CopyableText from './view'; + +export default connect( + null, + { + doNotify, + } +)(CopyableText); diff --git a/src/renderer/component/copyableText/view.jsx b/src/renderer/component/copyableText/view.jsx new file mode 100644 index 000000000..e47a37506 --- /dev/null +++ b/src/renderer/component/copyableText/view.jsx @@ -0,0 +1,63 @@ +// @flow +import * as React from 'react'; +import { clipboard } from 'electron'; +import { FormRow } from 'component/common/form'; +import Button from 'component/button'; +import * as icons from 'constants/icons'; +/* +noSnackbar added due to issue 1945 +https://github.com/lbryio/lbry-desktop/issues/1945 +"Snackbars and modals can't be displayed at the same time" +*/ +type Props = { + copyable: string, + noSnackbar: boolean, + doNotify: ({ message: string, displayType: Array }) => void, +}; + +export default class CopyableText extends React.PureComponent { + constructor() { + super(); + + this.input = null; + } + + input: ?HTMLInputElement; + + render() { + const { copyable, doNotify, noSnackbar } = this.props; + + return ( + + { + this.input = input; + }} + onFocus={() => { + if (this.input) { + this.input.select(); + } + }} + /> + +