import React from 'react'; import ResearchResults from '../ResearchResults'; import EnhancedTitleSelector from '../EnhancedTitleSelector'; import EnhancedOutlineEditor from '../EnhancedOutlineEditor'; import { BlogEditor } from '../WYSIWYG'; import ManualResearchForm from '../ManualResearchForm'; import ManualContentButton from '../ManualContentButton'; import PublishContent from './PublishContent'; interface PhaseContentProps { currentPhase: string; research: any; outline: any[]; outlineConfirmed: boolean; titleOptions: any[]; selectedTitle?: string | null; researchTitles: any[]; aiGeneratedTitles: any[]; sourceMappingStats: any; groundingInsights: any; researchCoverage: any; setOutline: (o: any) => void; sections: Record; handleContentUpdate: any; handleContentSave: any; continuityRefresh: number | null; flowAnalysisResults: any; outlineGenRef: React.RefObject; blogWriterApi: any; contentConfirmed: boolean; seoAnalysis: any; seoMetadata: any; onTitleSelect: any; onCustomTitle: any; sectionImages?: Record; setSectionImages?: (images: Record | ((prev: Record) => Record)) => void; copilotKitAvailable?: boolean; onResearchComplete?: (research: any) => void; onKeywordsChange?: (kw: string) => void; blogLengthRef?: React.MutableRefObject; startResearchRef?: React.MutableRefObject<((keywords: string, blogLength?: string) => Promise) | null>; onOutlineGenerationStart?: (taskId: string) => void; onContentGenerationStart?: (taskId: string) => void; buildFullMarkdown?: () => string; convertMarkdownToHTML?: (md: string) => string; brainstormResult?: import('../../../api/gscBrainstorm').BrainstormResult; onBrainstormResult?: (result: import('../../../api/gscBrainstorm').BrainstormResult) => void; onResearchWithKeywords?: (keywords: string) => void; selectedContentAngle?: string; onAngleSelect?: (angle: string) => void; selectedCompetitiveAdvantage?: string; onCompetitiveAdvantageSelect?: (advantage: string) => void; introduction?: string; onIntroductionUpdate?: (intro: string) => void; } export const PhaseContent: React.FC = ({ currentPhase, research, outline, outlineConfirmed, titleOptions, selectedTitle, researchTitles, aiGeneratedTitles, sourceMappingStats, groundingInsights, researchCoverage, setOutline, sections, handleContentUpdate, handleContentSave, continuityRefresh, flowAnalysisResults, outlineGenRef, blogWriterApi, contentConfirmed, seoAnalysis, seoMetadata, onTitleSelect, onCustomTitle, sectionImages, setSectionImages, copilotKitAvailable = true, onResearchComplete, onKeywordsChange, blogLengthRef, startResearchRef, onOutlineGenerationStart, onContentGenerationStart, buildFullMarkdown, convertMarkdownToHTML, brainstormResult, onBrainstormResult, onResearchWithKeywords, selectedContentAngle, onAngleSelect, selectedCompetitiveAdvantage, onCompetitiveAdvantageSelect, introduction, onIntroductionUpdate, }) => { return (
{currentPhase === 'research' && ( <> {research ? ( ) : ( <> {copilotKitAvailable ? (

Start Your Research

Use the copilot to begin researching your blog topic.

) : ( )} )} )} {currentPhase === 'outline' && research && ( <> {outline.length === 0 ? (
📝

Creating Your Outline

Your outline is being generated from the research data. The progress modal shows detailed status — once complete, you can review and refine the sections here.

) : ( <> blogWriterApi.refineOutline({ outline, operation: op, section_id: id, payload }).then((res: any) => setOutline(res.outline))} sectionImages={sectionImages} setSectionImages={setSectionImages} /> )} )} {currentPhase === 'content' && outline.length > 0 && ( <> {outlineConfirmed ? ( ) : ( <> {copilotKitAvailable ? (

Confirm Your Outline

Review and confirm your outline before generating content.

) : ( )} )} )} {currentPhase === 'seo' && contentConfirmed && outline.length > 0 && outlineConfirmed && ( <> {Object.keys(sections).length > 0 && Object.values(sections).some(content => content && content.trim().length > 0) ? ( ) : (

Loading Content...

Please wait while your content is being optimized.

)} )} {/* Fallback for SEO phase if conditions not met */} {currentPhase === 'seo' && (!contentConfirmed || outline.length === 0 || !outlineConfirmed) && (

Optimize your blog for search engines.

Complete the content phase first to enable SEO optimization.

)} {currentPhase === 'publish' && buildFullMarkdown && convertMarkdownToHTML && ( )}
); }; export default PhaseContent;