Added MIN_UNAUTHENTICATED_PAGES for pagination of group, explore timelines
• Added: - MIN_UNAUTHENTICATED_PAGES for pagination of group, explore timelines
This commit is contained in:
parent
0ef9d8410f
commit
be38ed784c
@ -13,6 +13,8 @@ export const BREAKPOINT_EXTRA_SMALL = 992
|
|||||||
|
|
||||||
export const MOUSE_IDLE_DELAY = 300
|
export const MOUSE_IDLE_DELAY = 300
|
||||||
|
|
||||||
|
export const MIN_UNAUTHENTICATED_PAGES = 1
|
||||||
|
|
||||||
export const LAZY_LOAD_SCROLL_OFFSET = 50
|
export const LAZY_LOAD_SCROLL_OFFSET = 50
|
||||||
|
|
||||||
export const ALLOWED_AROUND_SHORT_CODE = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'
|
export const ALLOWED_AROUND_SHORT_CODE = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
setGroupTimelineSort,
|
setGroupTimelineSort,
|
||||||
} from '../actions/groups'
|
} from '../actions/groups'
|
||||||
import {
|
import {
|
||||||
|
MIN_UNAUTHENTICATED_PAGES,
|
||||||
GROUP_TIMELINE_SORTING_TYPE_HOT,
|
GROUP_TIMELINE_SORTING_TYPE_HOT,
|
||||||
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
||||||
} from '../constants'
|
} from '../constants'
|
||||||
@ -24,7 +25,7 @@ class ExploreTimeline extends React.PureComponent {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
//keep track of page loads for if no user,
|
//keep track of page loads for if no user,
|
||||||
//only allow 2 page loads before showing sign up msg
|
//only allow MIN_UNAUTHENTICATED_PAGES page loads before showing sign up msg
|
||||||
page: 1,
|
page: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ class ExploreTimeline extends React.PureComponent {
|
|||||||
const { page } = this.state
|
const { page } = this.state
|
||||||
|
|
||||||
const newPage = !!maxId ? this.state.page + 1 : 1
|
const newPage = !!maxId ? this.state.page + 1 : 1
|
||||||
if (!!maxId && !me && page >= 2) return false
|
if (!!maxId && !me && page >= MIN_UNAUTHENTICATED_PAGES) return false
|
||||||
this.setState({ page: newPage })
|
this.setState({ page: newPage })
|
||||||
|
|
||||||
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
||||||
@ -71,7 +72,7 @@ class ExploreTimeline extends React.PureComponent {
|
|||||||
const { intl } = this.props
|
const { intl } = this.props
|
||||||
const { page } = this.state
|
const { page } = this.state
|
||||||
|
|
||||||
const canLoadMore = page < 2 && !me || !!me
|
const canLoadMore = page < MIN_UNAUTHENTICATED_PAGES && !me || !!me
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
setGroupTimelineSort,
|
setGroupTimelineSort,
|
||||||
} from '../actions/groups'
|
} from '../actions/groups'
|
||||||
import {
|
import {
|
||||||
|
MIN_UNAUTHENTICATED_PAGES,
|
||||||
GROUP_TIMELINE_SORTING_TYPE_HOT,
|
GROUP_TIMELINE_SORTING_TYPE_HOT,
|
||||||
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
||||||
} from '../constants'
|
} from '../constants'
|
||||||
@ -25,7 +26,7 @@ class GroupCollectionTimeline extends React.PureComponent {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
//keep track of page loads for if no user,
|
//keep track of page loads for if no user,
|
||||||
//only allow 2 page loads before showing sign up msg
|
//only allow MIN_UNAUTHENTICATED_PAGES page loads before showing sign up msg
|
||||||
page: 1,
|
page: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class GroupCollectionTimeline extends React.PureComponent {
|
|||||||
const { page } = this.state
|
const { page } = this.state
|
||||||
|
|
||||||
const newPage = !!maxId ? this.state.page + 1 : 1
|
const newPage = !!maxId ? this.state.page + 1 : 1
|
||||||
if (!!maxId && !me && page >= 2) return false
|
if (!!maxId && !me && page >= MIN_UNAUTHENTICATED_PAGES) return false
|
||||||
this.setState({ page: newPage })
|
this.setState({ page: newPage })
|
||||||
|
|
||||||
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
||||||
@ -90,7 +91,7 @@ class GroupCollectionTimeline extends React.PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
) : intl.formatMessage(messages.empty)
|
) : intl.formatMessage(messages.empty)
|
||||||
|
|
||||||
const canLoadMore = page < 2 && !me || !!me
|
const canLoadMore = page < MIN_UNAUTHENTICATED_PAGES && !me || !!me
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
setGroupTimelineSort,
|
setGroupTimelineSort,
|
||||||
} from '../actions/groups'
|
} from '../actions/groups'
|
||||||
import {
|
import {
|
||||||
|
MIN_UNAUTHENTICATED_PAGES,
|
||||||
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
|
||||||
} from '../constants'
|
} from '../constants'
|
||||||
import StatusList from '../components/status_list'
|
import StatusList from '../components/status_list'
|
||||||
@ -26,7 +27,7 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
//keep track of page loads for if no user,
|
//keep track of page loads for if no user,
|
||||||
//only allow 2 page loads before showing sign up msg
|
//only allow MIN_UNAUTHENTICATED_PAGES page loads before showing sign up msg
|
||||||
page: 1,
|
page: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
const { page } = this.state
|
const { page } = this.state
|
||||||
|
|
||||||
const newPage = !!maxId ? this.state.page + 1 : 1
|
const newPage = !!maxId ? this.state.page + 1 : 1
|
||||||
if (!!maxId && !me && page >= 2) return false
|
if (!!maxId && !me && page >= MIN_UNAUTHENTICATED_PAGES) return false
|
||||||
this.setState({ page: newPage })
|
this.setState({ page: newPage })
|
||||||
|
|
||||||
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
const sortBy = getSortBy(sortByValue, sortByTopValue)
|
||||||
@ -102,7 +103,7 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
return <ColumnIndicator type='missing' />
|
return <ColumnIndicator type='missing' />
|
||||||
}
|
}
|
||||||
|
|
||||||
const canLoadMore = page < 2 && !me || !!me
|
const canLoadMore = page < MIN_UNAUTHENTICATED_PAGES && !me || !!me
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
Loading…
Reference in New Issue
Block a user