/** * Structure Analysis Component * * Displays comprehensive content structure analysis including structure overview, * content elements detection, and heading structure analysis. */ import React from 'react'; import { Box, Typography, Paper, Grid, Chip, Tooltip } from '@mui/material'; import { BarChart } from '@mui/icons-material'; interface StructureAnalysisProps { detailedAnalysis?: { content_structure?: { total_sections: number; total_paragraphs: number; total_sentences: number; has_introduction: boolean; has_conclusion: boolean; has_call_to_action: boolean; structure_score: number; recommendations: string[]; }; content_quality?: { word_count: number; unique_words: number; vocabulary_diversity: number; transition_words_used: number; content_depth_score: number; flow_score: number; recommendations: string[]; }; heading_structure?: { h1_count: number; h2_count: number; h3_count: number; h1_headings: string[]; h2_headings: string[]; h3_headings: string[]; heading_hierarchy_score: number; recommendations: string[]; }; }; } const baseCard = { p: 3, backgroundColor: '#ffffff', border: '1px solid #e2e8f0', borderRadius: 2, boxShadow: '0 12px 28px rgba(15,23,42,0.08)', color: '#0f172a', minHeight: '100%' } as const; const infoRow = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0.75rem 0', cursor: 'help' } as const; const statLabel = { color: '#475569', fontWeight: 500 } as const; const statValue = { color: '#0f172a', fontWeight: 700 } as const; const highlightCard = (borderColor: string) => ({ p: 2, borderRadius: 2, border: `1px solid ${borderColor}`, background: `linear-gradient(140deg, ${borderColor}15, ${borderColor}22)` }); export const StructureAnalysis: React.FC = ({ detailedAnalysis }) => { const structure = detailedAnalysis?.content_structure; const quality = detailedAnalysis?.content_quality; const headings = detailedAnalysis?.heading_structure; return ( Content Structure Analysis {/* Content Structure Overview */} Structure Overview Total Sections Number of main content sections (H2 headings) in your blog post. Optimal Range: 3-8 sections for most blog posts Why it matters: Good sectioning improves readability and structure. } arrow > Total Sections {structure?.total_sections || 'N/A'} Total Paragraphs Number of paragraphs in your content (excluding headings). Optimal Range: 8-20 paragraphs for most blog posts } arrow > Total Paragraphs {structure?.total_paragraphs || 'N/A'} Total Sentences Total number of sentences in your content. Optimal Range: 40-100 sentences for most blog posts } arrow > Total Sentences {structure?.total_sentences || 'N/A'} Structure Score Overall score (0-100) for your content's structural organization. Scoring Factors: Section count, paragraph count, intro/conclusion presence. } arrow > Structure Score {structure?.structure_score || 'N/A'} {/* Content Elements */} Content Elements Has Introduction Has Conclusion Has Call to Action {/* Content Quality Metrics */} Content Quality Metrics Word Count {quality?.word_count || 'N/A'} Vocabulary Diversity {quality?.vocabulary_diversity !== undefined ? `${(quality.vocabulary_diversity * 100).toFixed(1)}%` : 'N/A'} Content Depth Score {quality?.content_depth_score || 'N/A'} Flow Score {quality?.flow_score || 'N/A'} Transition Words Used {quality?.transition_words_used || 'N/A'} Unique Words {quality?.unique_words || 'N/A'} {/* Heading Structure */} {headings && ( Heading Structure H1 Headings {headings.h1_count} {headings.h1_headings?.[0] ? `Primary: ${headings.h1_headings[0]}` : 'Primary heading analysis'} H2 Headings {headings.h2_count} {headings.h2_headings?.slice(0, 2).join(', ') || 'Summary of subtopics'} H3 Headings {headings.h3_count} {headings.h3_headings?.slice(0, 2).join(', ') || 'Supportive outline points'} )} ); };