This commit is contained in:
@@ -4,23 +4,33 @@ import { useTranslation } from "react-i18next";
|
||||
type Props = {
|
||||
value?: string;
|
||||
onChange?: (value: string) => void;
|
||||
onBlur?: () => void;
|
||||
onSave?: () => void;
|
||||
isSaving?: boolean;
|
||||
};
|
||||
|
||||
const TaskDetailDescription: FC<Props> = ({ value = "", onChange, onBlur }) => {
|
||||
const TaskDetailDescription: FC<Props> = ({ value = "", onChange, onSave, isSaving = false }) => {
|
||||
const { t } = useTranslation("global");
|
||||
|
||||
return (
|
||||
<div className="mt-6">
|
||||
<div className="text-sm font-medium mb-2">{t("taskmanager.task_detail.description")}</div>
|
||||
<textarea
|
||||
value={value}
|
||||
onChange={(e) => onChange?.(e.target.value)}
|
||||
onBlur={onBlur}
|
||||
placeholder={t("taskmanager.task_detail.description_placeholder")}
|
||||
rows={5}
|
||||
className="w-full bg-white/25 rounded-xl px-4 py-3 text-xs outline-none resize-none placeholder:text-description"
|
||||
/>
|
||||
<div className="relative bg-white/25 rounded-xl">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onSave}
|
||||
disabled={isSaving}
|
||||
className="absolute top-2 left-2 z-10 h-7 px-2.5 rounded-lg bg-[#292D32] text-white text-[11px] disabled:opacity-50"
|
||||
>
|
||||
{t("save")}
|
||||
</button>
|
||||
<textarea
|
||||
value={value}
|
||||
onChange={(e) => onChange?.(e.target.value)}
|
||||
placeholder={t("taskmanager.task_detail.description_placeholder")}
|
||||
rows={5}
|
||||
className="w-full bg-transparent rounded-xl px-4 pt-10 pb-3 text-xs outline-none resize-none placeholder:text-description"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -62,14 +62,14 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!taskDetail) return;
|
||||
if (!rawTaskDetail) return;
|
||||
|
||||
setTitle(taskDetail.title);
|
||||
setDescription(taskDetail.description ?? "");
|
||||
setColor(taskDetail.color || null);
|
||||
initialTitleRef.current = taskDetail.title;
|
||||
initialDescriptionRef.current = taskDetail.description ?? "";
|
||||
}, [taskDetail]);
|
||||
setTitle(rawTaskDetail.title);
|
||||
setDescription(rawTaskDetail.description ?? "");
|
||||
setColor(rawTaskDetail.color || null);
|
||||
initialTitleRef.current = rawTaskDetail.title;
|
||||
initialDescriptionRef.current = rawTaskDetail.description ?? "";
|
||||
}, [rawTaskDetail]);
|
||||
|
||||
if (!task) return null;
|
||||
|
||||
@@ -204,7 +204,8 @@ const TaskDetailModal: FC<Props> = ({ open, task, columns, projectId, onClose, o
|
||||
<TaskDetailDescription
|
||||
value={description}
|
||||
onChange={setDescription}
|
||||
onBlur={() => saveField("description", description)}
|
||||
onSave={() => saveField("description", description)}
|
||||
isSaving={updateTask.isPending}
|
||||
/>
|
||||
|
||||
<AttachmentList attachments={taskDetail?.attachments} />
|
||||
|
||||
Reference in New Issue
Block a user