1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 19:29:56 +00:00

Dashboard module improve (#2788)

This commit is contained in:
杨顺强
2019-01-08 14:51:13 +08:00
committed by Daniel Pan
parent f9de0440bc
commit 833f70a8cb
3 changed files with 17 additions and 14 deletions

View File

@@ -10801,9 +10801,9 @@
} }
}, },
"seafile-js": { "seafile-js": {
"version": "0.2.52", "version": "0.2.53",
"resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.52.tgz", "resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.53.tgz",
"integrity": "sha512-Hu0d6aXl2nL77D53XgeN9B1AGbBcxrrA8D+prxasWqFn2lqIf0Jv0AGXQRBEY5MYIG7VDIGj8a3eQAndNjN6vQ==", "integrity": "sha512-uxQF6mNUe7Z/jEI0E7SS8hSFbC7P/JcETlGZOeFgavdlIOH81twveLAehdmV4uPKEsG7sqvXa2UJDsoHKuUDBA==",
"requires": { "requires": {
"axios": "^0.18.0", "axios": "^0.18.0",
"form-data": "^2.3.2", "form-data": "^2.3.2",

View File

@@ -31,7 +31,7 @@
"react-moment": "^0.7.9", "react-moment": "^0.7.9",
"react-select": "^2.1.1", "react-select": "^2.1.1",
"reactstrap": "^6.4.0", "reactstrap": "^6.4.0",
"seafile-js": "^0.2.52", "seafile-js": "^0.2.53",
"seafile-ui": "^0.1.10", "seafile-ui": "^0.1.10",
"socket.io-client": "^2.2.0", "socket.io-client": "^2.2.0",
"sw-precache-webpack-plugin": "0.11.4", "sw-precache-webpack-plugin": "0.11.4",

View File

@@ -176,12 +176,12 @@ class FilesActivities extends Component {
hasMore: true, hasMore: true,
items: [], items: [],
}; };
this.avatarSize = 72;
} }
componentDidMount() { componentDidMount() {
const avatarSize = 72;
let currentPage = this.state.currentPage; let currentPage = this.state.currentPage;
seafileAPI.listActivities(currentPage, avatarSize).then(res => { seafileAPI.listActivities(currentPage, this.avatarSize).then(res => {
// {"events":[...]} // {"events":[...]}
this.setState({ this.setState({
items: res.data.events, items: res.data.events,
@@ -200,9 +200,8 @@ class FilesActivities extends Component {
} }
getMore() { getMore() {
this.setState({isLoadingMore: true});
let currentPage = this.state.currentPage; let currentPage = this.state.currentPage;
seafileAPI.listActivities(currentPage).then(res => { seafileAPI.listActivities(currentPage, this.avatarSize).then(res => {
// {"events":[...]} // {"events":[...]}
this.setState({ this.setState({
isLoadingMore: false, isLoadingMore: false,
@@ -221,12 +220,16 @@ class FilesActivities extends Component {
} }
handleScroll = (event) => { handleScroll = (event) => {
const clientHeight = event.target.clientHeight; if (!this.state.isLoadingMore && this.state.hasMore) {
const scrollHeight = event.target.scrollHeight; const clientHeight = event.target.clientHeight;
const scrollTop = event.target.scrollTop; const scrollHeight = event.target.scrollHeight;
const isBottom = (clientHeight + scrollTop + 1 >= scrollHeight); const scrollTop = event.target.scrollTop;
if (this.state.hasMore && isBottom) { // scroll to the bottom const isBottom = (clientHeight + scrollTop + 1 >= scrollHeight);
this.getMore(); if (isBottom) { // scroll to the bottom
this.setState({isLoadingMore: true}, () => {
this.getMore();
});
}
} }
} }