fix(ecommerce): tipar defaultTile igual que las entradas de tileContent
Build and Push Frontend / Escaneo de Secretos (Gitleaks) (pull_request) Successful in 49s
Build and Push Frontend / Construir y Subir Imagen (pull_request) Skipped

next build fallaba en tsc: defaultTile no tenia la propiedad opcional
image, asi que la union de tipos entre tileContent[handle] y defaultTile
perdia esa propiedad y content.image no compilaba. Se extrae el tipo
TileContent y se anota defaultTile con el, igual que tileContent.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013dunTcReWMKhWgCPkvAVHD
This commit is contained in:
devopsandClaude Sonnet 5 committed 2026-08-24 22:37:24 -05:00
1 parent 20bc559a6c
commit bd956328db
1 file changed
+4 -2
@@ -3,11 +3,13 @@ import Link from "next/link";
import { ArrowUpRight } from "lucide-react";
import type { Category } from "@/lib/headless/types";
type TileContent = { subtitle: string; image?: string; color: string };
// No hay fotografia real todavia para las 6 categorias raiz de la taxonomia
// (ver ADR 0005) -- solo se mapean imagen/subtitulo para las que ya tienen
// un asset en public/images/categories/. Las demas caen al tile de solo
// gradiente en vez de mostrar una imagen que no les corresponde.
const tileContent: Record<string, { subtitle: string; image?: string; color: string }> = {
const tileContent: Record<string, TileContent> = {
juguetes: { subtitle: "Personajes que inspiran", image: "/images/categories/figuras.webp", color: "from-yellow-300 to-orange-400" },
"mochilas-y-morrales": { subtitle: "Estilo para cada aventura", image: "/images/categories/mochilas.webp", color: "from-cyan-400 to-blue-500" },
"bebes-y-primera-infancia": { subtitle: "Primeros descubrimientos", color: "from-pink-300 to-fuchsia-400" },
@@ -16,7 +18,7 @@ const tileContent: Record<string, { subtitle: string; image?: string; color: str
variedades: { subtitle: "Un poco de todo", color: "from-violet-400 to-purple-600" },
};
const defaultTile = { subtitle: "Explora esta categoría", color: "from-slate-400 to-slate-600" };
const defaultTile: TileContent = { subtitle: "Explora esta categoría", color: "from-slate-400 to-slate-600" };
export function CategoryTiles({ categories }: { categories: Category[] }) {
const roots = categories.filter((category) => !category.parentId);