({parentId, placeholder, onSubmitted})
| 203 | } |
| 204 | |
| 205 | function CommentForm({parentId, placeholder, onSubmitted}) { |
| 206 | const [content, setContent] = useState(""); |
| 207 | const handleSubmit = (event) => { |
| 208 | if (!content.trim()) { |
| 209 | event.preventDefault(); |
| 210 | return; |
| 211 | } |
| 212 | setTimeout(() => { |
| 213 | setContent(""); |
| 214 | onSubmitted?.(); |
| 215 | }); |
| 216 | }; |
| 217 | return ( |
| 218 | <Form method="post" onSubmit={handleSubmit} style={{display: 'flex', gap: '0.5rem', alignItems: 'flex-start'}}> |
| 219 | <input type="hidden" name="ParentID" value={parentId}/> |
| 220 | <TextField |
| 221 | name="Content" |
| 222 | value={content} |
| 223 | onChange={(event) => setContent(event.target.value)} |
| 224 | placeholder={placeholder} |
| 225 | multiline |
| 226 | minRows={2} |
| 227 | size="small" |
| 228 | fullWidth |
| 229 | /> |
| 230 | <Tooltip title="发送" arrow> |
| 231 | <span> |
| 232 | <IconButton type="submit" name="ActionType" value="Comment" disabled={!content.trim()}> |
| 233 | <Send/> |
| 234 | </IconButton> |
| 235 | </span> |
| 236 | </Tooltip> |
| 237 | </Form> |
| 238 | ); |
| 239 | } |
| 240 | |
| 241 | function DeleteContentButton({content}) { |
| 242 | const [open, setOpen] = useState(false); |
nothing calls this directly
no outgoing calls
no test coverage detected