1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-21 19:37:28 +00:00

[share admin] upload links: added support for mobile; improvement (#4011)

* and improved 'share links'
This commit is contained in:
llj
2019-08-21 16:36:55 +08:00
committed by Daniel Pan
parent 0b25041ba9
commit 3e65a3a313
5 changed files with 234 additions and 194 deletions

View File

@@ -0,0 +1,44 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
import copy from '@seafile/seafile-editor/dist//utils/copy-to-clipboard';
import { gettext } from '../../utils/constants';
import toaster from '../../components/toast';
const propTypes = {
link: PropTypes.string.isRequired,
toggleDialog: PropTypes.func.isRequired
};
class ShareAdminLink extends React.Component {
constructor(props) {
super(props);
}
copyToClipboard = () => {
copy(this.props.link);
this.props.toggleDialog();
toaster.success(gettext('The link is copied to the clipboard.')), {duration: 2};
}
render() {
const { link, toggleDialog } = this.props;
return (
<Modal isOpen={true} toggle={toggleDialog}>
<ModalHeader toggle={toggleDialog}>{gettext('Link')}</ModalHeader>
<ModalBody>
<a href={link}>{link}</a>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={this.copyToClipboard}>{gettext('Copy')}</Button>
<Button color="secondary" onClick={toggleDialog}>{gettext('Close')}</Button>
</ModalFooter>
</Modal>
);
}
}
ShareAdminLink.propTypes = propTypes;
export default ShareAdminLink;