mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 20:46:40 -04:00
fix daily view pagination
This commit is contained in:
parent
33e46fc6a9
commit
94b514675f
1 changed files with 11 additions and 7 deletions
|
@ -26,14 +26,18 @@ class PostsDailyList extends Component{
|
||||||
loadMoreDays(e) {
|
loadMoreDays(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const numberOfDays = getSetting('numberOfDays', 5);
|
const numberOfDays = getSetting('numberOfDays', 5);
|
||||||
const loadMoreBefore = moment(this.state.after, 'YYYY-MM-DD').subtract(1, 'days').format('YYYY-MM-DD');
|
|
||||||
|
/*
|
||||||
|
note: loadMoreBefore is used when doing incremental loading,
|
||||||
|
but we're not doing that anymore so we only need to change 'after'
|
||||||
|
*/
|
||||||
|
|
||||||
|
// const loadMoreBefore = moment(this.state.after, 'YYYY-MM-DD').subtract(1, 'days').format('YYYY-MM-DD');
|
||||||
const loadMoreAfter = moment(this.state.after, 'YYYY-MM-DD').subtract(numberOfDays, 'days').format('YYYY-MM-DD');
|
const loadMoreAfter = moment(this.state.after, 'YYYY-MM-DD').subtract(numberOfDays, 'days').format('YYYY-MM-DD');
|
||||||
this.props.loadMore({
|
this.props.loadMore({
|
||||||
terms: {
|
...this.props.terms,
|
||||||
view: 'top',
|
// before: loadMoreBefore,
|
||||||
before: loadMoreBefore,
|
after: loadMoreAfter,
|
||||||
after: loadMoreAfter,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
days: this.state.days + this.props.increment,
|
days: this.state.days + this.props.increment,
|
||||||
|
@ -59,7 +63,7 @@ class PostsDailyList extends Component{
|
||||||
return (
|
return (
|
||||||
<div className="posts-daily">
|
<div className="posts-daily">
|
||||||
<Components.PostsListHeader />
|
<Components.PostsListHeader />
|
||||||
{postsByDates.map((day, index) => <Components.PostsDay key={index} number={index} {...day} />)}
|
{postsByDates.map((day, index) => <Components.PostsDay key={index} number={index} {...day} loading={true} />)}
|
||||||
<a className="posts-load-more-days" onClick={this.loadMoreDays}><FormattedMessage id="posts.load_more_days"/></a>
|
<a className="posts-load-more-days" onClick={this.loadMoreDays}><FormattedMessage id="posts.load_more_days"/></a>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue