import { Box, Button, FormLabel, Input, Modal, ModalDialog, Option, Select, Textarea, Typography, } from '@mui/joy' import { useEffect, useState } from 'react' function CreateThingModal({ isOpen, onClose, onSave, currentThing }) { const [name, setName] = useState(currentThing?.name || '') const [type, setType] = useState(currentThing?.type || 'numeric') const [state, setState] = useState(currentThing?.state || '') useEffect(() => { if (type === 'boolean') { if (state !== 'true' && state !== 'false') { setState('false') } } else if (type === 'number') { if (isNaN(state)) { setState(0) } } }, [type]) const handleSave = () => { onSave({ name, type, id: currentThing?.id, state: state || null }) onClose() } return ( {/* */} P;lease add info Name