expo random tops fixes (#337)
Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
This commit is contained in:
parent
63494e9d04
commit
ffde754a43
|
@ -58,7 +58,6 @@ export const Expo = (props: Props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadMore = async (count: number) => {
|
const loadMore = async (count: number) => {
|
||||||
saveScrollPosition()
|
|
||||||
const options: LoadShoutsOptions = {
|
const options: LoadShoutsOptions = {
|
||||||
filters: getLoadShoutsFilters(),
|
filters: getLoadShoutsFilters(),
|
||||||
limit: count,
|
limit: count,
|
||||||
|
@ -67,6 +66,11 @@ export const Expo = (props: Props) => {
|
||||||
|
|
||||||
const { hasMore } = await loadShouts(options)
|
const { hasMore } = await loadShouts(options)
|
||||||
setIsLoadMoreButtonVisible(hasMore)
|
setIsLoadMoreButtonVisible(hasMore)
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadMoreWithoutScrolling = async (count: number) => {
|
||||||
|
saveScrollPosition()
|
||||||
|
await loadMore(count)
|
||||||
restoreScrollPosition()
|
restoreScrollPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +141,7 @@ export const Expo = (props: Props) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleLoadMoreClick = () => {
|
const handleLoadMoreClick = () => {
|
||||||
loadMore(LOAD_MORE_PAGE_SIZE)
|
loadMoreWithoutScrolling(LOAD_MORE_PAGE_SIZE)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -206,8 +210,8 @@ export const Expo = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
<Show when={randomTopArticles().length > 0} keyed={true}>
|
<Show when={randomTopMonthArticles().length > 0} keyed={true}>
|
||||||
<ArticleCardSwiper title={t('Favorite')} slides={randomTopArticles()} />
|
<ArticleCardSwiper title={t('Top month articles')} slides={randomTopMonthArticles()} />
|
||||||
</Show>
|
</Show>
|
||||||
<For each={sortedArticles().slice(PRERENDERED_ARTICLES_COUNT / 2, PRERENDERED_ARTICLES_COUNT)}>
|
<For each={sortedArticles().slice(PRERENDERED_ARTICLES_COUNT / 2, PRERENDERED_ARTICLES_COUNT)}>
|
||||||
{(shout) => (
|
{(shout) => (
|
||||||
|
@ -220,8 +224,8 @@ export const Expo = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
<Show when={randomTopMonthArticles().length > 0} keyed={true}>
|
<Show when={randomTopArticles().length > 0} keyed={true}>
|
||||||
<ArticleCardSwiper title={t('Top month articles')} slides={randomTopMonthArticles()} />
|
<ArticleCardSwiper title={t('Favorite')} slides={randomTopArticles()} />
|
||||||
</Show>
|
</Show>
|
||||||
<For each={pages()}>
|
<For each={pages()}>
|
||||||
{(page) => (
|
{(page) => (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user