MCPcopy Create free account
hub / github.com/coder/coder / FollowUpDialog

Function FollowUpDialog

site/src/pages/TaskPage/FollowUpDialog.tsx:25–95  ·  view source on GitHub ↗
({
	task,
	initialMessage,
	open,
	onOpenChange,
	onSubmit,
})

Source from the content-addressed store, hash-verified

23};
24
25export const FollowUpDialog: FC<FollowUpDialogProps> = ({
26 task,
27 initialMessage,
28 open,
29 onOpenChange,
30 onSubmit,
31}) => {
32 const formId = useId();
33
34 const formik = useFormik({
35 initialValues: {
36 message: initialMessage,
37 },
38 enableReinitialize: true,
39 onSubmit: (values) => {
40 const message = values.message.trim();
41 if (message.length === 0) {
42 return;
43 }
44 onSubmit(message);
45 onOpenChange(false);
46 },
47 });
48
49 return (
50 <Dialog open={open} onOpenChange={onOpenChange}>
51 <DialogContent className="max-w-2xl">
52 <DialogHeader>
53 <DialogTitle>Send Follow-up Message</DialogTitle>
54 <DialogDescription>
55 Add another message to this task. The task will resume and send this
56 follow-up automatically.
57 </DialogDescription>
58 </DialogHeader>
59
60 <form id={formId} className="space-y-4" onSubmit={formik.handleSubmit}>
61 <div>
62 <label
63 htmlFor={`${formId}-message`}
64 className="block text-sm font-medium text-content-primary mb-2"
65 >
66 Follow-up message
67 </label>
68 <Textarea
69 id={`${formId}-message`}
70 name="message"
71 value={formik.values.message}
72 onChange={formik.handleChange}
73 rows={10}
74 className="w-full"
75 placeholder={`Continue "${task.display_name}" after resume by asking for the next step...`}
76 />
77 </div>
78 </form>
79
80 <DialogFooter>
81 <DialogClose asChild>
82 <Button variant="outline">Cancel</Button>

Callers

nothing calls this directly

Calls 1

onSubmitFunction · 0.50

Tested by

no test coverage detected