/** * Website Step Rendering Utility Functions * Extracted rendering components for website analysis display */ import React from 'react'; import { Box, Typography, Paper, Card, CardContent, Grid, Accordion, AccordionSummary, AccordionDetails, Alert, Button, Slide, Zoom } from '@mui/material'; import { useTheme, alpha } from '@mui/material/styles'; import { ExpandMore as ExpandMoreIcon, CheckCircle as CheckIcon, Psychology as PsychologyIcon, Analytics as AnalyticsIcon, Business as BusinessIcon, AutoAwesome as AutoAwesomeIcon, Star as StarIcon, Warning as WarningIcon } from '@mui/icons-material'; /** * Key Insight Card Component */ interface KeyInsightProps { title: string; value: string | string[]; icon: React.ReactNode; color?: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info'; } const KeyInsightCard: React.FC = ({ title, value, icon, color = 'primary' }) => { const theme = useTheme(); const isDark = theme.palette.mode === 'dark'; // Helper function to safely get palette colors const getPaletteColor = (colorKey: string) => { const palette = theme.palette as any; return palette[colorKey] || palette.primary; }; const paletteColor = getPaletteColor(color); return ( {icon} {title} {Array.isArray(value) ? value.join(', ') : value} ); }; /** * Backward-compatible wrapper function for renderKeyInsight * @deprecated Use KeyInsightCard component directly instead */ export const renderKeyInsight = ( title: string, value: string | string[], icon: React.ReactNode, color: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info' = 'primary' ) => ; /** * Renders a guidelines card with title, items, and icon */ export const renderGuidelinesCard = ( title: string, items: string[], icon: React.ReactNode, color: string = 'primary' ) => ( {icon} {title} {items.map((item, index) => ( {item} ))} ); /** * Renders the pro upgrade alert */ export const renderProUpgradeAlert = () => ( Learn More } > Limited Analysis Scope This analysis is based on your homepage only. ALwrity Pro can index your entire website and social media content for comprehensive personalized content generation. ); /** * Renders the brand analysis section */ export const renderBrandAnalysisSection = (brandAnalysis: any) => ( Brand Analysis {brandAnalysis.brand_voice && ( Brand Voice: {brandAnalysis.brand_voice} )} {brandAnalysis.brand_positioning && ( Brand Positioning: {brandAnalysis.brand_positioning} )} {brandAnalysis.brand_values && brandAnalysis.brand_values.length > 0 && ( Brand Values: {brandAnalysis.brand_values.map((value: string, index: number) => ( {value} ))} )} ); /** * Renders the content strategy insights section */ export const renderContentStrategyInsightsSection = (insights: any) => ( Content Strategy Insights {insights.strengths && insights.strengths.length > 0 && ( ✅ Strengths: {insights.strengths.map((strength: string, index: number) => ( {strength} ))} )} {insights.opportunities && insights.opportunities.length > 0 && ( 🎯 Opportunities: {insights.opportunities.map((opportunity: string, index: number) => ( {opportunity} ))} )} {insights.recommended_improvements && insights.recommended_improvements.length > 0 && ( 🔧 Recommended Improvements: {insights.recommended_improvements.map((improvement: string, index: number) => ( {improvement} ))} )} ); /** * Renders the AI generation tips section */ export const renderAIGenerationTipsSection = (tips: string[]) => ( AI Content Generation Tips {tips.map((tip: string, index: number) => ( {tip} ))} ); /** * Renders a best practices section card */ export const renderBestPracticesSection = (bestPractices: string[]) => ( Best Practices {bestPractices.map((practice, index) => ( {practice} ))} ); /** * Renders an avoid elements section card */ export const renderAvoidElementsSection = (avoidElements: string[]) => ( Elements to Avoid {avoidElements.map((element, index) => ( {element} ))} ); /** * Renders a generic analysis section accordion */ export const renderAnalysisSection = ( title: string, data: any, icon: React.ReactNode, description?: string ) => ( }> {icon} {title} {description && ( {description} )} {Object.entries(data).map(([key, value]) => ( {key.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}: {Array.isArray(value) ? value.join(', ') : String(value)} ))} ); /** * Renders the guidelines section accordion */ export const renderGuidelinesSection = (guidelines: any) => ( }> Content Guidelines Personalized recommendations for improving your content creation based on your writing style analysis. {guidelines.tone_recommendations && ( Tone Recommendations {guidelines.tone_recommendations.map((rec: string, index: number) => ( {rec} ))} )} {guidelines.structure_guidelines && ( Structure Guidelines {guidelines.structure_guidelines.map((guideline: string, index: number) => ( {guideline} ))} )} {guidelines.vocabulary_suggestions && ( Vocabulary Suggestions {guidelines.vocabulary_suggestions.map((suggestion: string, index: number) => ( {suggestion} ))} )} {guidelines.engagement_tips && ( Engagement Tips {guidelines.engagement_tips.map((tip: string, index: number) => ( {tip} ))} )} {guidelines.audience_considerations && ( Audience Considerations {guidelines.audience_considerations.map((consideration: string, index: number) => ( {consideration} ))} )} ); /** * Renders the style patterns section accordion */ export const renderStylePatternsSection = (patterns: any) => ( }> Style Patterns Recurring patterns and characteristics identified in your writing style. {Object.entries(patterns).map(([key, value]) => ( {key.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}: {Array.isArray(value) ? value.join(', ') : String(value)} ))} );