mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
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
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import type { ContentPiecePublicItem } from '@/lib/contentPieceCatalog'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
import { CONTENT_PIECE_OUTLINE_BUTTON, CONTENT_PIECE_PRIMARY_BUTTON } from './contentPieceClasses'
|
|
|
|
/**
|
|
* S27 — the two per-piece actions, single-owned (artefato: cenas 01/04/07): the
|
|
* download is the SAME public file with the legible name (a link piece has no
|
|
* file and renders no download), and share always opens the vote sheet.
|
|
*/
|
|
|
|
export const ContentPieceDownloadLink = ({
|
|
item,
|
|
className,
|
|
}: {
|
|
item: ContentPiecePublicItem
|
|
className?: string
|
|
}) =>
|
|
item.file ? (
|
|
<a
|
|
href={`${item.file.path}?download=1`}
|
|
download={item.file.downloadFilename}
|
|
aria-label={`Baixar ${item.title}`}
|
|
className={cn(CONTENT_PIECE_OUTLINE_BUTTON, className)}
|
|
>
|
|
Baixar
|
|
</a>
|
|
) : null
|
|
|
|
export const ContentPieceShareButton = <Item extends { title: string }>({
|
|
item,
|
|
onShare,
|
|
className,
|
|
}: {
|
|
item: Item
|
|
onShare: (item: Item) => void
|
|
className?: string
|
|
}) => (
|
|
<button
|
|
type="button"
|
|
onClick={() => onShare(item)}
|
|
aria-label={`Compartilhar ${item.title}`}
|
|
className={cn(CONTENT_PIECE_PRIMARY_BUTTON, className)}
|
|
>
|
|
Compartilhar
|
|
</button>
|
|
)
|