import React from 'react'; import Link from 'next/link'; import type { RrssMonthPlan, RrssPiece } from '@/components/RrssMonthView'; const MONTH_NAMES = [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre', ]; function colorFor(piece: RrssPiece): string { if (piece.color) return piece.color; if (piece.platform === 'linkedin') return '#7C66B8'; if ((piece.format || '').toLowerCase().includes('stor')) return '#374151'; const hay = `${piece.pillar || ''} ${piece.meta_line || ''} ${piece.title}`.toLowerCase(); if (hay.includes('familia') || hay.includes('bienestar')) return '#E08E2E'; if (hay.includes('sostenib')) return '#0F9D8F'; if (hay.includes('b2b') || hay.includes('hosteler')) return '#7C66B8'; if (hay.includes('prueba') || hay.includes('reseña')) return '#8A93A6'; return '#2071cf'; } function MiniMonth({ year, monthIndex, plan, }: { year: number; monthIndex: number; // 0-11 plan?: RrssMonthPlan; }) { const monthKey = `${year}-${String(monthIndex + 1).padStart(2, '0')}`; const first = new Date(Date.UTC(year, monthIndex, 1)); const daysInMonth = new Date(Date.UTC(year, monthIndex + 1, 0)).getUTCDate(); const startPad = (first.getUTCDay() + 6) % 7; const live = Boolean(plan); const byDate = new Map(); for (const p of plan?.pieces || []) { const k = p.date.slice(0, 10); (byDate.get(k) || byDate.set(k, []).get(k)!).push(p); } const headerCls = live ? 'flex items-center justify-between gap-2 bg-gradient-to-r from-[#1a2a63] to-[#2071CF] text-white px-3.5 py-2.5' : 'flex items-center justify-between gap-2 bg-[#9aa6c0] text-white px-3.5 py-2.5'; const body = ( <>
{MONTH_NAMES[monthIndex]} {live ? 'Publicado' : 'Pronto'}
{['L', 'M', 'X', 'J', 'V', 'S', 'D'].map((d, i) => ( = 5 ? 'text-sky-400' : 'text-gray-500' }`} > {d} ))}
{Array.from({ length: startPad }).map((_, i) => ( ))} {Array.from({ length: daysInMonth }).map((_, i) => { const day = i + 1; const key = `${monthKey}-${String(day).padStart(2, '0')}`; const hits = byDate.get(key) || []; const weekend = new Date(Date.UTC(year, monthIndex, day)).getUTCDay() % 6 === 0; const bg = hits[0] ? colorFor(hits[0]) : undefined; return ( h.title).join(' · ') || undefined} className={`aspect-square flex items-center justify-center text-[11px] font-bold rounded-full ${ weekend && !bg ? 'text-sky-400' : 'text-gray-600' }`} style={ bg ? { background: bg, color: '#fff', boxShadow: 'inset 0 0 0 1px rgba(255,255,255,.35)', } : undefined } > {day} ); })}
{live ? `${plan!.pieces.length} piezas · abrir mes` : 'Pendiente de publicar'}
); const className = `rounded-2xl border overflow-hidden flex flex-col min-h-full transition-all ${ live ? 'border-gray-200 bg-white hover:border-sky-500/50 hover:-translate-y-0.5 shadow-lg shadow-sky-900/10' : 'border-gray-200 bg-white opacity-80' }`; if (live) { return ( {body} ); } return (
{body}
); } /** Year archive cover like /agua-miia/rrss/ig-fb/ */ export default function RrssArchiveYear({ year = 2026, plans, tenantLabel, agencyPublish, }: { year?: number; plans: RrssMonthPlan[]; tenantLabel: string; agencyPublish?: React.ReactNode; }) { const byMonth = new Map(plans.map((p) => [p.month, p])); const legend = plans[0]?.legend || [ { label: 'Educativo / serie', color: '#2071cf' }, { label: 'Familia / bienestar', color: '#E08E2E' }, { label: 'Sostenibilidad', color: '#0F9D8F' }, { label: 'B2B / LinkedIn', color: '#7C66B8' }, { label: 'Stories', color: '#374151' }, ]; return (
← Hub RRSS

Calendario IG / FB {year}

Archivo mensual de contenidos. Los días redondeados y coloreados marcan el tipo de publicación (misma paleta que en cada mes).

Año {year} · {tenantLabel} × 4Ventures
{agencyPublish}
{Array.from({ length: 12 }).map((_, i) => { const key = `${year}-${String(i + 1).padStart(2, '0')}`; return ( ); })}
{legend.map((l) => ( {l.label} ))}
); }