import React, { useState } from 'react'; function scoreClass(s) { if (s >= 70) return 'good'; if (s >= 40) return 'ok'; return 'bad'; } function trendClass(t) { if (t === 'growing') return 'good'; if (t === 'stable') return 'ok'; return 'bad'; } function severityClass(s) { if (s === 'critical') return 'critical'; if (s === 'high') return 'high'; if (s === 'medium') return 'medium'; return 'low'; } function threatClass(t) { if (t === 'high') return 'high'; if (t === 'medium') return 'medium'; return 'low'; } function ScoreRing({ score }) { const radius = 54; const circumference = 2 * Math.PI * radius; const offset = circumference - (score / 100) * circumference; const cls = scoreClass(score); return (
{score}
); } function BarChart({ items, colorKey }) { const maxVal = Math.max(...items.map(i => i.value), 1); return (
{items.map((item, i) => (
{item.label}
{item.display}
))}
); } function SectionNav({ sections, active, onSelect }) { return (
{sections.map((s) => ( ))}
); } const sections = [ { id: 'overview', icon: '\u{1F3AF}', label: 'Overview' }, { id: 'market', icon: '\u{1F4CA}', label: 'Market' }, { id: 'competitors', icon: '\u{2694}\u{FE0F}', label: 'Competition' }, { id: 'revenue', icon: '\u{1F4B0}', label: 'Revenue' }, { id: 'swot', icon: '\u{1F9E9}', label: 'SWOT' }, { id: 'gtm', icon: '\u{1F680}', label: 'Go-to-Market' }, { id: 'funding', icon: '\u{1F3E6}', label: 'Funding' }, { id: 'feasibility', icon: '\u{1F527}', label: 'Feasibility' }, { id: 'risks', icon: '\u{26A0}\u{FE0F}', label: 'Risks' }, { id: 'pivot', icon: '\u{1F504}', label: 'Pivots' }, { id: 'plan', icon: '\u{1F4C5}', label: '90-Day Plan' }, { id: 'pitch', icon: '\u{1F4DD}', label: 'Pitch Deck' }, ]; export default function Results({ data, onReset }) { const a = data.analysis; const [activeSection, setActiveSection] = useState('overview'); const safeArray = (val) => Array.isArray(val) ? val : []; return (
{/* === OVERVIEW === */} {activeSection === 'overview' && ( <>
{a.ideaName}
{a.oneLiner}
Viability Score
{(a.verdict || '').replace(/_/g, ' ')}

{a.verdictExplanation}

{a.similarSuccesses && (

{'\u{1F3C6}'} Similar Success Stories

{safeArray(a.similarSuccesses).map((s, i) => (
{s.company}
Similarity: {s.similarity}
Outcome: {s.outcome}
{'\u{1F4A1}'} {s.lessonToApply}
))}
)} )} {/* === MARKET SIZING === */} {activeSection === 'market' && a.marketSizing && ( <>

{'\u{1F4CA}'} TAM / SAM / SOM Market Sizing

TAM {a.marketSizing.tam}
{a.marketSizing.tamReasoning}
SAM {a.marketSizing.sam}
{a.marketSizing.samReasoning}
SOM {a.marketSizing.som}
{a.marketSizing.somReasoning}

{'\u{1F4C8}'} Market Dynamics

Growth Rate (CAGR)
{a.marketSizing.marketGrowthRate}
Market Trend
{a.marketSizing.marketTrend}
Timing
{a.marketSizing.timing}
Timing Analysis
{a.marketSizing.timingNote}
)} {/* === COMPETITOR ANALYSIS === */} {activeSection === 'competitors' && a.competitorAnalysis && ( <>

{'\u{2694}\u{FE0F}'} Direct Competitors

{safeArray(a.competitorAnalysis.directCompetitors).map((c, i) => (
{c.name} {c.funding}
Strength{c.strength}
Weakness{c.weakness}
Market Share{c.marketShare}
))}

{'\u{1F310}'} Indirect Competitors

{safeArray(a.competitorAnalysis.indirectCompetitors).map((c, i) => (
{c.name} {c.threat} threat
{c.howTheyCompete}
))}

{'\u{1F440}'} Potential Future Competitors

{safeArray(a.competitorAnalysis.potentialCompetitors).map((c, i) => (
{c.name} {c.likelihood} likelihood
Possible entry: {c.timeframe}
))}

{'\u{1F6E1}\u{FE0F}'} Your Competitive Edge

Competitive Advantage
{a.competitorAnalysis.competitiveAdvantage}
Moat Possibility
{a.competitorAnalysis.moatPossibility}
Moat Strategy
{a.competitorAnalysis.moatStrategy}
)} {/* === REVENUE MODEL === */} {activeSection === 'revenue' && a.revenueModel && ( <>

{'\u{1F4B0}'} Revenue Projections

{a.revenueModel.projectedRevenue && (
Year 1
{a.revenueModel.projectedRevenue.year1}
Year 2
{a.revenueModel.projectedRevenue.year2}
Year 3
{a.revenueModel.projectedRevenue.year3}
)}

{'\u{1F4B5}'} Business Model & Pricing

Primary Model
{a.revenueModel.primaryModel}
Break-even Timeline
{a.revenueModel.breakEvenTimeline}
Pricing Strategy
{a.revenueModel.pricingStrategy}
{a.revenueModel.unitEconomics && (

{'\u{1F4CA}'} Unit Economics

LTV
{a.revenueModel.unitEconomics.ltv}
CAC
{a.revenueModel.unitEconomics.cac}
LTV:CAC Ratio
{a.revenueModel.unitEconomics.ltvCacRatio}
Payback Period
{a.revenueModel.unitEconomics.paybackPeriod}
Gross Margin
{a.revenueModel.unitEconomics.grossMargin}
)} )} {/* === SWOT ANALYSIS === */} {activeSection === 'swot' && a.swotAnalysis && (

{'\u{1F9E9}'} SWOT Analysis

{'\u{1F4AA}'} Strengths
    {safeArray(a.swotAnalysis.strengths).map((s, i) =>
  • {s}
  • )}
{'\u{26A0}\u{FE0F}'} Weaknesses
    {safeArray(a.swotAnalysis.weaknesses).map((w, i) =>
  • {w}
  • )}
{'\u{1F31F}'} Opportunities
    {safeArray(a.swotAnalysis.opportunities).map((o, i) =>
  • {o}
  • )}
{'\u{1F525}'} Threats
    {safeArray(a.swotAnalysis.threats).map((t, i) =>
  • {t}
  • )}
)} {/* === GO TO MARKET === */} {activeSection === 'gtm' && a.goToMarket && ( <>

{'\u{1F680}'} Go-to-Market Strategy

{['phase1', 'phase2', 'phase3'].map((phase, i) => { const p = a.goToMarket[phase]; if (!p) return null; return (
{i + 1}
{p.name}
{p.strategy}
{'\u{1F4E2}'} {safeArray(p.channels).join(', ')} {'\u{1F3AF}'} {p.targetMetric} {'\u{1F4B2}'} {p.budget}
); })}

{'\u{1F4E3}'} Viral & Adoption Strategy

Viral Potential
{a.goToMarket.viralPotential}
Early Adopters
{a.goToMarket.earlyAdopters}
Viral Mechanism
{a.goToMarket.viralMechanism}
)} {/* === FUNDING ASSESSMENT === */} {activeSection === 'funding' && a.fundingAssessment && (

{'\u{1F3E6}'} Funding Assessment

Current Stage
{a.fundingAssessment.currentStage}
Readiness
{a.fundingAssessment.readiness}
Recommended Raise
{a.fundingAssessment.recommendedRaise}
Valuation Range
{a.fundingAssessment.valuationRange}
Key Milestones Needed
{safeArray(a.fundingAssessment.keyMilestonesNeeded).map((m, i) => (
{i + 1} {m}
))}
Best Investor Fit
{safeArray(a.fundingAssessment.investorFit).join(', ')}
Pitch Strength
{a.fundingAssessment.pitchStrength}
)} {/* === FEASIBILITY === */} {activeSection === 'feasibility' && a.feasibility && (

{'\u{1F527}'} Technical Feasibility

Technical Complexity
{a.feasibility.technicalComplexity}
Time to MVP
{a.feasibility.timeToMVP}
Estimated Cost
{a.feasibility.estimatedCost}
Tech Stack
{a.feasibility.techStack}
Team Needed
{safeArray(a.feasibility.teamNeeded).join(' \u{2022} ')}
Technical Note
{a.feasibility.technicalNote}
Biggest Technical Risk
{a.feasibility.biggestTechnicalRisk}
)} {/* === RISK MATRIX === */} {activeSection === 'risks' && a.riskMatrix && (

{'\u{26A0}\u{FE0F}'} Risk Matrix

Risk Category Probability Impact Severity
{safeArray(a.riskMatrix).map((r, i) => (
{r.risk}
{'\u{1F6E1}\u{FE0F}'} {r.mitigation}
{r.category} {r.probability} {r.impact} {r.severity}
))}
)} {/* === PIVOT SUGGESTIONS === */} {activeSection === 'pivot' && a.pivotSuggestions && (

{'\u{1F504}'} Pivot Suggestions

{safeArray(a.pivotSuggestions).map((p, i) => (
{p.pivot} {p.effort} effort
{p.reasoning}
))}
)} {/* === 90-DAY PLAN === */} {activeSection === 'plan' && a.ninetyDayPlan && (

{'\u{1F4C5}'} 90-Day Validation Plan

{safeArray(a.ninetyDayPlan).map((p, i) => (
{p.week}
{p.action}
{'\u{1F4E6}'} Deliverable: {p.deliverable} {'\u{1F3AF}'} Goal: {p.goal}
))}
)} {/* === PITCH DECK === */} {activeSection === 'pitch' && a.pitchDeckOutline && (

{'\u{1F4DD}'} Pitch Deck Outline

{safeArray(a.pitchDeckOutline).map((slide, i) => (
Slide {slide.slide}
{slide.title}
{slide.content}
))}
)}
); }