import React from 'react'; import type { AgentReview, SubReview, RagStatus, OverallStatus } from '../types'; import { BarclaysLogo } from './icons/BarclaysLogo'; import { OliverLogo } from './icons/OliverLogo'; import { LegalIcon } from './icons/LegalIcon'; import { BrandIcon } from './icons/BrandIcon'; import { CopyIcon } from './icons/CopyIcon'; import { ChannelIcon } from './icons/ChannelIcon'; interface PDFReportProps { campaignName: string; proofs: any[]; } const RagStatusBadge: React.FC<{ status: RagStatus }> = ({ status }) => { let bgColor = '#E5E7EB'; // Gray for Error let textColor = '#1F2937'; switch (status) { case 'Red': bgColor = '#FEE2E2'; textColor = '#991B1B'; break; case 'Amber': bgColor = '#FEF3C7'; textColor = '#92400E'; break; case 'Green': bgColor = '#D1FAE5'; textColor = '#065F46'; break; } return ( {status} ); }; export const PDFReport: React.FC = ({ campaignName, proofs }) => { const today = new Date().toLocaleDateString('en-GB', { day: '2-digit', month: 'long', year: 'numeric', }); const isCampaignReport = proofs.length > 1; const singleProofName = !isCampaignReport && proofs.length > 0 ? proofs[0].proofName : ''; return (
{/* --- Cover Page --- */}

AI Compliance & Brand Report

{isCampaignReport ? 'Campaign-Level Summary' : 'Single Proof Analysis'}

Campaign: {campaignName}

{!isCampaignReport &&

Proof: {singleProofName}

}

Export Date: {today}

{/* --- Table of Contents for Campaign Report --- */} {isCampaignReport && (

Table of Contents

    {proofs.map((proof, index) => (
  • {proof.proofName} - V{proof.versions[0]?.version || 1}
  • ))}
)} {/* --- Proof Report Pages --- */} {proofs.map((proof) => { const version = proof.versions[0]; if (!version) return null; const feedback: AgentReview = version.feedback; const agentReviews = [ { title: 'Legal Agent', review: feedback.legalAgentReview, icon: }, { title: 'Brand Agent', review: feedback.brandAgentReview, icon: }, { title: 'Tone Agent', review: feedback.toneAgentReview, icon: }, { title: 'Channel Agent', review: feedback.channelAgentReview, icon: }, ]; return (
{/* Proof Header */}

{proof.proofName} - V{version.version}

{version.workfrontId} • {proof.channel} / {proof.subChannel}

{/* Preview & Summary */}
Proof Preview

Overall Summary

Status: {feedback.overallStatus}

{feedback.overallStatus === 'Requires Manual Legal Review' && (

Financial Promotion Detected:

"{feedback.financialPromotionReason}"

)}

{feedback.leadAgentSummary}

{/* Detailed Agent Feedback */}
{agentReviews.map(({ title, review, icon }) => (

{icon} {title}

{review.feedback}

{review.issues && review.issues.length > 0 && (
Actionable Issues:
    {review.issues.map((issue, i) =>
  • {issue}
  • )}
)}
))}
); })}
); };