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

Use state change directory array

This commit is contained in:
zxj96
2019-04-23 14:43:47 +08:00
parent 002c3a0dcc
commit 624871fc9c
7 changed files with 50 additions and 33 deletions

View File

@@ -85,6 +85,8 @@ const propTypes = {
showDirentDetail: PropTypes.func.isRequired,
onDeleteRepoTag: PropTypes.func.isRequired,
updateDetail: PropTypes.bool.isRequired,
scrollPage: PropTypes.func.isRequired,
isCurrentPage: PropTypes.bool.isRequired
};
class LibContentContainer extends React.Component {
@@ -204,6 +206,8 @@ class LibContentContainer extends React.Component {
onItemsCopy={this.props.onItemsCopy}
onItemsDelete={this.props.onItemsDelete}
onFileTagChanged={this.props.onFileTagChanged}
isCurrentPage={this.props.isCurrentPage}
scrollPage={this.props.scrollPage}
/>
)}
{this.props.currentMode === 'grid' && (
@@ -235,6 +239,8 @@ class LibContentContainer extends React.Component {
isDirentDetailShow={this.props.isDirentDetailShow}
onItemRename={this.props.onItemRename}
onFileTagChanged={this.props.onFileTagChanged}
isCurrentPage={this.props.isCurrentPage}
scrollPage={this.props.scrollPage}
/>
)}
{this.props.currentMode === 'column' && (
@@ -295,6 +301,8 @@ class LibContentContainer extends React.Component {
onItemsCopy={this.props.onItemsCopy}
onItemsDelete={this.props.onItemsDelete}
onFileTagChanged={this.props.onFileTagChanged}
isCurrentPage={this.props.isCurrentPage}
scrollPage={this.props.scrollPage}
/>
)}
</Fragment>

View File

@@ -71,6 +71,7 @@ class LibContentView extends React.Component {
errorMsg: '',
isDirentDetailShow: false,
updateDetail: false,
isCurrentPage: false,
};
window.onpopstate = this.onpopstate;
@@ -402,6 +403,7 @@ class LibContentView extends React.Component {
if (!this.state.repoEncrypted && direntList.length) {
this.getThumbnails(repoID, path, this.state.direntList);
}
this.switchPage();
}).catch(() => {
this.setState({
isDirentListLoading: false,
@@ -410,6 +412,14 @@ class LibContentView extends React.Component {
});
}
scrollPage = () => {
this.setState({isCurrentPage: false})
}
switchPage = () => {
this.setState({isCurrentPage: true})
}
getThumbnails = (repoID, path, direntList) => {
let items = direntList.filter((item) => {
return Utils.imageCheck(item.name) && !item.encoded_thumbnail_src;
@@ -1451,6 +1461,8 @@ class LibContentView extends React.Component {
onDeleteRepoTag={this.onDeleteRepoTag}
onToolbarFileTagChanged={this.onToolbarFileTagChanged}
updateDetail={this.state.updateDetail}
isCurrentPage={this.state.isCurrentPage}
scrollPage={this.scrollPage}
/>
{this.state.pathExist && !this.state.isViewFile && (
<FileUploader