diff --git a/frontend/src/components/dialog/file-participant-dialog.js b/frontend/src/components/dialog/file-participant-dialog.js deleted file mode 100644 index 07f4e7e57d..0000000000 --- a/frontend/src/components/dialog/file-participant-dialog.js +++ /dev/null @@ -1,145 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; -import { gettext } from '../../utils/constants'; -import { seafileAPI } from '../../utils/seafile-api'; -import UserSelect from '../user-select'; -import toaster from '../toast'; -import { Utils } from '../../utils/utils'; -import '../../css/participants-list.css'; - -const fileParticipantListItemPropTypes = { - participant: PropTypes.object.isRequired, - deleteFileParticipant: PropTypes.func.isRequired, -}; - -class FileParticipantListItem extends Component { - - constructor(props) { - super(props); - this.state = { - isOperationShow: false, - }; - } - - onMouseOver = () => { - this.setState({ isOperationShow: true }); - }; - - onMouseLeave = () => { - this.setState({ isOperationShow: false }); - }; - - render() { - const { participant } = this.props; - return ( -
-
- - {participant.name} -
- -
- ); - } -} - -FileParticipantListItem.propTypes = fileParticipantListItemPropTypes; - - -const fileParticipantDialogPropTypes = { - repoID: PropTypes.string.isRequired, - filePath: PropTypes.string.isRequired, - toggleFileParticipantDialog: PropTypes.func.isRequired, - fileParticipantList: PropTypes.array.isRequired, - onParticipantsChange: PropTypes.func, -}; - -class FileParticipantDialog extends Component { - - constructor(props) { - super(props); - this.state = { - selectedOption: null, - }; - } - - handleSelectChange = (option) => { - this.setState({ selectedOption: option }); - }; - - deleteFileParticipant = (email) => { - const { repoID, filePath } = this.props; - seafileAPI.deleteFileParticipant(repoID, filePath, email).then((res) => { - this.props.onParticipantsChange(repoID, filePath); - }).catch(error => { - let errMessage = Utils.getErrorMsg(error); - toaster.danger(errMessage); - }); - this.refs.userSelect.clearSelect(); - }; - - addFileParticipant = () => { - const { selectedOption } = this.state; - const { repoID, filePath } = this.props; - if (!selectedOption || selectedOption.length === 0) { - return; - } - let emails = selectedOption.map((option) => {return option.email;}); - seafileAPI.addFileParticipants(repoID, filePath, emails).then((res) => { - this.props.onParticipantsChange(repoID, filePath); - res.data.failed.map(item => { - const msg = gettext('Failed to add {email_placeholder}: {error_msg_placeholder}') - .replace('{email_placeholder}', item.email) - .replace('{error_msg_placeholder}', item.error_msg); - toaster.danger(msg, {duration: 3}); - }); - }).catch(error => { - toaster.danger(Utils.getErrorMsg(error)); - }); - this.setState({ selectedOption: null }); - this.refs.userSelect.clearSelect(); - }; - - render() { - const renderParticipantList = this.props.fileParticipantList.map((participant, index) => { - return ( - - ); - }); - - return ( - - {gettext('Participants')} - -
- - -
- {renderParticipantList} -
- - - -
- ); - } -} - -FileParticipantDialog.propTypes = fileParticipantDialogPropTypes; - -export default FileParticipantDialog; diff --git a/frontend/src/components/dirent-detail/detail-comments-list.js b/frontend/src/components/dirent-detail/detail-comments-list.js index 4c9e20fd04..7ecc54ea60 100644 --- a/frontend/src/components/dirent-detail/detail-comments-list.js +++ b/frontend/src/components/dirent-detail/detail-comments-list.js @@ -7,7 +7,6 @@ import { gettext, username, siteRoot } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import { Utils } from '../../utils/utils'; import toaster from '../toast'; -import ParticipantsList from '../file-view/participants-list'; import { MentionsInput, Mention } from 'react-mentions'; import { defaultStyle, defaultMentionStyle } from '../../css/react-mentions-default-style'; import '../../css/comments-list.css'; @@ -137,7 +136,7 @@ class DetailCommentList extends React.Component { } render() { - const { repoID, filePath, fileParticipantList } = this.props; + const { repoID, filePath } = this.props; const { commentsList } = this.state; return (
@@ -164,15 +163,6 @@ class DetailCommentList extends React.Component { }
- {fileParticipantList && - - } - - {gettext('Participants')} - - {fileParticipantList && - - } - - {this.state.isEditFileTagShow && diff --git a/frontend/src/components/dirent-detail/dirent-details.js b/frontend/src/components/dirent-detail/dirent-details.js index 15446c4960..6f3a370f70 100644 --- a/frontend/src/components/dirent-detail/dirent-details.js +++ b/frontend/src/components/dirent-detail/dirent-details.js @@ -173,8 +173,6 @@ class DirentDetail extends React.Component { direntDetail={this.state.direntDetail} fileTagList={dirent ? dirent.file_tags : fileTags} onFileTagChanged={this.props.onFileTagChanged} - fileParticipantList={this.state.fileParticipantList} - onParticipantsChange={this.onParticipantsChange} />
} diff --git a/frontend/src/components/file-view/comment-panel.js b/frontend/src/components/file-view/comment-panel.js index 8f05db4ecc..719d7291e9 100644 --- a/frontend/src/components/file-view/comment-panel.js +++ b/frontend/src/components/file-view/comment-panel.js @@ -5,7 +5,6 @@ import { processor } from '@seafile/seafile-editor'; import { Button, Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import { gettext } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; -import ParticipantsList from './participants-list'; import { Utils } from '../../utils/utils'; import toaster from '../toast'; import { MentionsInput, Mention } from 'react-mentions'; @@ -159,7 +158,7 @@ class CommentPanel extends React.Component { } render() { - const { participants, commentsList } = this.state; + const { commentsList } = this.state; return (
@@ -190,15 +189,6 @@ class CommentPanel extends React.Component { }
- {participants && - - } { - this.setState({ showDialog: !this.state.showDialog }); - } - - tooltipToggle = () => { - this.setState({ tooltipOpen: !this.state.tooltipOpen }); - } - - componentWillMount() { - this.targetID = this.targetID + Math.floor(Math.random() * 1000); - } - - render() { - const { participants, repoID, filePath, showIconTip } = this.props; - return ( -
- {participants.map((item, index) => { - return ; - })} - - - - {showIconTip && - - {gettext('Add participants')} - - } - {this.state.showDialog && - - - - } -
- ); - } -} - -ParticipantsList.propTypes = propTypes; - -const ParticipantPropTypes = { - index: PropTypes.number.isRequired, - item: PropTypes.object.isRequired, -}; - -class Participant extends React.Component { - - constructor(props) { - super(props); - this.state = { - showAvatarTooltip: false, - }; - this.targetID = 'participant-avatar-'; - } - - toggleAvatarTooltip = () => { - this.setState({ showAvatarTooltip: !this.state.showAvatarTooltip }); - } - - componentWillMount() { - this.targetID = this.targetID + this.props.index + Math.floor(Math.random() * 1000); - } - - render() { - const { item, index } = this.props; - return ( - - avatar - - {item.name} - - - ); - } -} - -Participant.propTypes = ParticipantPropTypes; - -export default ParticipantsList; diff --git a/frontend/src/css/participants-list.css b/frontend/src/css/participants-list.css deleted file mode 100644 index 88b93aea60..0000000000 --- a/frontend/src/css/participants-list.css +++ /dev/null @@ -1,62 +0,0 @@ -/* participants-list */ -.participants { - min-height: 20px; -} -.participants .avatar { - width: 28px; - height: 28px; - border: 2px solid #fff; -} -.participants .add-participants { - position: absolute; - cursor: pointer; - bottom: -3px; -} -.participants .add-participants i { - font-size: 16px; - color: #ff9800; - border: 2px solid #fff; - border-radius: 50%; -} -.participants .participant-avatar, .participants .add-participants { - margin-right: -0.5rem; -} -/* file-participant-dialog */ -.participant-add { - display: flex; - justify-content: space-between; -} -.participant-add .participant-select { - width: 385px; -} -.participant-add .btn { - width: 75px; -} -.participant-select-info { - margin-top: 10px; - display: flex; - align-items: center; - justify-content: space-between; -} -.participant-select-avatar { - margin-right: 10px; -} -.participant-select-name { - height: 2rem; - line-height: 2rem; -} -.participant-select-error { - margin-top: 1em; -} -.participant-select .true__dropdown-indicator, .participant-select .true__indicator-separator { - display: none; -} -.participant-select-info i { - opacity: 0; - margin-right: 10px; -} -.participant-select-info:hover i { - cursor: pointer; - opacity: 1; - color: #a4a4a4; -} diff --git a/frontend/src/pages/markdown-editor/rich-markdown-editor/comment-panel.js b/frontend/src/pages/markdown-editor/rich-markdown-editor/comment-panel.js index 620894546c..7ee654f813 100644 --- a/frontend/src/pages/markdown-editor/rich-markdown-editor/comment-panel.js +++ b/frontend/src/pages/markdown-editor/rich-markdown-editor/comment-panel.js @@ -8,7 +8,6 @@ import { gettext } from '../../../utils/constants'; import { Utils } from '../../../utils/utils'; import { seafileAPI } from '../../../utils/seafile-api'; import toaster from '../../../components/toast'; -import ParticipantsList from '../../../components/file-view/participants-list'; import CommentItem from './comment-item'; import { defaultStyle, defaultMentionStyle } from '../../../css/react-mentions-default-style'; @@ -202,15 +201,6 @@ class CommentPanel extends React.Component { }
- {participants && - - }
@@ -61,20 +58,6 @@ class DetailListView extends React.Component { - - {gettext('Participants')} - - {participants && - - } - -
diff --git a/frontend/src/pages/markdown-editor/rich-markdown-editor/side-panel.js b/frontend/src/pages/markdown-editor/rich-markdown-editor/side-panel.js index 7d4fff9539..4fb13f7689 100644 --- a/frontend/src/pages/markdown-editor/rich-markdown-editor/side-panel.js +++ b/frontend/src/pages/markdown-editor/rich-markdown-editor/side-panel.js @@ -84,9 +84,7 @@ class SidePanel extends React.PureComponent { }