Spaces:
Configuration error
Configuration error
File size: 4,383 Bytes
c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d 6fcad97 c86a32d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | import React, { useState } from 'react';
import Results from './components/Results';
import { validateStartup } from './utils/api';
const loadingMessages = [
"Analyzing your idea...",
"Estimating TAM/SAM/SOM...",
"Researching competitors...",
"Running SWOT analysis...",
"Modeling revenue projections...",
"Evaluating go-to-market strategy...",
"Assessing funding readiness...",
"Building risk matrix...",
"Crafting 90-day plan...",
"Generating pitch deck outline...",
"Finalizing your report...",
];
export default function App() {
const [idea, setIdea] = useState('');
const [audience, setAudience] = useState('');
const [monetization, setMonetization] = useState('');
const [loading, setLoading] = useState(false);
const [loadingMsg, setLoadingMsg] = useState(0);
const [results, setResults] = useState(null);
const [error, setError] = useState('');
const handleValidate = async () => {
setLoading(true);
setError('');
setLoadingMsg(0);
const interval = setInterval(() => {
setLoadingMsg(i => (i + 1) % loadingMessages.length);
}, 2200);
try {
const data = await validateStartup(idea, audience, monetization);
setResults(data);
} catch (err) {
setError(err.message);
}
clearInterval(interval);
setLoading(false);
};
const handleReset = () => {
setResults(null);
setError('');
};
if (results) {
return (
<div className="app">
<header className="header">
<h1>Startup Idea Validator</h1>
<p>AI-powered comprehensive startup viability analysis</p>
</header>
<Results data={results} onReset={handleReset} />
</div>
);
}
return (
<div className="app">
<header className="header">
<h1>Startup Idea Validator</h1>
<p>Get a VC-grade analysis: market sizing, SWOT, competitor analysis, revenue models, go-to-market strategy, and more.</p>
</header>
{error && (
<div style={{ background: 'rgba(239,68,68,0.1)', padding: '1rem', borderRadius: '10px', marginBottom: '1rem', textAlign: 'center', color: 'var(--danger)', border: '1px solid rgba(239,68,68,0.2)' }}>
{error}
</div>
)}
<div className="form-card">
<div className="form-group">
<label>Your Startup Idea *</label>
<textarea
placeholder={"Describe your startup idea in detail. What problem does it solve? How does it work?\n\nExample: An AI-powered app that analyzes your food photos and tells you the exact calories, macros, and nutritional info. Users can track their daily intake just by snapping photos of meals."}
value={idea}
onChange={(e) => setIdea(e.target.value)}
/>
</div>
<div className="form-group">
<label>Target Audience (optional)</label>
<input
type="text"
placeholder="e.g., Health-conscious millennials, small business owners, college students..."
value={audience}
onChange={(e) => setAudience(e.target.value)}
/>
</div>
<div className="form-group">
<label>Monetization Model (optional)</label>
<select value={monetization} onChange={(e) => setMonetization(e.target.value)}>
<option value="">Let AI suggest</option>
<option value="subscription">Subscription (SaaS)</option>
<option value="freemium">Freemium</option>
<option value="marketplace">Marketplace / Commission</option>
<option value="ads">Advertising</option>
<option value="one-time">One-time Purchase</option>
<option value="usage-based">Usage-based / Pay-per-use</option>
</select>
</div>
{loading ? (
<div className="loading">
<div className="spinner" />
<p style={{ color: 'var(--text-dim)', fontSize: '0.95rem' }}>{loadingMessages[loadingMsg]}</p>
<p style={{ color: 'var(--border-light)', fontSize: '0.8rem', marginTop: '0.5rem' }}>Generating comprehensive analysis (may take 15-30 seconds)...</p>
</div>
) : (
<button className="btn" disabled={idea.trim().length < 20} onClick={handleValidate}>
Validate My Idea
</button>
)}
</div>
</div>
);
}
|