) => void;
}) {
return (
);
}
function DraggingOverlay({ isDragging }: { isDragging: boolean }) {
const { t } = useTranslation();
if (!isDragging) return null;
return (
{t("task:dropFilesHere")}
);
}
// The input coordinates existing attachment, mention and plugin controls in one field.
// eslint-disable-next-line max-lines-per-function
export const TaskFormInputs = memo(function TaskFormInputs({
workspaceId,
isSessionMode,
autoFocus,
initialDescription,
onDescriptionChange,
onPendingAttachmentUploadsChange,
onKeyDown,
descriptionValueRef,
disabled,
placeholder,
onEnhancePrompt,
isEnhancingPrompt,
isUtilityConfigured,
jiraImport,
linearImport,
onComposerSubmit,
taskId = null,
}: TaskFormInputsProps) {
const { t } = useTranslation();
const {
attachments,
isDragging,
setIsDragging,
addFiles,
handleRemoveAttachment,
handleRetryAttachment,
} = useFileAttachments(workspaceId, onPendingAttachmentUploadsChange);
const { handlePaste, handleDragOver, handleDragLeave, handleDrop } = useAttachmentHandlers(
disabled,
addFiles,
setIsDragging,
);
const contextItems = useMemo(
() => toContextItems(attachments, handleRemoveAttachment, handleRetryAttachment),
[attachments, handleRemoveAttachment, handleRetryAttachment],
);
const { description, descriptionRef, textareaRef, setDescriptionValue, insertAtCursor } =
useDescriptionInput(
initialDescription,
autoFocus,
descriptionValueRef,
onDescriptionChange,
attachments,
);
const mention = useTaskCreatePromptMention({
textareaRef,
value: description,
onChange: setDescriptionValue,
});
const { handleChange, handleKeyDownCapture, handleKeyDown } = useTextareaHandlers(
mention,
onKeyDown,
);
const { fileInputRef, handleAttachClick, handleFileInputChange } = useFileInputClick(addFiles);
const pluginActions = useCreationComposerPluginActions({
isSessionMode,
taskId,
disabled: Boolean(disabled),
description,
descriptionRef,
textareaRef,
insertAtCursor,
submit: onComposerSubmit,
});
return (
);
});