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

optimization code

This commit is contained in:
zxj96
2019-05-30 21:38:15 +08:00
parent d09b52ec82
commit e07aad7b54

View File

@@ -130,7 +130,7 @@ class RepoListItem extends React.Component {
} }
onRepoItemClick = () => { onRepoItemClick = () => {
if (!this.isCurrentRepo() || this.refs.itemActive.className !== 'item-info item-active') { if (!this.isCurrentRepo() || this.props.selectedPath !== '') {
this.props.onRepoItemClick(this.props.repo); this.props.onRepoItemClick(this.props.repo);
} else { } else {
this.onToggleClick(); this.onToggleClick();
@@ -152,7 +152,7 @@ class RepoListItem extends React.Component {
return ( return (
<li className="file-chooser-item"> <li className="file-chooser-item">
<span className={`item-toggle fa ${this.state.isShowChildren ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span> <span className={`item-toggle fa ${this.state.isShowChildren ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
<span className={`item-info ${repoActive ? 'item-active' : ''}`} onClick={this.onRepoItemClick} ref='itemActive'> <span className={`item-info ${repoActive ? 'item-active' : ''}`} onClick={this.onRepoItemClick}>
<span className="icon far fa-folder"></span> <span className="icon far fa-folder"></span>
<span className="name user-select-none ellipsis">{this.props.repo.repo_name}</span> <span className="name user-select-none ellipsis">{this.props.repo.repo_name}</span>
</span> </span>