MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / CommentForm

Function CommentForm

src/Components/Post/PostContent/PostContent.jsx:205–239  ·  view source on GitHub ↗
({parentId, placeholder, onSubmitted})

Source from the content-addressed store, hash-verified

203}
204
205function 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
241function DeleteContentButton({content}) {
242 const [open, setOpen] = useState(false);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected