import type React from 'react'; import { useEffect, useRef, useState } from 'react'; export interface ChooseArtProps { artSubmissionCallback: (art: string) => void; } export const ChooseArt: React.FC = ({ artSubmissionCallback, }) => { const [art, setArt] = useState(''); const promptRef = useRef(null); useEffect(() => { if (!promptRef.current) { return; } // Automatically focus the textarea when the component mounts promptRef.current.focus(); }, [promptRef]); const handleSubmit = () => { if (!art.trim()) { return; } artSubmissionCallback(art); }; return (