1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 06:11:16 +00:00
This commit is contained in:
Michael An
2019-06-28 15:52:22 +08:00
parent 6eab883563
commit 4d6f637c0b
3 changed files with 17 additions and 3 deletions

View File

@@ -149,6 +149,7 @@ class DetailListView extends React.Component {
participants={fileParticipantList} participants={fileParticipantList}
repoID={this.props.repoID} repoID={this.props.repoID}
filePath={direntPath} filePath={direntPath}
showIconTip={false}
/> />
} }
</td> </td>

View File

@@ -135,6 +135,7 @@ class CommentPanel extends React.Component {
participants={participants} participants={participants}
repoID={repoID} repoID={repoID}
filePath={filePath} filePath={filePath}
showIconTip={true}
/> />
} }
<textarea <textarea

View File

@@ -1,8 +1,9 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Tooltip } from 'reactstrap';
import ModalPortal from '../modal-portal'; import ModalPortal from '../modal-portal';
import FileParticipantDialog from '../dialog/file-participant-dialog'; import FileParticipantDialog from '../dialog/file-participant-dialog';
import { serviceURL } from '../../utils/constants'; import { serviceURL, gettext } from '../../utils/constants';
import '../../css/participants-list.css'; import '../../css/participants-list.css';
const propTypes = { const propTypes = {
@@ -10,6 +11,7 @@ const propTypes = {
participants: PropTypes.array.isRequired, participants: PropTypes.array.isRequired,
repoID: PropTypes.string.isRequired, repoID: PropTypes.string.isRequired,
filePath: PropTypes.string.isRequired, filePath: PropTypes.string.isRequired,
showIconTip: PropTypes.bool.isRequired,
}; };
class ParticipantsList extends React.Component { class ParticipantsList extends React.Component {
@@ -18,6 +20,7 @@ class ParticipantsList extends React.Component {
super(props); super(props);
this.state = { this.state = {
showDialog : false, showDialog : false,
tooltipOpen: false,
}; };
} }
@@ -25,16 +28,25 @@ class ParticipantsList extends React.Component {
this.setState({ showDialog: !this.state.showDialog }); this.setState({ showDialog: !this.state.showDialog });
} }
tooltipToggle = () => {
this.setState({ tooltipOpen: !this.state.tooltipOpen });
}
render() { render() {
const { participants, repoID, filePath } = this.props; const { participants, repoID, filePath, showIconTip } = this.props;
return ( return (
<div className="participants mb-2 position-relative"> <div className="participants mb-2 position-relative">
{participants.map((item, index) => { {participants.map((item, index) => {
return <img src={serviceURL + item.avatar_url} className="avatar" alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>; return <img src={serviceURL + item.avatar_url} className="avatar" alt="avatar" key={index} style={{left: index * -7 + 'px'}}/>;
})} })}
<span className="add-participants" style={{left: participants.length * 21, top: 8 }} onClick={this.toggleDialog}> <span className="add-participants" style={{left: participants.length * 21, top: 8 }} onClick={this.toggleDialog} id="add-participant-icon">
<i className="fas fa-plus-circle"></i> <i className="fas fa-plus-circle"></i>
</span> </span>
{showIconTip &&
<Tooltip toggle={this.tooltipToggle} delay={{show: 0, hide: 0}} target="add-participant-icon" placement='bottom' isOpen={this.state.tooltipOpen}>
{gettext('Add participants')}
</Tooltip>
}
{this.state.showDialog && {this.state.showDialog &&
<ModalPortal> <ModalPortal>
<FileParticipantDialog <FileParticipantDialog