| import { useState } from 'react'; | |
| import Header from './components/Header'; | |
| import Hero from './components/Hero'; | |
| import Results from './components/Results'; | |
| import { analyzeRepository } from './services/uvifyApi'; | |
| import type { UvifyResult } from './types/uvify'; | |
| function App() { | |
| const [results, setResults] = useState<UvifyResult[]>([]); | |
| const [isLoading, setIsLoading] = useState(false); | |
| const [error, setError] = useState<string>(''); | |
| const [currentSource, setCurrentSource] = useState<string>(''); | |
| const handleAnalyze = async (source: string) => { | |
| setIsLoading(true); | |
| setError(''); | |
| setResults([]); | |
| setCurrentSource(source); | |
| try { | |
| const data = await analyzeRepository(source); | |
| setResults(data); | |
| } catch (err) { | |
| setError(err instanceof Error ? err.message : 'Failed to analyze repository'); | |
| } finally { | |
| setIsLoading(false); | |
| } | |
| }; | |
| return ( | |
| <div className="min-h-screen bg-gray-900 text-white"> | |
| <Header /> | |
| <Hero onAnalyze={handleAnalyze} isLoading={isLoading} /> | |
| <Results results={results} source={currentSource} error={error} /> | |
| </div> | |
| ); | |
| } | |
| export default App | |