import { motion } from 'motion/react'; import { VideoFilled, FileTextFilled, ShareFilled, MegaphoneFilled, } from '../icons/FilledIcons'; import { SectionWrapper } from '../report/ui/SectionWrapper'; import type { CalendarData, ContentCategory, CalendarEntry } from '../../types/plan'; interface ContentCalendarProps { data: CalendarData; } const contentTypeColors: Record = { video: { bg: 'bg-[#F3F0FF]', text: 'text-[#6C5CE7]', entry: 'bg-[#F3F0FF] border-[#D5CDF5]', border: 'border-[#D5CDF5]', shadow: 'shadow-[2px_3px_8px_rgba(155,138,212,0.15)]' }, blog: { bg: 'bg-[#EFF0FF]', text: 'text-[#3A3F7C]', entry: 'bg-[#EFF0FF] border-[#C5CBF5]', border: 'border-[#C5CBF5]', shadow: 'shadow-[2px_3px_8px_rgba(122,132,212,0.15)]' }, social: { bg: 'bg-[#FFF6ED]', text: 'text-[#7C5C3A]', entry: 'bg-[#FFF6ED] border-[#F5E0C5]', border: 'border-[#F5E0C5]', shadow: 'shadow-[2px_3px_8px_rgba(212,168,114,0.15)]' }, ad: { bg: 'bg-[#FFF0F0]', text: 'text-[#7C3A4B]', entry: 'bg-[#FFF0F0] border-[#F5D5DC]', border: 'border-[#F5D5DC]', shadow: 'shadow-[2px_3px_8px_rgba(212,136,154,0.15)]' }, }; const contentTypeLabels: Record = { video: 'Video', blog: 'Blog', social: 'Social', ad: 'Ad', }; const contentTypeIcons: Record = { video: VideoFilled, blog: FileTextFilled, social: ShareFilled, ad: MegaphoneFilled, }; const dayHeaders = ['월', '화', '수', '목', '금', '토', '일']; export default function ContentCalendar({ data }: ContentCalendarProps) { return ( {/* Monthly Summary */}
{data.monthlySummary.map((item) => { const colors = contentTypeColors[item.type]; return (
{item.label}
{item.count}
); })}
{/* Weekly Calendar Grid */} {data.weeks.map((week, weekIdx) => { const dayCells: CalendarEntry[][] = Array.from({ length: 7 }, () => []); for (const entry of week.entries) { const dayIndex = entry.dayOfWeek; if (dayIndex >= 0 && dayIndex <= 6) { dayCells[dayIndex].push(entry); } } return (

{week.label}

{/* Day headers */} {dayHeaders.map((day) => (
{day}
))} {/* Day cells */} {dayCells.map((entries, dayIdx) => (
0 ? 'bg-slate-50/50 border border-slate-100' : 'border border-dashed border-slate-200/60' }`} > {entries.map((entry, entryIdx) => { const colors = contentTypeColors[entry.contentType]; const Icon = contentTypeIcons[entry.contentType]; return (

{entry.title}

); })}
))}
); })} {/* Color Legend */}
{(Object.keys(contentTypeColors) as ContentCategory[]).map((type) => { const colors = contentTypeColors[type]; return ( {contentTypeLabels[type]} ); })}
); }