import { AttachCircle, Calendar, TickSquare } from "iconsax-react"; import { useEffect, useRef, type FC } from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Pages } from "../../../config/Pages"; import type { Task as TaskType } from "../types"; import UserAvatar from "./UserAvatar"; type Props = { task: TaskType; isDragging?: boolean; onClick?: (task: TaskType) => void; }; const Task: FC = ({ task, isDragging, onClick }) => { const { t } = useTranslation("global"); const suppressClickRef = useRef(false); useEffect(() => { if (isDragging) { suppressClickRef.current = true; } }, [isDragging]); const handleClick = () => { if (suppressClickRef.current) { suppressClickRef.current = false; return; } onClick?.(task); }; return (
{task.color ?
: null} {task.tag ? (
{task.tag}
) : null}
{task.title}
{task.ticketId ? ( e.stopPropagation()} className="mt-2 inline-flex items-center text-[10px] text-primary hover:underline" > {t("taskmanager.task_detail.related_ticket")} ) : null}
{task.dateRange}
{task.attachments}
{task.checklistDone}/{task.checklistTotal}
{task.users?.length ? (
{task.users.map((user) => ( ))}
) : null}
); }; export default Task;