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

Mobile visit item (#4779)

* [mobile] my libs: improved 'visit repo'

* [mobile] dir view: improved 'visit dirent'

* [mobile] shared with me: improved 'visit repo'

* [mobile] group, groups, shared with all: improved 'visit repo'

* [mobile] starred: improved 'visit item'
This commit is contained in:
llj
2021-01-09 18:36:26 +08:00
committed by GitHub
parent 2679355ee8
commit 3600537e12
5 changed files with 47 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
import { Link } from '@reach/router';
import { Link, navigate } from '@reach/router';
import { Utils } from '../../utils/utils';
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
import ModalPortal from '../../components/modal-portal';
@@ -478,15 +478,22 @@ class SharedRepoListItem extends React.Component {
</Fragment>
);
}
visitRepo = () => {
if (!this.state.isRenaming) {
navigate(this.repoURL);
}
}
renderMobileUI = () => {
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
let { repo } = this.props;
this.repoURL = libPath;
return (
<Fragment>
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
<td><img src={iconUrl} title={iconTitle} width="24" alt={iconTitle}/></td>
<td>
<td onClick={this.visitRepo}><img src={iconUrl} title={iconTitle} width="24" alt={iconTitle}/></td>
<td onClick={this.visitRepo}>
{this.state.isRenaming ?
<Rename name={repo.repo_name} onRenameConfirm={this.onRenameConfirm} onRenameCancel={this.onRenameCancel} /> :
<Link to={libPath}>{repo.repo_name}</Link>