import React, { FormEvent, useState } from 'react' import { useRecoilState } from 'recoil' import emitter, { EVENT_PROMPT } from '../../event' import { appState, propmtState } from '../../store/Atoms' import Button from '../shared/Button' import TextInput from '../shared/Input' // TODO: show progress in input const PromptInput = () => { const [app, setAppState] = useRecoilState(appState) const [prompt, setPrompt] = useRecoilState(propmtState) const handleOnInput = (evt: FormEvent) => { evt.preventDefault() evt.stopPropagation() const target = evt.target as HTMLInputElement setPrompt(target.value) } const handleRepaintClick = () => { if (prompt.length !== 0 && !app.isInpainting) { emitter.emit(EVENT_PROMPT) } } return (
) } export default PromptInput