feat: 마케팅 플랜 Phase 1~3 완성
- ContentCalendar: 드래그앤드롭(주차 내 요일 간 이동) + 엔트리 추가 버튼 + iCal Export - BrandingGuide: 색상 팔레트 인라인 편집(스와치 클릭 → hex 팝오버) + DO/DON'T 2컬럼 - WorkflowTracker: 콘텐츠 제작 파이프라인(기획→AI초안→검토→승인→배포), 동영상/이미지+텍스트 분류 - RepurposingProposal: YouTube 인기 영상 리퍼포징 제안 아코디언 섹션 - AssetDetailModal: 에셋 카드 클릭 시 상세 모달 - 디자인 시스템 감사: Lucide 라인 아이콘 제거, 원색(pink/indigo/purple) 제거, 이모지 UI 제거 - "My Assets" → "나의 소재" 일관성 변경 - FilledIcons: DownloadFilled, RocketFilled 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b84410341f
commit
2027ae9b64
19 files changed
+1547
-207
No files matched your search
@@ -1,10 +1,18 @@
|
||||
import { useState, useCallback } from 'react';
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { exportCalendarToICS } from '../../lib/calendarExport';
|
||||
import { motion } from 'motion/react';
|
||||
import {
|
||||
VideoFilled,
|
||||
FileTextFilled,
|
||||
ShareFilled,
|
||||
MegaphoneFilled,
|
||||
YoutubeFilled,
|
||||
InstagramFilled,
|
||||
FacebookFilled,
|
||||
GlobeFilled,
|
||||
TiktokFilled,
|
||||
MessageFilled,
|
||||
CalendarFilled,
|
||||
} from '../icons/FilledIcons';
|
||||
import { SectionWrapper } from '../report/ui/SectionWrapper';
|
||||
import EditEntryModal from './EditEntryModal';
|
||||
@@ -37,21 +45,24 @@ const contentTypeIcons: Record<ContentCategory, typeof VideoFilled> = {
|
||||
ad: MegaphoneFilled,
|
||||
};
|
||||
|
||||
const channelEmojiMap: Record<string, string> = {
|
||||
youtube: '▶',
|
||||
instagram: '◎',
|
||||
facebook: 'f',
|
||||
blog: '✎',
|
||||
globe: '◉',
|
||||
star: '★',
|
||||
map: '◇',
|
||||
video: '▷',
|
||||
// FilledIcon map for channel identification in calendar entries
|
||||
const channelIconMap: Record<string, typeof VideoFilled> = {
|
||||
youtube: YoutubeFilled,
|
||||
instagram: InstagramFilled,
|
||||
facebook: FacebookFilled,
|
||||
blog: FileTextFilled,
|
||||
globe: GlobeFilled,
|
||||
video: TiktokFilled,
|
||||
star: GlobeFilled,
|
||||
map: GlobeFilled,
|
||||
messagesquare: MessageFilled,
|
||||
};
|
||||
|
||||
// Semantic status colors (no raw green/red per design system)
|
||||
const statusDotColors: Record<string, string> = {
|
||||
draft: 'bg-slate-300',
|
||||
approved: 'bg-purple-400',
|
||||
published: 'bg-green-400',
|
||||
draft: 'bg-slate-400',
|
||||
approved: 'bg-[#9B8AD4]',
|
||||
published: 'bg-[#7A84D4]',
|
||||
};
|
||||
|
||||
const dayHeaders = ['월', '화', '수', '목', '금', '토', '일'];
|
||||
@@ -59,30 +70,106 @@ const dayHeaders = ['월', '화', '수', '목', '금', '토', '일'];
|
||||
export default function ContentCalendar({ data, planId, onEntryUpdate }: ContentCalendarProps) {
|
||||
const [weeks, setWeeks] = useState(data.weeks);
|
||||
const [editingEntry, setEditingEntry] = useState<CalendarEntry | null>(null);
|
||||
const [creatingForWeek, setCreatingForWeek] = useState<number | null>(null);
|
||||
const [filterType, setFilterType] = useState<ContentCategory | null>(null);
|
||||
const [viewMode, setViewMode] = useState<'weekly' | 'monthly'>('weekly');
|
||||
// DnD state: track which entry is being dragged and from which week
|
||||
const [draggedEntry, setDraggedEntry] = useState<{ entry: CalendarEntry; weekNumber: number } | null>(null);
|
||||
const [dropTargetDay, setDropTargetDay] = useState<{ weekNumber: number; dayIdx: number } | null>(null);
|
||||
|
||||
const handleEntryClick = useCallback((entry: CalendarEntry) => {
|
||||
setCreatingForWeek(null);
|
||||
setEditingEntry(entry);
|
||||
}, []);
|
||||
|
||||
const handleSave = useCallback((updated: CalendarEntry) => {
|
||||
// Open modal in create mode for a given week
|
||||
const handleAddEntry = useCallback((weekNumber: number) => {
|
||||
setCreatingForWeek(weekNumber);
|
||||
setEditingEntry({
|
||||
id: '__new__',
|
||||
dayOfWeek: 0,
|
||||
channel: 'YouTube',
|
||||
channelIcon: 'youtube',
|
||||
contentType: 'video',
|
||||
title: '',
|
||||
status: 'draft',
|
||||
});
|
||||
}, []);
|
||||
|
||||
// Drag handlers — move an entry to a different day within the same week
|
||||
const handleDragStart = useCallback((entry: CalendarEntry, weekNumber: number) => {
|
||||
setDraggedEntry({ entry, weekNumber });
|
||||
}, []);
|
||||
|
||||
const handleDragOver = useCallback((e: React.DragEvent<HTMLDivElement>, weekNumber: number, dayIdx: number) => {
|
||||
e.preventDefault(); // required to allow drop
|
||||
setDropTargetDay({ weekNumber, dayIdx });
|
||||
}, []);
|
||||
|
||||
const handleDragLeave = useCallback(() => {
|
||||
setDropTargetDay(null);
|
||||
}, []);
|
||||
|
||||
const handleDrop = useCallback((weekNumber: number, dayIdx: number) => {
|
||||
if (!draggedEntry || draggedEntry.weekNumber !== weekNumber) return;
|
||||
setWeeks((prev) =>
|
||||
prev.map((week) => ({
|
||||
...week,
|
||||
entries: week.entries.map((e) =>
|
||||
(e.id && e.id === updated.id) ? updated : e
|
||||
),
|
||||
}))
|
||||
prev.map((week) =>
|
||||
week.weekNumber === weekNumber
|
||||
? {
|
||||
...week,
|
||||
entries: week.entries.map((e) =>
|
||||
e.id && e.id === draggedEntry.entry.id
|
||||
? { ...e, dayOfWeek: dayIdx, isManualEdit: true }
|
||||
: e
|
||||
),
|
||||
}
|
||||
: week
|
||||
)
|
||||
);
|
||||
if (onEntryUpdate && updated.id) {
|
||||
onEntryUpdate(updated.id, updated);
|
||||
setDraggedEntry(null);
|
||||
setDropTargetDay(null);
|
||||
}, [draggedEntry]);
|
||||
|
||||
const handleDragEnd = useCallback(() => {
|
||||
setDraggedEntry(null);
|
||||
setDropTargetDay(null);
|
||||
}, []);
|
||||
|
||||
const handleSave = useCallback((updated: CalendarEntry) => {
|
||||
if (updated.id === '__new__' && creatingForWeek !== null) {
|
||||
// Create mode: append new entry with a generated id
|
||||
const newEntry: CalendarEntry = {
|
||||
...updated,
|
||||
id: `entry-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
||||
};
|
||||
setWeeks((prev) =>
|
||||
prev.map((week) =>
|
||||
week.weekNumber === creatingForWeek
|
||||
? { ...week, entries: [...week.entries, newEntry] }
|
||||
: week
|
||||
)
|
||||
);
|
||||
setCreatingForWeek(null);
|
||||
} else {
|
||||
// Edit mode: update existing entry by id
|
||||
setWeeks((prev) =>
|
||||
prev.map((week) => ({
|
||||
...week,
|
||||
entries: week.entries.map((e) =>
|
||||
e.id && e.id === updated.id ? updated : e
|
||||
),
|
||||
}))
|
||||
);
|
||||
if (onEntryUpdate && updated.id) {
|
||||
onEntryUpdate(updated.id, updated);
|
||||
}
|
||||
}
|
||||
setEditingEntry(null);
|
||||
}, [onEntryUpdate]);
|
||||
}, [onEntryUpdate, creatingForWeek]);
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
setEditingEntry(null);
|
||||
setCreatingForWeek(null);
|
||||
}, []);
|
||||
|
||||
const toggleFilter = (type: ContentCategory) => {
|
||||
@@ -129,24 +216,26 @@ export default function ContentCalendar({ data, planId, onEntryUpdate }: Content
|
||||
);
|
||||
};
|
||||
|
||||
const renderEntry = (entry: CalendarEntry, entryIdx: number) => {
|
||||
const renderEntry = (entry: CalendarEntry, entryIdx: number, weekNumber?: number) => {
|
||||
const colors = contentTypeColors[entry.contentType];
|
||||
const Icon = contentTypeIcons[entry.contentType];
|
||||
const channelSymbol = channelEmojiMap[entry.channelIcon] || '·';
|
||||
const statusDot = statusDotColors[entry.status || 'draft'];
|
||||
const ContentIcon = contentTypeIcons[entry.contentType];
|
||||
const ChannelIcon = channelIconMap[entry.channelIcon] ?? GlobeFilled;
|
||||
const statusDot = statusDotColors[entry.status ?? 'draft'];
|
||||
const isDragging = draggedEntry?.entry.id === entry.id;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={entry.id || entryIdx}
|
||||
className={`${colors.entry} border rounded-lg p-1.5 mb-1 last:mb-0 cursor-pointer hover:ring-2 hover:ring-purple-200 transition-all group relative`}
|
||||
key={entry.id ?? entryIdx}
|
||||
className={`${colors.entry} border rounded-lg p-1.5 mb-1 last:mb-0 cursor-grab active:cursor-grabbing hover:ring-2 hover:ring-purple-200 transition-all group relative ${isDragging ? 'opacity-40' : ''}`}
|
||||
draggable={weekNumber !== undefined}
|
||||
onDragStart={weekNumber !== undefined ? () => handleDragStart(entry, weekNumber) : undefined}
|
||||
onDragEnd={weekNumber !== undefined ? handleDragEnd : undefined}
|
||||
onClick={() => handleEntryClick(entry)}
|
||||
>
|
||||
<div className="flex items-center gap-1 mb-0.5">
|
||||
<span className={`w-1.5 h-1.5 rounded-full ${statusDot} flex-shrink-0`} />
|
||||
<span className={`text-[9px] font-bold ${colors.text} leading-none`}>
|
||||
{channelSymbol}
|
||||
</span>
|
||||
<Icon size={10} className={colors.text} />
|
||||
<ChannelIcon size={10} className={colors.text} />
|
||||
<ContentIcon size={10} className={`${colors.text} opacity-60`} />
|
||||
</div>
|
||||
<p className="text-[11px] text-slate-700 leading-tight line-clamp-2">
|
||||
{entry.title}
|
||||
@@ -167,16 +256,16 @@ export default function ContentCalendar({ data, planId, onEntryUpdate }: Content
|
||||
subtitle="콘텐츠 캘린더 (월간)"
|
||||
dark
|
||||
>
|
||||
{/* Toolbar: View Toggle + Filters */}
|
||||
<div className="flex items-center justify-between mb-4 flex-wrap gap-2" data-no-print>
|
||||
{/* View toggle */}
|
||||
<div className="flex bg-slate-100 rounded-xl p-0.5">
|
||||
{/* Toolbar: View Toggle + Status Legend */}
|
||||
<div className="flex items-center justify-between mb-6 flex-wrap gap-2" data-no-print>
|
||||
{/* View toggle — styled for dark section bg */}
|
||||
<div className="flex bg-white/10 rounded-xl p-0.5">
|
||||
<button
|
||||
onClick={() => setViewMode('weekly')}
|
||||
className={`px-3 py-1.5 text-xs font-medium rounded-lg transition-all ${
|
||||
viewMode === 'weekly'
|
||||
? 'bg-white text-[#0A1128] shadow-sm'
|
||||
: 'text-slate-500 hover:text-slate-700'
|
||||
? 'bg-white/20 text-white shadow-sm'
|
||||
: 'text-white/50 hover:text-white/80'
|
||||
}`}
|
||||
>
|
||||
주간
|
||||
@@ -185,51 +274,72 @@ export default function ContentCalendar({ data, planId, onEntryUpdate }: Content
|
||||
onClick={() => setViewMode('monthly')}
|
||||
className={`px-3 py-1.5 text-xs font-medium rounded-lg transition-all ${
|
||||
viewMode === 'monthly'
|
||||
? 'bg-white text-[#0A1128] shadow-sm'
|
||||
: 'text-slate-500 hover:text-slate-700'
|
||||
? 'bg-white/20 text-white shadow-sm'
|
||||
: 'text-white/50 hover:text-white/80'
|
||||
}`}
|
||||
>
|
||||
월간
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Status legend */}
|
||||
<div className="flex gap-3 text-[10px] text-slate-400">
|
||||
<span className="flex items-center gap-1"><span className="w-1.5 h-1.5 rounded-full bg-slate-300" />초안</span>
|
||||
<span className="flex items-center gap-1"><span className="w-1.5 h-1.5 rounded-full bg-purple-400" />승인</span>
|
||||
<span className="flex items-center gap-1"><span className="w-1.5 h-1.5 rounded-full bg-green-400" />게시됨</span>
|
||||
{/* iCal Export Button */}
|
||||
<button
|
||||
onClick={() => exportCalendarToICS(weeks)}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/10 hover:bg-white/20 text-white/70 hover:text-white text-xs font-medium transition-all"
|
||||
data-no-print
|
||||
>
|
||||
<CalendarFilled size={12} />
|
||||
캘린더 내보내기
|
||||
</button>
|
||||
|
||||
{/* Status legend with design-system colors */}
|
||||
<div className="flex gap-3 text-[10px] text-white/50">
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-slate-400" />초안
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-[#9B8AD4]" />승인
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-[#7A84D4]" />게시됨
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Monthly Summary */}
|
||||
<div className="flex flex-wrap gap-4 mb-8">
|
||||
{data.monthlySummary.map((item) => {
|
||||
{/* Monthly Summary — compact counter pills (click to filter) */}
|
||||
<div className="flex flex-wrap gap-3 mb-8">
|
||||
{data.monthlySummary.map((item, i) => {
|
||||
const colors = contentTypeColors[item.type];
|
||||
const Icon = contentTypeIcons[item.type];
|
||||
const isActive = filterType === item.type;
|
||||
return (
|
||||
<motion.div
|
||||
<motion.button
|
||||
key={item.type}
|
||||
className={`flex-1 min-w-[140px] rounded-2xl border p-4 cursor-pointer transition-all ${colors.bg} ${colors.border} ${colors.shadow} ${
|
||||
isActive ? 'ring-2 ring-purple-400 ring-offset-1' : ''
|
||||
className={`flex items-center gap-3 px-5 py-3 rounded-2xl border cursor-pointer transition-all ${colors.bg} ${colors.border} ${colors.shadow} ${
|
||||
isActive ? 'ring-2 ring-white/40 ring-offset-2 ring-offset-transparent' : ''
|
||||
} ${filterType && !isActive ? 'opacity-40' : ''}`}
|
||||
onClick={() => toggleFilter(item.type)}
|
||||
initial={{ opacity: 0, y: 10 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ duration: 0.3 }}
|
||||
onClick={() => toggleFilter(item.type)}
|
||||
data-no-print={undefined}
|
||||
transition={{ duration: 0.3, delay: i * 0.07 }}
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-2">
|
||||
<span
|
||||
className="w-3 h-3 rounded-full"
|
||||
style={{ backgroundColor: item.color }}
|
||||
/>
|
||||
<span className={`text-sm font-medium ${colors.text}`}>{item.label}</span>
|
||||
<Icon size={16} className={`${colors.text} opacity-70`} />
|
||||
<div className="flex flex-col items-start">
|
||||
<span className={`text-2xl font-bold leading-none ${colors.text}`}>{item.count}</span>
|
||||
<span className={`text-xs font-medium ${colors.text} opacity-70 mt-0.5`}>{item.label}</span>
|
||||
</div>
|
||||
<span className={`text-2xl font-bold ${colors.text}`}>{item.count}</span>
|
||||
</motion.div>
|
||||
</motion.button>
|
||||
);
|
||||
})}
|
||||
{filterType && (
|
||||
<button
|
||||
onClick={() => setFilterType(null)}
|
||||
className="text-xs text-white/40 hover:text-white/70 px-3 self-center transition-colors"
|
||||
>
|
||||
× 해제
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Calendar Content */}
|
||||
@@ -268,51 +378,42 @@ export default function ContentCalendar({ data, planId, onEntryUpdate }: Content
|
||||
</div>
|
||||
))}
|
||||
|
||||
{dayCells.map((entries, dayIdx) => (
|
||||
<div
|
||||
key={dayIdx}
|
||||
className={`min-h-[80px] rounded-xl p-1.5 ${
|
||||
entries.length > 0
|
||||
? 'bg-slate-50/50 border border-slate-100'
|
||||
: 'border border-dashed border-slate-200/60'
|
||||
}`}
|
||||
>
|
||||
{entries.map((entry, entryIdx) => renderEntry(entry, entryIdx))}
|
||||
</div>
|
||||
))}
|
||||
{dayCells.map((entries, dayIdx) => {
|
||||
const isDropTarget = dropTargetDay?.weekNumber === week.weekNumber && dropTargetDay?.dayIdx === dayIdx;
|
||||
return (
|
||||
<div
|
||||
key={dayIdx}
|
||||
className={`min-h-[80px] rounded-xl p-1.5 transition-all ${
|
||||
entries.length > 0
|
||||
? 'bg-slate-50/50 border border-slate-100'
|
||||
: 'border border-dashed border-slate-200/60'
|
||||
} ${isDropTarget ? 'ring-2 ring-[#6C5CE7]/40 bg-[#F3F0FF]/20 border-[#D5CDF5]' : ''}`}
|
||||
onDragOver={(e) => handleDragOver(e, week.weekNumber, dayIdx)}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={() => handleDrop(week.weekNumber, dayIdx)}
|
||||
>
|
||||
{entries.map((entry, entryIdx) => renderEntry(entry, entryIdx, week.weekNumber))}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Add Entry Button */}
|
||||
<button
|
||||
onClick={() => handleAddEntry(week.weekNumber)}
|
||||
className="mt-3 w-full flex items-center justify-center gap-1.5 py-2 rounded-xl border border-dashed border-slate-200 text-xs text-slate-400 hover:text-slate-600 hover:border-slate-300 hover:bg-slate-50/50 transition-all"
|
||||
data-no-print
|
||||
>
|
||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 5v14M5 12h14" />
|
||||
</svg>
|
||||
콘텐츠 추가
|
||||
</button>
|
||||
</motion.div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
|
||||
{/* Color Legend (clickable filter) */}
|
||||
<div className="flex flex-wrap gap-3 mt-4">
|
||||
{(Object.keys(contentTypeColors) as ContentCategory[]).map((type) => {
|
||||
const colors = contentTypeColors[type];
|
||||
const isActive = filterType === type;
|
||||
return (
|
||||
<button
|
||||
key={type}
|
||||
onClick={() => toggleFilter(type)}
|
||||
className={`${colors.bg} ${colors.text} border ${colors.border} rounded-full px-3 py-1 text-xs font-medium ${colors.shadow} transition-all ${
|
||||
isActive ? 'ring-2 ring-purple-300' : ''
|
||||
} ${filterType && !isActive ? 'opacity-40' : ''}`}
|
||||
>
|
||||
{contentTypeLabels[type]}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
{filterType && (
|
||||
<button
|
||||
onClick={() => setFilterType(null)}
|
||||
className="text-xs text-slate-400 hover:text-slate-600 px-2 py-1 transition-colors"
|
||||
>
|
||||
필터 해제
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Edit Modal */}
|
||||
{editingEntry && (
|
||||
<EditEntryModal
|
||||
|
||||
Reference in new issue
Block a user