1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 09:51:26 +00:00

fix warnings and className

This commit is contained in:
Michael An
2019-06-28 10:23:22 +08:00
parent e382d40df8
commit 6eab883563
5 changed files with 61 additions and 23 deletions

View File

@@ -5,7 +5,7 @@ import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api'; import { seafileAPI } from '../../utils/seafile-api';
import UserSelect from '../user-select'; import UserSelect from '../user-select';
import toaster from '../toast'; import toaster from '../toast';
import '../../css/add-reviewer-dialog.css'; import '../../css/participants-list.css';
const fileParticipantListItemPropTypes = { const fileParticipantListItemPropTypes = {
participant: PropTypes.object.isRequired, participant: PropTypes.object.isRequired,
@@ -32,16 +32,16 @@ class FileParticipantListItem extends Component {
render() { render() {
const { participant } = this.props; const { participant } = this.props;
return ( return (
<div className="reviewer-select-info" onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}> <div className="participant-select-info" onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
<div className="d-flex"> <div className="d-flex">
<img className="avatar reviewer-select-avatar" src={participant.avatar_url} alt=""/> <img className="avatar participant-select-avatar" src={participant.avatar_url} alt=""/>
<span className="reviewer-select-name ellipsis">{participant.name}</span> <span className="participant-select-name ellipsis">{participant.name}</span>
</div> </div>
<i <i
className={`action-icon sf2-icon-x3 ${!this.state.isOperationShow &&'o-hidden'}`} className={`action-icon sf2-icon-x3 ${!this.state.isOperationShow &&'o-hidden'}`}
title={gettext('Delete')} title={gettext('Delete')}
onClick={this.props.deleteFileParticipant.bind(this, participant.email)} onClick={this.props.deleteFileParticipant.bind(this, participant.email)}
></i> ></i>
</div> </div>
); );
} }
@@ -72,7 +72,7 @@ class FileParticipantDialog extends Component {
}; };
deleteFileParticipant = (email) => { deleteFileParticipant = (email) => {
const { repoID, filePath, dirent } = this.props; const { repoID, filePath } = this.props;
seafileAPI.deleteFileParticipant(repoID, filePath, email).then((res) => { seafileAPI.deleteFileParticipant(repoID, filePath, email).then((res) => {
this.props.onParticipantsChange(repoID, filePath); this.props.onParticipantsChange(repoID, filePath);
}).catch((error) => { }).catch((error) => {
@@ -83,7 +83,7 @@ class FileParticipantDialog extends Component {
addFileParticipant = () => { addFileParticipant = () => {
const { selectedOption } = this.state; const { selectedOption } = this.state;
const { repoID, filePath, dirent } = this.props; const { repoID, filePath } = this.props;
if (!selectedOption || selectedOption.length === 0) { if (!selectedOption || selectedOption.length === 0) {
return; return;
} }
@@ -119,11 +119,11 @@ class FileParticipantDialog extends Component {
<Modal isOpen={true} toggle={this.props.toggleFileParticipantDialog}> <Modal isOpen={true} toggle={this.props.toggleFileParticipantDialog}>
<ModalHeader toggle={this.props.toggleFileParticipantDialog}>{gettext('Participants')}</ModalHeader> <ModalHeader toggle={this.props.toggleFileParticipantDialog}>{gettext('Participants')}</ModalHeader>
<ModalBody> <ModalBody>
<div className="add-reviewer"> <div className="participant-add">
<UserSelect <UserSelect
ref="userSelect" ref="userSelect"
isMulti={false} isMulti={false}
className="reviewer-select" className="participant-select"
placeholder={gettext('Select users...')} placeholder={gettext('Select users...')}
onSelectChange={this.handleSelectChange} onSelectChange={this.handleSelectChange}
/> />

View File

@@ -19,6 +19,7 @@ const propTypes = {
relatedFiles: PropTypes.array.isRequired, relatedFiles: PropTypes.array.isRequired,
onFileTagChanged: PropTypes.func.isRequired, onFileTagChanged: PropTypes.func.isRequired,
onRelatedFileChange: PropTypes.func.isRequired, onRelatedFileChange: PropTypes.func.isRequired,
onParticipantsChange: PropTypes.func.isRequired,
fileParticipantList: PropTypes.array.isRequired, fileParticipantList: PropTypes.array.isRequired,
}; };

View File

@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
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 } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import '../../css/participants-list.css'; import '../../css/participants-list.css';
const propTypes = { const propTypes = {
@@ -29,11 +28,11 @@ class ParticipantsList extends React.Component {
render() { render() {
const { participants, repoID, filePath } = this.props; const { participants, repoID, filePath } = this.props;
return ( return (
<div className="file-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-file-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}>
<i className="fas fa-plus-circle"></i> <i className="fas fa-plus-circle"></i>
</span> </span>
{this.state.showDialog && {this.state.showDialog &&

View File

@@ -1,18 +1,58 @@
.file-participants { /* participants-list */
.participants {
min-height: 30px; min-height: 30px;
} }
.file-participants .avatar { .participants .avatar {
width: 28px; width: 28px;
height: 28px; height: 28px;
border: 2px solid #fff; border: 2px solid #fff;
} }
.file-participants .add-file-participants { .participants .add-participants {
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
} }
.file-participants .add-file-participants i { .participants .add-participants i {
font-size: 16px; font-size: 16px;
color: rgb(229, 162, 82); color: rgb(229, 162, 82);
border: 2px solid #fff; border: 2px solid #fff;
border-radius: 50%; border-radius: 50%;
} }
/* 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;
}

View File

@@ -1,7 +1,5 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Utils } from './utils/utils';
import { gettext, siteRoot } from './utils/constants';
import FileView from './components/history-trash-file-view/file-view'; import FileView from './components/history-trash-file-view/file-view';
import FileViewTip from './components/history-trash-file-view/file-view-tip'; import FileViewTip from './components/history-trash-file-view/file-view-tip';
import Image from './components/file-content-view/image'; import Image from './components/file-content-view/image';