From 0742add9e684bf456bf07b2eda31806ffddec6ca Mon Sep 17 00:00:00 2001 From: 4Ventures <4ventures@MacBook-Air-de-4Ventures.local> Date: Fri, 16 Oct 2026 13:40:45 +0200 Subject: [PATCH] =?UTF-8?q?fix(brandkit):=20permitir=20frases=20en=20l?= =?UTF-8?q?=C3=A9xico=20y=20formato=20con=20botones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El trim en cada tecla impedía escribir espacios en listas (léxico). El formato de pieza usa los mismos botones que el filtro, sin dropdown. Co-authored-by: Cursor --- src/components/BrandZone.tsx | 17 ++++- src/components/CreativePipelineBoard.tsx | 94 ++++++++++++++++-------- src/lib/brandbook.ts | 20 ++++- 3 files changed, 94 insertions(+), 37 deletions(-) diff --git a/src/components/BrandZone.tsx b/src/components/BrandZone.tsx index c3dc833..a43a04c 100644 --- a/src/components/BrandZone.tsx +++ b/src/components/BrandZone.tsx @@ -35,6 +35,7 @@ import type { B2BAnalysisResult } from '@/lib/b2b-analyzer'; import { ASSET_KIND_LABELS, emptyBrandbook, + finalizeLinesList, linesToList, listToLines, newId, @@ -278,11 +279,23 @@ export default function BrandZone({ setErr(null); setOkMsg(null); try { + // Trim list fields only on save — mid-edit we keep spaces so phrases work. + const cleaned = { ...book } as Brandbook & Record; + for (const key of Object.keys(cleaned)) { + const v = cleaned[key]; + if ( + Array.isArray(v) && + v.length >= 0 && + v.every((x) => typeof x === 'string') + ) { + cleaned[key] = finalizeLinesList(v as string[]); + } + } const query = tenantId ? `?tenant_id=${encodeURIComponent(tenantId)}` : ''; const r = await fetch(`/api/brandbook${query}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ brandbook: book, tenant_id: tenantId }), + body: JSON.stringify({ brandbook: cleaned, tenant_id: tenantId }), }); const j = await r.json(); if (!r.ok) throw new Error(j.error || 'No se pudo guardar'); @@ -1061,6 +1074,7 @@ export default function BrandZone({