Add link to manage shares from modal

This commit is contained in:
Tom Moor
2018-05-26 10:38:44 -07:00
parent de54698408
commit 0d7c943bcd
2 changed files with 14 additions and 9 deletions

View File

@ -46,7 +46,7 @@ class Modals extends React.Component<Props> {
<CollectionDelete onSubmit={this.handleClose} /> <CollectionDelete onSubmit={this.handleClose} />
</Modal> </Modal>
<Modal name="document-share" title="Share document"> <Modal name="document-share" title="Share document">
<DocumentShare onCopyLink={this.handleClose} /> <DocumentShare onSubmit={this.handleClose} />
</Modal> </Modal>
<Modal name="document-delete" title="Delete document"> <Modal name="document-delete" title="Delete document">
<DocumentDelete onSubmit={this.handleClose} /> <DocumentDelete onSubmit={this.handleClose} />

View File

@ -2,6 +2,7 @@
import * as React from 'react'; import * as React from 'react';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';
import Input from 'components/Input'; import Input from 'components/Input';
import Button from 'components/Button'; import Button from 'components/Button';
import CopyToClipboard from 'components/CopyToClipboard'; import CopyToClipboard from 'components/CopyToClipboard';
@ -9,8 +10,8 @@ import HelpText from 'components/HelpText';
import Document from 'models/Document'; import Document from 'models/Document';
type Props = { type Props = {
document: Document, document?: Document,
onCopyLink: () => *, onSubmit: () => *,
}; };
@observer @observer
@ -27,19 +28,23 @@ class DocumentShare extends React.Component<Props> {
this.timeout = setTimeout(() => { this.timeout = setTimeout(() => {
this.isCopied = false; this.isCopied = false;
this.props.onCopyLink(); this.props.onSubmit();
}, 2000); }, 1500);
}; };
render() { render() {
const { document } = this.props; const { document, onSubmit } = this.props;
if (!document) return null;
return ( return (
<div> <div>
<HelpText> <HelpText>
The link below allows anyone to access a read-only version of the The link below allows anyone in the world to access a read-only
document <strong>{document.title}</strong>. You can revoke this link version of the document <strong>{document.title}</strong>. You can
in settings at any time. revoke this link in settings at any time.{' '}
<Link to="/settings/shares" onClick={onSubmit}>
Manage share links
</Link>.
</HelpText> </HelpText>
<Input <Input
type="text" type="text"