import { CampaignArticleCard, type CampaignArticleCardData } from '@/components/CampaignArticleCard' import { CampaignContentCarousel } from '@/components/CampaignContentCarousel' import type { Post } from '@/payload-types' import { formatRelativePostDate, getCategoryName, getPostCanonicalPath, getVisiblePosts, POST_TYPE_BADGE_LABELS, } from '@/utilities/posts' import Link from 'next/link' const CONTENT_SECTION_LIMIT = 5 const toCardData = (post: Post): CampaignArticleCardData | null => { const href = getPostCanonicalPath(post) if (!href) return null const cover = typeof post.coverImage === 'object' && post.coverImage !== null ? post.coverImage : null const categoryName = getCategoryName(post) const date = formatRelativePostDate(post.publishedDate) return { id: post.id, href, title: post.title, badgeLabel: POST_TYPE_BADGE_LABELS[post.type], meta: [date, categoryName].filter(Boolean).join(' · '), ...(cover?.url ? { coverUrl: cover.url, coverAlt: cover.alt ?? undefined } : {}), ...(post.subtitle ? { subtitle: post.subtitle } : {}), } } /** * Campaign home content board (S1 — articles): the 5 most recent visible posts * as a 1+4 bento on desktop and a one-per-screen carousel on mobile. Hides * entirely when nothing is visible (`isPostVisible` fail-closed — hidden * electoral tags never leak). */ export const CampaignContentSection = async () => { const cards = (await getVisiblePosts()) .map(toCardData) .filter((card): card is CampaignArticleCardData => card !== null) .slice(0, CONTENT_SECTION_LIMIT) if (!cards.length) return null const [featured, ...rest] = cards return (

Acompanhe de perto

A caminhada, em tempo real

Bastidores, caravanas e as lutas do mandato: conteúdo atualizado, direto das redes.

Ver artigos →
{rest.map((card) => ( ))}
) }