Implement text input component (Task 9)
- Create TextInputSection component with large multiline textarea - Add 'Next: Assign voices' button - Implement text validation (non-empty) - Show validation message for empty text - Disable button when text is empty - Update App.tsx to integrate TextInputSection - Requirements: 1.1, 1.2, 1.3, 1.4
This commit is contained in:
@@ -1,34 +1,50 @@
|
||||
import { useState } from 'react'
|
||||
import reactLogo from './assets/react.svg'
|
||||
import viteLogo from '/vite.svg'
|
||||
import './App.css'
|
||||
import TextInputSection from './components/TextInputSection'
|
||||
|
||||
function App() {
|
||||
const [count, setCount] = useState(0)
|
||||
const [text, setText] = useState('')
|
||||
const [phase, setPhase] = useState<'input' | 'assignment' | 'generated'>('input')
|
||||
const [isLoading] = useState(false)
|
||||
|
||||
const handleTextChange = (newText: string) => {
|
||||
setText(newText)
|
||||
}
|
||||
|
||||
const handleNext = () => {
|
||||
// TODO: Implement role detection and phase transition
|
||||
console.log('Moving to voice assignment phase with text:', text)
|
||||
setPhase('assignment')
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<a href="https://vite.dev" target="_blank">
|
||||
<img src={viteLogo} className="logo" alt="Vite logo" />
|
||||
</a>
|
||||
<a href="https://react.dev" target="_blank">
|
||||
<img src={reactLogo} className="logo react" alt="React logo" />
|
||||
</a>
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<div className="container mx-auto py-8">
|
||||
<h1 className="text-4xl font-bold text-center mb-8">Text to Audiobook</h1>
|
||||
|
||||
{phase === 'input' && (
|
||||
<TextInputSection
|
||||
text={text}
|
||||
onChange={handleTextChange}
|
||||
onNext={handleNext}
|
||||
isLoading={isLoading}
|
||||
disabled={false}
|
||||
/>
|
||||
)}
|
||||
|
||||
{phase === 'assignment' && (
|
||||
<div className="text-center">
|
||||
<p>Voice assignment phase (to be implemented)</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{phase === 'generated' && (
|
||||
<div className="text-center">
|
||||
<p>Audio player phase (to be implemented)</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<h1>Vite + React</h1>
|
||||
<div className="card">
|
||||
<button onClick={() => setCount((count) => count + 1)}>
|
||||
count is {count}
|
||||
</button>
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to test HMR
|
||||
</p>
|
||||
</div>
|
||||
<p className="read-the-docs">
|
||||
Click on the Vite and React logos to learn more
|
||||
</p>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user