/** * ReportBody — 리포트 본문(헤더 + 모든 섹션) 순수 렌더링. * * 각 섹션은 데이터가 비어있으면 `EmptySection` 으로 fallback 되어 * "데이터가 없습니다" 안내가 표시됩니다. Guest / User 두 페이지 모두 * 동일한 동작. */ import type { MarketingReport } from '@/features/report/types/report'; import { SectionErrorBoundary } from '@/features/report/components/ui/SectionErrorBoundary'; import { EmptySection } from '@/features/report/components/ui/EmptySection'; import ReportHeader from '@/features/report/components/ReportHeader'; import ClinicSnapshot from '@/features/report/components/ClinicSnapshot'; import ChannelOverview from '@/features/report/components/ChannelOverview'; import YouTubeAudit from '@/features/report/components/YouTubeAudit'; import InstagramAudit from '@/features/report/components/InstagramAudit'; import FacebookAudit from '@/features/report/components/FacebookAudit'; import OtherChannels from '@/features/report/components/OtherChannels'; import ProblemDiagnosis from '@/features/report/components/ProblemDiagnosis'; import TransformationProposal from '@/features/report/components/TransformationProposal'; import RoadmapTimeline from '@/features/report/components/RoadmapTimeline'; import KPIDashboard from '@/features/report/components/KPIDashboard'; interface ReportBodyProps { data: MarketingReport; } function hasValue(v: T | null | undefined): v is T { return v != null; } function nonEmpty(arr: T[] | null | undefined): arr is T[] { return Array.isArray(arr) && arr.length > 0; } export default function ReportBody({ data }: ReportBodyProps) { // 각 audit에서 핸들 끌어와 헤더의 바로가기 버튼에 전달 const socialHandles = { website: data.targetUrl || data.clinicSnapshot.domain || null, youtube: data.youtubeAudit?.handle || null, instagram: data.instagramAudit?.accounts?.[0]?.handle || null, facebook: data.facebookAudit?.pages?.[0]?.url || data.facebookAudit?.pages?.[0]?.pageName || null, }; return (
{hasValue(data.clinicSnapshot) && data.clinicSnapshot.name ? ( ) : ( )} {nonEmpty(data.channelScores) ? ( ) : ( )} {hasValue(data.youtubeAudit) && data.youtubeAudit.handle ? ( ) : ( )} {hasValue(data.instagramAudit) && nonEmpty(data.instagramAudit.accounts) ? ( ) : ( )} {hasValue(data.facebookAudit) && nonEmpty(data.facebookAudit.pages) ? ( ) : ( )} {nonEmpty(data.otherChannels) || hasValue(data.websiteAudit) ? ( ) : ( )} {nonEmpty(data.problemDiagnosis) ? ( ) : ( )} {hasValue(data.transformation) ? ( ) : ( )} {nonEmpty(data.roadmap) ? ( ) : ( )} {nonEmpty(data.kpiDashboard) ? ( ) : ( )}
); }