Remove the editorial calendar publish button.
Agency will load new months from files, not a portal CTA that copied another client’s plan. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,47 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Upload } from 'lucide-react';
|
|
||||||
|
|
||||||
export default function PublishRrssButton() {
|
|
||||||
const [busy, setBusy] = useState(false);
|
|
||||||
const [msg, setMsg] = useState<string | null>(null);
|
|
||||||
|
|
||||||
async function publish() {
|
|
||||||
setBusy(true);
|
|
||||||
setMsg(null);
|
|
||||||
try {
|
|
||||||
const r = await fetch('/api/calendar/publish', { method: 'POST' });
|
|
||||||
const j = await r.json();
|
|
||||||
if (!r.ok) {
|
|
||||||
setMsg(j.error || 'Error al publicar');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setMsg(`Publicado · ${j.pieces} piezas · ${j.month}`);
|
|
||||||
} catch (e) {
|
|
||||||
setMsg(e instanceof Error ? e.message : 'Error');
|
|
||||||
} finally {
|
|
||||||
setBusy(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col gap-1">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
disabled={busy}
|
|
||||||
onClick={publish}
|
|
||||||
className="inline-flex items-center justify-center min-h-[52px] px-6 rounded-xl border border-emerald-500/40 bg-emerald-500/15 text-emerald-300 text-sm font-bold hover:bg-emerald-500/25 disabled:opacity-50"
|
|
||||||
>
|
|
||||||
<Upload className="w-4 h-4 mr-2" />
|
|
||||||
{busy ? 'Publicando…' : 'Dejar octubre visible para el cliente'}
|
|
||||||
</button>
|
|
||||||
<p className="text-[11px] text-gray-500 max-w-xs leading-relaxed">
|
|
||||||
No publica en Instagram ni Facebook. Solo guarda el plan de este mes en
|
|
||||||
el portal de <strong>Agua Miia</strong> para que el cliente lo vea en
|
|
||||||
Calendario.
|
|
||||||
</p>
|
|
||||||
{msg ? <p className="text-[11px] text-gray-400">{msg}</p> : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ import { resolveActiveTenant, restGet } from '@/lib/tenant-context';
|
|||||||
import { isAgencyRole, userRole } from '@/lib/agency';
|
import { isAgencyRole, userRole } from '@/lib/agency';
|
||||||
import RrssMonthView, { RrssMonthPlan, RrssPiece } from '@/components/RrssMonthView';
|
import RrssMonthView, { RrssMonthPlan, RrssPiece } from '@/components/RrssMonthView';
|
||||||
import CalendarClient from './CalendarClient';
|
import CalendarClient from './CalendarClient';
|
||||||
import PublishRrssButton from './PublishRrssButton';
|
|
||||||
import RrssArchiveYear from '@/components/RrssArchiveYear';
|
import RrssArchiveYear from '@/components/RrssArchiveYear';
|
||||||
import octPlan from '@/data/rrss-octubre-2026.json';
|
import octPlan from '@/data/rrss-octubre-2026.json';
|
||||||
import { Instagram, Linkedin } from 'lucide-react';
|
import { Instagram, Linkedin } from 'lucide-react';
|
||||||
@@ -99,9 +98,6 @@ export default async function CalendarioPage({
|
|||||||
plans.push(octPlan as unknown as RrssMonthPlan);
|
plans.push(octPlan as unknown as RrssMonthPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
const canPublishMiia = agency && isAguaMiia;
|
|
||||||
const publishBtn = canPublishMiia ? <PublishRrssButton /> : null;
|
|
||||||
|
|
||||||
const monthParam = sp.month || plans[0]?.month;
|
const monthParam = sp.month || plans[0]?.month;
|
||||||
const active = plans.find((p) => p.month === monthParam) || plans[0];
|
const active = plans.find((p) => p.month === monthParam) || plans[0];
|
||||||
// Portada = archivo anual estilo /rrss/ig-fb/
|
// Portada = archivo anual estilo /rrss/ig-fb/
|
||||||
@@ -142,7 +138,6 @@ export default async function CalendarioPage({
|
|||||||
>
|
>
|
||||||
<Linkedin className="w-4 h-4 mr-2" /> LinkedIn
|
<Linkedin className="w-4 h-4 mr-2" /> LinkedIn
|
||||||
</Link>
|
</Link>
|
||||||
{publishBtn}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -156,7 +151,6 @@ export default async function CalendarioPage({
|
|||||||
year={year}
|
year={year}
|
||||||
plans={plans}
|
plans={plans}
|
||||||
tenantLabel={ctx.label}
|
tenantLabel={ctx.label}
|
||||||
agencyPublish={publishBtn}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,12 +145,10 @@ export default function RrssArchiveYear({
|
|||||||
year = 2026,
|
year = 2026,
|
||||||
plans,
|
plans,
|
||||||
tenantLabel,
|
tenantLabel,
|
||||||
agencyPublish,
|
|
||||||
}: {
|
}: {
|
||||||
year?: number;
|
year?: number;
|
||||||
plans: RrssMonthPlan[];
|
plans: RrssMonthPlan[];
|
||||||
tenantLabel: string;
|
tenantLabel: string;
|
||||||
agencyPublish?: React.ReactNode;
|
|
||||||
}) {
|
}) {
|
||||||
const byMonth = new Map(plans.map((p) => [p.month, p]));
|
const byMonth = new Map(plans.map((p) => [p.month, p]));
|
||||||
const legend = plans[0]?.legend || [
|
const legend = plans[0]?.legend || [
|
||||||
@@ -184,7 +182,6 @@ export default function RrssArchiveYear({
|
|||||||
<span className="w-2 h-2 rounded-full bg-sky-400" />
|
<span className="w-2 h-2 rounded-full bg-sky-400" />
|
||||||
Año {year} · {tenantLabel} × 4Ventures
|
Año {year} · {tenantLabel} × 4Ventures
|
||||||
</div>
|
</div>
|
||||||
{agencyPublish}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user