From 91380e2285f4f8cc06d3f32655e5fb52ecfdeea2 Mon Sep 17 00:00:00 2001 From: 4Ventures <4ventures@MacBook-Air-de-4Ventures.local> Date: Tue, 6 Oct 2026 16:54:38 +0200 Subject: [PATCH] Revert unsolicited creative pipeline review-only changes. Restore CreativesPipeline on /creatives and the previous board/API behavior (published pieces visible again; no forced reject note). Co-authored-by: Cursor --- src/app/api/creative-pipeline/route.ts | 16 +--- src/app/dashboard/creatives/page.tsx | 8 +- src/components/CreativePipelineBoard.tsx | 110 ++--------------------- 3 files changed, 12 insertions(+), 122 deletions(-) diff --git a/src/app/api/creative-pipeline/route.ts b/src/app/api/creative-pipeline/route.ts index a0671c1..40d1767 100644 --- a/src/app/api/creative-pipeline/route.ts +++ b/src/app/api/creative-pipeline/route.ts @@ -189,7 +189,7 @@ export async function PATCH(req: NextRequest) { const curRes = await fetch( `${supabaseUrl()}/rest/v1/creative_pipeline?id=eq.${encodeURIComponent( id - )}&tenant_id=eq.${encodeURIComponent(ctx.tenantId)}&select=status,notes`, + )}&tenant_id=eq.${encodeURIComponent(ctx.tenantId)}&select=status`, { headers: headers || undefined, cache: 'no-store' } ); const curRows = curRes.ok ? await curRes.json() : []; @@ -215,20 +215,6 @@ export async function PATCH(req: NextRequest) { ); } clean.status = next; - if (next === 'rechazado') { - const note = str(body.notes, 2000); - if (!note) { - return NextResponse.json( - { error: 'Añade una nota explicando qué hay que cambiar.' }, - { status: 400 } - ); - } - const prev = str(curRows?.[0]?.notes, 2000) || ''; - const line = `CLIENT_NOTE: ${note}`; - clean.notes = prev.includes(line) - ? prev - : [line, prev].filter(Boolean).join('\n'); - } } if (next === 'aprobado') { clean.approved_by = user.id; diff --git a/src/app/dashboard/creatives/page.tsx b/src/app/dashboard/creatives/page.tsx index 3f2eb02..b4ba898 100644 --- a/src/app/dashboard/creatives/page.tsx +++ b/src/app/dashboard/creatives/page.tsx @@ -1,11 +1,11 @@ /** - * Pipeline de creatividades — cola de revisión (no archivo publicado). - * Lo publicado se abre en el calendario, día a día. + * Pipeline de creatividades — cola de aprobación con preview de placement + * (Meta/Google Ads + RRSS), estilo Ad Tracker. */ 'use client'; -import CreativePipelineBoard from '@/components/CreativePipelineBoard'; +import CreativesPipeline from '@/components/CreativesPipeline'; export default function CreativesPage() { - return ; + return ; } diff --git a/src/components/CreativePipelineBoard.tsx b/src/components/CreativePipelineBoard.tsx index 6977671..72394f3 100644 --- a/src/components/CreativePipelineBoard.tsx +++ b/src/components/CreativePipelineBoard.tsx @@ -16,8 +16,6 @@ import { Filter, } from 'lucide-react'; import { PageHeader, Surface } from '@/components/ui'; -import { clientNoteFromNotes } from '@/lib/pipeline-calendar'; -import Link from 'next/link'; type PipelineItem = { id: string; @@ -110,8 +108,6 @@ export default function CreativePipelineBoard() { const [selectedMonth, setSelectedMonth] = useState('all'); const [selectedFormat, setSelectedFormat] = useState('all'); const [previewItem, setPreviewItem] = useState(null); - const [rejectItem, setRejectItem] = useState(null); - const [rejectNote, setRejectNote] = useState(''); async function load() { setLoading(true); @@ -133,7 +129,6 @@ export default function CreativePipelineBoard() { const monthCounts = useMemo(() => { const map = new Map(); for (const it of items) { - if (it.status === 'publicado') continue; const key = it.month || 'sin-mes'; map.set(key, (map.get(key) || 0) + 1); } @@ -143,7 +138,6 @@ export default function CreativePipelineBoard() { const months = useMemo(() => { const set = new Set(); for (const it of items) { - if (it.status === 'publicado') continue; if (it.month) set.add(it.month); } return Array.from(set).sort(); @@ -151,7 +145,6 @@ export default function CreativePipelineBoard() { const filteredItems = useMemo(() => { return items.filter((it) => { - if (it.status === 'publicado') return false; if (selectedMonth !== 'all' && (it.month || 'sin-mes') !== selectedMonth) return false; if (selectedFormat !== 'all' && it.format !== selectedFormat) return false; return true; @@ -188,14 +181,14 @@ export default function CreativePipelineBoard() { await load(); } - async function setStatus(id: string, status: string, notes?: string) { + async function setStatus(id: string, status: string) { setBusyId(id); setErr(null); try { const res = await fetch('/api/creative-pipeline', { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ id, status, ...(notes ? { notes } : {}) }), + body: JSON.stringify({ id, status }), }); const data = await res.json(); if (!res.ok) { @@ -203,11 +196,7 @@ export default function CreativePipelineBoard() { return; } if (previewItem && previewItem.id === id) { - setPreviewItem({ - ...previewItem, - status, - notes: notes || previewItem.notes, - }); + setPreviewItem({ ...previewItem, status }); } await load(); } finally { @@ -257,7 +246,7 @@ export default function CreativePipelineBoard() { ) : null} -

- Piezas ya publicadas:{' '} - - ábrelas en el calendario, clic en el día - - . -

{/* Barra de Filtros por Mes y Formato */}
- Meses ({items.filter((i) => i.status !== 'publicado').length} en revisión): + Meses ({items.length} piezas):
@@ -434,14 +416,7 @@ export default function CreativePipelineBoard() { item={it} isAgency={isAgency} busy={busyId === it.id} - onStatus={(s) => { - if (s === 'rechazado' && !isAgency) { - setRejectItem(it); - setRejectNote(''); - return; - } - void setStatus(it.id, s); - }} + onStatus={(s) => setStatus(it.id, s)} onDelete={() => removeItem(it.id)} onUpload={(file, slot, index) => uploadImage(it.id, file, slot, index)} onPreview={() => setPreviewItem(it)} @@ -460,68 +435,9 @@ export default function CreativePipelineBoard() { isAgency={isAgency} busy={busyId === previewItem.id} onClose={() => setPreviewItem(null)} - onStatus={(s) => { - if (s === 'rechazado' && !isAgency) { - setRejectItem(previewItem); - setRejectNote(''); - return; - } - void setStatus(previewItem.id, s); - }} + onStatus={(s) => setStatus(previewItem.id, s)} /> )} - - {rejectItem ? ( -
setRejectItem(null)} - > -
e.stopPropagation()} - onSubmit={(e) => { - e.preventDefault(); - if (!rejectNote.trim()) return; - const id = rejectItem.id; - void setStatus(id, 'rechazado', rejectNote.trim()).then(() => { - setRejectItem(null); - setRejectNote(''); - }); - }} - > -

- No aprobar · {rejectItem.title} -

-

- Deja una nota para que 4Ventures sepa qué hay que cambiar. -

-