teqo-backup/src/components/conteudos/ContentPieceHomeSection.tsx
Francisco Solla 862da74fbe feat(S42): seção da Central compartilha a peça e abre /conteudos já filtrada
A seção S39 era só vitrine: quem via a peça do seu território tinha de ir
até o catálogo para compartilhar ou recortar. O card agora abre a MESMA
folha do S27 (mensagem de voto por tipo, contador C213, sem sair da home) e
as tags com faceta honesta — mais a fileira Tipo | Cidade | Região — levam
a /conteudos já filtrada pelo construtor canônico; nada filtra a amostra
local e as tags sem faceta (Mais recente, origem) continuam estáticas.

As facetas da fileira são derivadas no server (contentPieceCatalogFacets,
mesmo vocabulário do catálogo) e o lean ContentPieceHomeItem ganha só
sourceUrl, com a folha S27 estreitada ao que lê; classes novas são
home-scoped — CONTENT_PIECE_TAG e /conteudos ficam intactos. Sem migration,
Consent ou analytics novos.

Closes #1391
2026-09-30 01:09:07 -03:00

47 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { contentPieceCatalogFacets, type ContentPiecePublicItem } from '@/lib/contentPieceCatalog'
import { toContentPieceHomeItem } from '@/lib/contentPieceHomeSelection'
import { ContentPieceHomeBoard } from './ContentPieceHomeBoard'
/**
* S39 — the home section advertising the Central de Conteúdos (artefato: cenas
* 01–06). The page resolves the cached listing once and only renders this when
* something is published (fail-closed, same kill switch as the footer link);
* the lean projection keeps the search haystack out of the static HTML.
*
* S42 — the explore row's facets are derived here, before the projection, from
* the same catalogue owner the catalogue page uses (the lean item keeps only
* what the card renders).
*/
export const ContentPieceHomeSection = ({
items,
}: {
items: readonly ContentPiecePublicItem[]
}) => {
const facets = contentPieceCatalogFacets(items)
return (
<section
aria-labelledby="content-pieces-title"
data-home-section="content-pieces"
className="relative overflow-hidden border-b border-(--campaign-line) bg-white"
>
<div
aria-hidden="true"
className="pointer-events-none absolute -top-24 -right-20 size-64 rounded-full bg-(--pt-yellow)/35"
/>
<div
aria-hidden="true"
className="pointer-events-none absolute -bottom-28 -left-24 size-64 rounded-full bg-[#e4102f]/8"
/>
<div className="relative mx-auto w-full max-w-[1160px] px-5 py-10 sm:px-8 lg:px-10 lg:py-16">
<ContentPieceHomeBoard
items={items.map(toContentPieceHomeItem)}
// Only the row's three facets cross to the client island; the other
// option lists (tema/instituição/liderança) stay on the server.
facets={{ tipo: facets.tipo, cidade: facets.cidade, regiao: facets.regiao }}
/>
</div>
</section>
)
}