fix a problem error
This commit is contained in:
@@ -17,9 +17,10 @@ const CommentList: FC<Props> = ({ taskId, enabled = true }) => {
|
|||||||
const createComment = useCreateTaskComment();
|
const createComment = useCreateTaskComment();
|
||||||
|
|
||||||
const comments = getComments.data?.data ?? [];
|
const comments = getComments.data?.data ?? [];
|
||||||
|
const trimmedContent = content.trim();
|
||||||
|
const isSubmitDisabled = createComment.isPending || trimmedContent.length === 0;
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const trimmedContent = content.trim();
|
|
||||||
if (!trimmedContent) return;
|
if (!trimmedContent) return;
|
||||||
|
|
||||||
createComment.mutate(
|
createComment.mutate(
|
||||||
@@ -44,7 +45,7 @@ const CommentList: FC<Props> = ({ taskId, enabled = true }) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
disabled={createComment.isPending || !content.trim()}
|
disabled={isSubmitDisabled}
|
||||||
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="absolute top-2 left-2 z-10 h-7 px-2.5 rounded-lg bg-[#292D32] text-white text-[11px] disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{t("taskmanager.task_detail.add_comment")}
|
{t("taskmanager.task_detail.add_comment")}
|
||||||
|
|||||||
Reference in New Issue
Block a user