2020-03-25 03:08:43 +00:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
|
|
|
import PopoverLayout from './popover_layout'
|
|
|
|
import List from '../list'
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
embed: { id: 'status.embed', defaultMessage: 'Embed gab' },
|
|
|
|
email: { id: 'status.email', defaultMessage: 'Email gab' },
|
|
|
|
copy: { id: 'status.copy', defaultMessage: 'Copy link to gab' },
|
|
|
|
});
|
|
|
|
|
|
|
|
// const makeMapStateToProps = () => {
|
|
|
|
// const getAccount = makeGetAccount();
|
|
|
|
|
|
|
|
// const mapStateToProps = (state, { account }) => ({
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// return mapStateToProps;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// const mapDispatchToProps = (dispatch, { intl }) => ({
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
2020-04-07 02:53:23 +01:00
|
|
|
// : todo :
|
|
|
|
|
2020-03-25 03:08:43 +00:00
|
|
|
export default
|
|
|
|
@injectIntl
|
|
|
|
// @connect(makeMapStateToProps, mapDispatchToProps)
|
|
|
|
class StatusSharePopover extends ImmutablePureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
status: ImmutablePropTypes.map,
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
handleEmbed = () => {
|
|
|
|
// this.props.onEmbed(this.props.status);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleCopy = () => {
|
|
|
|
// const url = this.props.status.get('url');
|
|
|
|
// const textarea = document.createElement('textarea');
|
|
|
|
|
|
|
|
// textarea.textContent = url;
|
|
|
|
// textarea.style.position = 'fixed';
|
|
|
|
|
|
|
|
// document.body.appendChild(textarea);
|
|
|
|
|
|
|
|
// try {
|
|
|
|
// textarea.select();
|
|
|
|
// document.execCommand('copy');
|
|
|
|
// } catch (e) {
|
|
|
|
// //
|
|
|
|
// } finally {
|
|
|
|
// document.body.removeChild(textarea);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { intl } = this.props
|
|
|
|
|
|
|
|
return (
|
2020-04-07 02:53:23 +01:00
|
|
|
<PopoverLayout width={220}>
|
2020-03-25 03:08:43 +00:00
|
|
|
<List
|
2020-04-07 02:53:23 +01:00
|
|
|
size='large'
|
2020-03-25 03:08:43 +00:00
|
|
|
scrollKey='status_share_options'
|
|
|
|
items={[
|
|
|
|
{
|
|
|
|
icon: 'copy',
|
|
|
|
hideArrow: true,
|
|
|
|
title: intl.formatMessage(messages.copy),
|
|
|
|
onClick: this.handleCopy,
|
|
|
|
},
|
|
|
|
{
|
2020-04-07 02:53:23 +01:00
|
|
|
icon: 'email',
|
2020-03-25 03:08:43 +00:00
|
|
|
hideArrow: true,
|
|
|
|
title: intl.formatMessage(messages.email),
|
|
|
|
href: 'mailto:',
|
|
|
|
},
|
|
|
|
{
|
2020-04-07 02:53:23 +01:00
|
|
|
icon: 'code',
|
2020-03-25 03:08:43 +00:00
|
|
|
hideArrow: true,
|
|
|
|
title: intl.formatMessage(messages.embed),
|
|
|
|
onClick: this.handleEmbed,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
</PopoverLayout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|