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