diff --git a/src/features/report/components/ReportBody.tsx b/src/features/report/components/ReportBody.tsx index 584bc5a..20c71c0 100644 --- a/src/features/report/components/ReportBody.tsx +++ b/src/features/report/components/ReportBody.tsx @@ -32,6 +32,24 @@ function nonEmpty(arr: T[] | null | undefined): arr is T[] { return Array.isArray(arr) && arr.length > 0; } +function hasClinicSnapshotData(s: MarketingReport['clinicSnapshot'] | null | undefined): boolean { + if (!s) return false; + return !!( + s.name || + s.nameEn || + s.location || + s.phone || + s.domain || + s.established || + (s.staffCount ?? 0) > 0 || + (s.overallRating ?? 0) > 0 || + (s.totalReviews ?? 0) > 0 || + s.leadDoctor?.name || + nonEmpty(s.certifications) || + s.registryData + ); +} + export default function ReportBody({ data }: ReportBodyProps) { // 각 audit에서 핸들 끌어와 헤더의 바로가기 버튼에 전달 const socialHandles = { @@ -56,7 +74,7 @@ export default function ReportBody({ data }: ReportBodyProps) { /> - {hasValue(data.clinicSnapshot) && data.clinicSnapshot.name ? ( + {hasClinicSnapshotData(data.clinicSnapshot) ? ( ) : ( diff --git a/src/features/report/components/YouTubeAudit.tsx b/src/features/report/components/YouTubeAudit.tsx index cd2fe6c..2fb1c35 100644 --- a/src/features/report/components/YouTubeAudit.tsx +++ b/src/features/report/components/YouTubeAudit.tsx @@ -33,7 +33,7 @@ export default function YouTubeAudit({ data }: YouTubeAuditProps) { label="구독자" value={formatNumber(data.subscribers)} icon={} - subtext={data.subscriberRank} + subtext={data.subscriberRank ?? undefined} /> } /> - } - subtext={`${data.weeklyViewGrowth.percentage > 0 ? '+' : ''}${data.weeklyViewGrowth.percentage}%`} - trend={data.weeklyViewGrowth.percentage > 0 ? 'up' : data.weeklyViewGrowth.percentage < 0 ? 'down' : 'neutral'} - /> + {data.weeklyViewGrowth ? ( + = 0 ? '+' : ''}${formatNumber(data.weeklyViewGrowth.absolute)}`} + icon={} + subtext={`${data.weeklyViewGrowth.percentage > 0 ? '+' : ''}${data.weeklyViewGrowth.percentage}%`} + trend={data.weeklyViewGrowth.percentage > 0 ? 'up' : data.weeklyViewGrowth.percentage < 0 ? 'down' : 'neutral'} + /> + ) : ( + } + subtext="데이터 없음" + /> + )} {/* Channel info card */} @@ -86,8 +95,8 @@ export default function YouTubeAudit({ data }: YouTubeAuditProps) {

{data.channelDescription}

개설일: {data.channelCreatedDate} - 평균 영상 길이: {data.avgVideoLength} - 업로드 빈도: {data.uploadFrequency} + 평균 영상 길이: {data.avgVideoLength ?? '-'} + 업로드 빈도: {data.uploadFrequency ?? '-'}
{/* Linked URLs */} diff --git a/src/features/report/types/report.ts b/src/features/report/types/report.ts index 6843bb7..a580e8a 100644 --- a/src/features/report/types/report.ts +++ b/src/features/report/types/report.ts @@ -87,12 +87,12 @@ export interface YouTubeAudit { subscribers: number; totalVideos: number; totalViews: number; - weeklyViewGrowth: { absolute: number; percentage: number }; - estimatedMonthlyRevenue: { min: number; max: number }; - avgVideoLength: string; - uploadFrequency: string; + weeklyViewGrowth: { absolute: number; percentage: number } | null; + estimatedMonthlyRevenue: { min: number; max: number } | null; + avgVideoLength: string | null; + uploadFrequency: string | null; channelCreatedDate: string; - subscriberRank: string; + subscriberRank: string | null; channelDescription: string; linkedUrls: { label: string; url: string }[]; playlists: string[];