This commit is contained in:
ilya-bkv 2024-03-29 12:30:38 +03:00
parent 78dd43a497
commit 0b88357f7c
2 changed files with 5 additions and 8 deletions

View File

@ -26,6 +26,7 @@ type Props = {
export const PRERENDERED_ARTICLES_COUNT = 36
const LOAD_MORE_PAGE_SIZE = 12
const PARTIAL_PAGE_SIZE = 8
export const Expo = (props: Props) => {
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.shouts))
@ -34,8 +35,6 @@ export const Expo = (props: Props) => {
const [randomTopArticles, setRandomTopArticles] = createSignal<Shout[]>([])
const [randomTopMonthArticles, setRandomTopMonthArticles] = createSignal<Shout[]>([])
console.log('%c!!! randomTopMonthArticles():', 'color: #bada55', randomTopMonthArticles())
const { t } = useLocalize()
const { sortedArticles } = useArticlesStore({
@ -50,7 +49,7 @@ export const Expo = (props: Props) => {
if (props.layout) {
filters.layouts.push(props.layout)
} else {
filters.layouts.push('article')
filters.layouts.push('audio', 'video', 'image', 'literature')
}
return filters
@ -83,7 +82,6 @@ export const Expo = (props: Props) => {
limit: 10,
random_limit: 100,
}
console.log('%c!!! options:', 'color: #bada55', options)
const result = await apiClient.getRandomTopShouts({ options })
setRandomTopArticles(result)
}
@ -201,7 +199,7 @@ export const Expo = (props: Props) => {
</li>
</ul>
<div class="row">
<For each={sortedArticles().slice(0, LOAD_MORE_PAGE_SIZE / 2)}>
<For each={sortedArticles().slice(0, PARTIAL_PAGE_SIZE)}>
{(shout) => (
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
<ArticleCard
@ -216,7 +214,7 @@ export const Expo = (props: Props) => {
<Show when={randomTopMonthArticles()?.length > 0} keyed={true}>
<ArticleCardSwiper title={t('Top month articles')} slides={randomTopMonthArticles()} />
</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) => (
<div class="col-md-6 mt-md-5 col-sm-8 mt-sm-3">
<ArticleCard

View File

@ -172,7 +172,6 @@ export const TopicView = (props: Props) => {
/>
<ArticleCardSwiper title={title()} slides={sortedArticles().slice(5, 11)} />
<Beside
beside={sortedArticles()[12]}
title={t('Top viewed')}
@ -184,7 +183,7 @@ export const TopicView = (props: Props) => {
<Row1 article={sortedArticles()[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)} />
<Row2 articles={sortedArticles().slice(26, 28)} />
</Show>