mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
Dashboard module improve (#2788)
This commit is contained in:
6
frontend/package-lock.json
generated
6
frontend/package-lock.json
generated
@@ -10801,9 +10801,9 @@
|
||||
}
|
||||
},
|
||||
"seafile-js": {
|
||||
"version": "0.2.52",
|
||||
"resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.52.tgz",
|
||||
"integrity": "sha512-Hu0d6aXl2nL77D53XgeN9B1AGbBcxrrA8D+prxasWqFn2lqIf0Jv0AGXQRBEY5MYIG7VDIGj8a3eQAndNjN6vQ==",
|
||||
"version": "0.2.53",
|
||||
"resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.53.tgz",
|
||||
"integrity": "sha512-uxQF6mNUe7Z/jEI0E7SS8hSFbC7P/JcETlGZOeFgavdlIOH81twveLAehdmV4uPKEsG7sqvXa2UJDsoHKuUDBA==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0",
|
||||
"form-data": "^2.3.2",
|
||||
|
@@ -31,7 +31,7 @@
|
||||
"react-moment": "^0.7.9",
|
||||
"react-select": "^2.1.1",
|
||||
"reactstrap": "^6.4.0",
|
||||
"seafile-js": "^0.2.52",
|
||||
"seafile-js": "^0.2.53",
|
||||
"seafile-ui": "^0.1.10",
|
||||
"socket.io-client": "^2.2.0",
|
||||
"sw-precache-webpack-plugin": "0.11.4",
|
||||
|
@@ -176,12 +176,12 @@ class FilesActivities extends Component {
|
||||
hasMore: true,
|
||||
items: [],
|
||||
};
|
||||
this.avatarSize = 72;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const avatarSize = 72;
|
||||
let currentPage = this.state.currentPage;
|
||||
seafileAPI.listActivities(currentPage, avatarSize).then(res => {
|
||||
seafileAPI.listActivities(currentPage, this.avatarSize).then(res => {
|
||||
// {"events":[...]}
|
||||
this.setState({
|
||||
items: res.data.events,
|
||||
@@ -200,9 +200,8 @@ class FilesActivities extends Component {
|
||||
}
|
||||
|
||||
getMore() {
|
||||
this.setState({isLoadingMore: true});
|
||||
let currentPage = this.state.currentPage;
|
||||
seafileAPI.listActivities(currentPage).then(res => {
|
||||
seafileAPI.listActivities(currentPage, this.avatarSize).then(res => {
|
||||
// {"events":[...]}
|
||||
this.setState({
|
||||
isLoadingMore: false,
|
||||
@@ -221,12 +220,16 @@ class FilesActivities extends Component {
|
||||
}
|
||||
|
||||
handleScroll = (event) => {
|
||||
const clientHeight = event.target.clientHeight;
|
||||
const scrollHeight = event.target.scrollHeight;
|
||||
const scrollTop = event.target.scrollTop;
|
||||
const isBottom = (clientHeight + scrollTop + 1 >= scrollHeight);
|
||||
if (this.state.hasMore && isBottom) { // scroll to the bottom
|
||||
this.getMore();
|
||||
if (!this.state.isLoadingMore && this.state.hasMore) {
|
||||
const clientHeight = event.target.clientHeight;
|
||||
const scrollHeight = event.target.scrollHeight;
|
||||
const scrollTop = event.target.scrollTop;
|
||||
const isBottom = (clientHeight + scrollTop + 1 >= scrollHeight);
|
||||
if (isBottom) { // scroll to the bottom
|
||||
this.setState({isLoadingMore: true}, () => {
|
||||
this.getMore();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user