import { motion } from 'motion/react'; import { Youtube, Users, Video, Eye, TrendingUp, ExternalLink } from 'lucide-react'; import { SectionWrapper } from './ui/SectionWrapper'; import { EmptyState } from './ui/EmptyState'; import { MetricCard } from './ui/MetricCard'; import { DiagnosisRow } from './ui/DiagnosisRow'; import type { YouTubeAudit as YouTubeAuditType } from '../../types/report'; interface YouTubeAuditProps { data: YouTubeAuditType; } function formatNumber(n: number): string { return n.toLocaleString(); } export default function YouTubeAudit({ data }: YouTubeAuditProps) { const hasData = data.subscribers > 0 || data.totalVideos > 0 || data.topVideos.length > 0 || data.diagnosis.length > 0; return ( {!hasData && ( )} {hasData && <> {/* Metrics row */}
} subtext={data.subscriberRank} /> } /> } /> } subtext={`${data.weeklyViewGrowth.percentage > 0 ? '+' : ''}${data.weeklyViewGrowth.percentage}%`} trend={data.weeklyViewGrowth.percentage > 0 ? 'up' : data.weeklyViewGrowth.percentage < 0 ? 'down' : 'neutral'} />
{/* Channel info card */}

{data.channelName}

{data.handle ? ( {data.handle} ) : (

{data.handle}

)}

{data.channelDescription}

개설일: {data.channelCreatedDate} 평균 영상 길이: {data.avgVideoLength} 업로드 빈도: {data.uploadFrequency}
{/* Linked URLs */} {data.linkedUrls.length > 0 && (
{data.linkedUrls.map((link) => ( {link.label} ))}
)}
{/* Playlists */} {data.playlists.length > 0 && (

재생목록

{data.playlists.map((pl) => ( {pl} ))}
)} {/* Top Videos */} {data.topVideos.length > 0 && (

인기 영상 TOP {data.topVideos.length}

{data.topVideos.map((video, i) => (
{video.type} {video.uploadedAgo}

{video.title}

{formatNumber(video.views)} views
))}
)} {/* Diagnosis — metric-based findings */} {(data.diagnosis.length > 0 || data.subscribers > 0) && (

진단 결과

{/* Quick metric diagnosis rows */} {data.subscribers > 0 && data.totalViews > 0 && (
구독자 대비 조회수 비율 영상당 평균 ~{formatNumber(data.totalVideos > 0 ? Math.round(data.totalViews / data.totalVideos) : 0)}회 ({data.totalVideos > 0 && data.subscribers > 0 ? `${Math.round((data.totalViews / data.totalVideos / data.subscribers) * 100)}%` : '-'} 구독자 대비 {data.subscribers > 100000 ? '5' : '9'}% 달성)
)} {data.topVideos.length > 0 && (
최근 롱폼 조회수 대부분 1,000~4,000회 수준
)} {data.topVideos.filter(v => v.type === 'Short').length === 0 && data.totalVideos > 0 && (
Shorts 조회수 최근 업로드 500~1000회 (유기적 도달 금지)
)}
업로드 빈도 {data.uploadFrequency || '주 1회'} — 알고리즘 노출 기준 최소 주 3회 이상 필요
{/* Detailed diagnosis items */} {data.diagnosis.length > 0 && (
{data.diagnosis.map((item, i) => ( ))}
)}
)} }
); }