Fix expo
This commit is contained in:
parent
78dd43a497
commit
0b88357f7c
|
@ -26,6 +26,7 @@ type Props = {
|
||||||
|
|
||||||
export const PRERENDERED_ARTICLES_COUNT = 36
|
export const PRERENDERED_ARTICLES_COUNT = 36
|
||||||
const LOAD_MORE_PAGE_SIZE = 12
|
const LOAD_MORE_PAGE_SIZE = 12
|
||||||
|
const PARTIAL_PAGE_SIZE = 8
|
||||||
|
|
||||||
export const Expo = (props: Props) => {
|
export const Expo = (props: Props) => {
|
||||||
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.shouts))
|
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.shouts))
|
||||||
|
@ -34,8 +35,6 @@ export const Expo = (props: Props) => {
|
||||||
const [randomTopArticles, setRandomTopArticles] = createSignal<Shout[]>([])
|
const [randomTopArticles, setRandomTopArticles] = createSignal<Shout[]>([])
|
||||||
const [randomTopMonthArticles, setRandomTopMonthArticles] = createSignal<Shout[]>([])
|
const [randomTopMonthArticles, setRandomTopMonthArticles] = createSignal<Shout[]>([])
|
||||||
|
|
||||||
console.log('%c!!! randomTopMonthArticles():', 'color: #bada55', randomTopMonthArticles())
|
|
||||||
|
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
|
||||||
const { sortedArticles } = useArticlesStore({
|
const { sortedArticles } = useArticlesStore({
|
||||||
|
@ -50,7 +49,7 @@ export const Expo = (props: Props) => {
|
||||||
if (props.layout) {
|
if (props.layout) {
|
||||||
filters.layouts.push(props.layout)
|
filters.layouts.push(props.layout)
|
||||||
} else {
|
} else {
|
||||||
filters.layouts.push('article')
|
filters.layouts.push('audio', 'video', 'image', 'literature')
|
||||||
}
|
}
|
||||||
|
|
||||||
return filters
|
return filters
|
||||||
|
@ -83,7 +82,6 @@ export const Expo = (props: Props) => {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
random_limit: 100,
|
random_limit: 100,
|
||||||
}
|
}
|
||||||
console.log('%c!!! options:', 'color: #bada55', options)
|
|
||||||
const result = await apiClient.getRandomTopShouts({ options })
|
const result = await apiClient.getRandomTopShouts({ options })
|
||||||
setRandomTopArticles(result)
|
setRandomTopArticles(result)
|
||||||
}
|
}
|
||||||
|
@ -201,7 +199,7 @@ export const Expo = (props: Props) => {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<For each={sortedArticles().slice(0, LOAD_MORE_PAGE_SIZE / 2)}>
|
<For each={sortedArticles().slice(0, PARTIAL_PAGE_SIZE)}>
|
||||||
{(shout) => (
|
{(shout) => (
|
||||||
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
|
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
|
||||||
<ArticleCard
|
<ArticleCard
|
||||||
|
@ -216,7 +214,7 @@ export const Expo = (props: Props) => {
|
||||||
<Show when={randomTopMonthArticles()?.length > 0} keyed={true}>
|
<Show when={randomTopMonthArticles()?.length > 0} keyed={true}>
|
||||||
<ArticleCardSwiper title={t('Top month articles')} slides={randomTopMonthArticles()} />
|
<ArticleCardSwiper title={t('Top month articles')} slides={randomTopMonthArticles()} />
|
||||||
</Show>
|
</Show>
|
||||||
<For each={sortedArticles().slice(LOAD_MORE_PAGE_SIZE / 2, LOAD_MORE_PAGE_SIZE)}>
|
<For each={sortedArticles().slice(PARTIAL_PAGE_SIZE, PARTIAL_PAGE_SIZE * 2)}>
|
||||||
{(shout) => (
|
{(shout) => (
|
||||||
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
|
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
|
||||||
<ArticleCard
|
<ArticleCard
|
||||||
|
|
|
@ -172,7 +172,6 @@ export const TopicView = (props: Props) => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ArticleCardSwiper title={title()} slides={sortedArticles().slice(5, 11)} />
|
<ArticleCardSwiper title={title()} slides={sortedArticles().slice(5, 11)} />
|
||||||
|
|
||||||
<Beside
|
<Beside
|
||||||
beside={sortedArticles()[12]}
|
beside={sortedArticles()[12]}
|
||||||
title={t('Top viewed')}
|
title={t('Top viewed')}
|
||||||
|
@ -184,7 +183,7 @@ export const TopicView = (props: Props) => {
|
||||||
<Row1 article={sortedArticles()[15]} />
|
<Row1 article={sortedArticles()[15]} />
|
||||||
|
|
||||||
<Show when={sortedArticles().length > 15}>
|
<Show when={sortedArticles().length > 15}>
|
||||||
<ArticleCardSwiper slides={sortedArticles().slice(16, 22)} />
|
<ArticleCardSwiper title={t('Favorite')} slides={sortedArticles().slice(16, 22)} />
|
||||||
<Row3 articles={sortedArticles().slice(23, 26)} />
|
<Row3 articles={sortedArticles().slice(23, 26)} />
|
||||||
<Row2 articles={sortedArticles().slice(26, 28)} />
|
<Row2 articles={sortedArticles().slice(26, 28)} />
|
||||||
</Show>
|
</Show>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user