import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '../ui/dialog'; import { TextareaControl } from '../ui/textarea-control'; import { DismissibleAlert } from '../ui/dismissible-alert'; interface TaskOutcomeDialogProps { open: boolean; onClose: () => void; title: string; lede: string; label: string; /** An explanation must be written; a completion message may be left empty. */ required: boolean; value: string; onChange: (value: string) => void; onSubmit: () => void; submitting: boolean; error?: string; } /** * How a task ended, with room to say something to the practice. Both outcomes use it: an unable * needs its reason, a completion takes an optional message. The X is the only way out, so there is * no Cancel beside Submit. */ export const TaskOutcomeDialog = ({ open, onClose, title, lede, label, required, value, onChange, onSubmit, submitting, error, }: TaskOutcomeDialogProps) => ( { if (!next && !submitting) onClose(); }}> {title} {lede} {error && ( {error} )} ); export default TaskOutcomeDialog;