diff --git a/frontend/src/components/dialog/share-dialog.js b/frontend/src/components/dialog/share-dialog.js index 0c8eb16b7b..58672b5e56 100644 --- a/frontend/src/components/dialog/share-dialog.js +++ b/frontend/src/components/dialog/share-dialog.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; -import { Modal, ModalHeader, ModalBody, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; +import { Modal, ModalHeader, ModalBody, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; import { gettext, username, canGenerateShareLink, canGenerateUploadLink, canInvitePeople } from '../../utils/constants'; import ShareToUser from './share-to-user'; import ShareToGroup from './share-to-group'; @@ -51,7 +51,7 @@ class ShareDialog extends React.Component { } getInitialActiveTab = () => { - const {repoEncrypted, userPerm, enableDirPrivateShare} = this.props; + const { repoEncrypted, userPerm, enableDirPrivateShare } = this.props; const enableShareLink = !repoEncrypted && canGenerateShareLink; const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw'; @@ -66,7 +66,7 @@ class ShareDialog extends React.Component { toggle = (tab) => { if (this.state.activeTab !== tab) { - this.setState({activeTab: tab}); + this.setState({ activeTab: tab }); } } @@ -77,7 +77,7 @@ class ShareDialog extends React.Component { } let activeTab = this.state.activeTab; - const {repoEncrypted, userPerm, enableDirPrivateShare, itemType} = this.props; + const { repoEncrypted, userPerm, enableDirPrivateShare, itemType } = this.props; const enableShareLink = !repoEncrypted && canGenerateShareLink; const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw'; @@ -99,7 +99,7 @@ class ShareDialog extends React.Component { } - {itemType === 'dir' && + {itemType === 'dir' && {gettext('Internal Link')} @@ -119,11 +119,11 @@ class ShareDialog extends React.Component { {canInvitePeople && - - - {gettext('Invite People')} - - + + + {gettext('Invite People')} + + } } @@ -131,45 +131,49 @@ class ShareDialog extends React.Component {
- {enableShareLink && + {(enableShareLink && activeTab === 'shareLink') && - } - {enableUploadLink && + {(enableUploadLink && activeTab === 'uploadLink') && - } - {itemType === 'dir' && activeTab === 'internalLink' && - } {enableDirPrivateShare && - - - - {canInvitePeople && - - - + {activeTab === 'shareToUser' && + + + + } + {activeTab === 'shareToGroup' && + + + + } + {(canInvitePeople && activeTab === 'invitePeople') && + + + } - - - } @@ -200,18 +204,20 @@ class ShareDialog extends React.Component {
- - - + {activeTab === 'shareLink' && + + + + } {activeTab === 'internalLink' && - } @@ -225,7 +231,7 @@ class ShareDialog extends React.Component { const enableShareLink = !repoEncrypted && canGenerateShareLink; return (
- + {gettext('Share')} {itemName} {(itemType === 'library' || itemType === 'dir') && this.renderDirContent()}