--- import CategoryBadge from './CategoryBadge.astro'; import Author from '@components/AuthorDisplay.astro'; export interface Props { items: any[]; showCount?: boolean; type: 'latest' | 'category' | 'author' | 'tag'; slug?: string; pageInfo?: { hasNextPage: boolean; endCursor: string | null; }; perLoad?: number; // Переименовали first в perLoad } const { items = [], showCount = false, type = 'latest', slug = '', pageInfo = { hasNextPage: false, endCursor: null }, perLoad = 11 // perLoad на верхнем уровне с дефолтом 11 } = Astro.props; // Формируем конфиг для sentinel из пропсов верхнего уровня // Внутри оставляем поле first для совместимости с API и скриптом const loadMoreConfig = { type, slug, first: perLoad // Маппим perLoad в first для обратной совместимости }; function getCoauthorsNames(coauthors: any[]): string { if (!coauthors || coauthors.length === 0) return ''; return coauthors .map((coauthor: any) => coauthor?.node?.name || coauthor?.name) .filter(Boolean) .join(' '); } function shouldBeLarge(index: number): boolean { if (index < 8) return false; return (index - 8) % 11 === 0; } ---

{showCount && items.length > 0 && ( ({items.length}) )}

{items.map((item, index) => { const postUrl = item.uri || `/blog/${item.databaseId}`; const postDate = new Date(item.date); const coauthorsNames = getCoauthorsNames(item.coauthors || []); const isLarge = shouldBeLarge(index); return ( ); })}
{pageInfo.hasNextPage && (
)}