mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
Dashboard module improve (#2788)
This commit is contained in:
@@ -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