import React, { useState } from "react"; import Link from "next/link"; import Image from "next/image"; import { useRouter } from "next/router"; // components import { DeleteModuleModal } from "components/modules"; // icons import { CalendarDaysIcon, TrashIcon } from "@heroicons/react/24/outline"; import User from "public/user.png"; // helpers import { renderShortNumericDateFormat } from "helpers/date-time.helper"; // types import { IModule, SelectModuleType } from "types"; // common import { MODULE_STATUS } from "constants/module"; type Props = { module: IModule; }; export const SingleModuleCard: React.FC = ({ module }) => { const router = useRouter(); const { workspaceSlug } = router.query; const [moduleDeleteModal, setModuleDeleteModal] = useState(false); const [selectedModuleForDelete, setSelectedModuleForDelete] = useState(); const handleDeleteModule = () => { if (!module) return; setSelectedModuleForDelete({ ...module, actionType: "delete" }); setModuleDeleteModal(true); }; return (
{module.name}
LEAD
{module.lead ? ( module.lead_detail?.avatar && module.lead_detail.avatar !== "" ? (
{module.lead_detail.first_name}
) : (
{module.lead_detail?.first_name && module.lead_detail.first_name !== "" ? module.lead_detail.first_name.charAt(0) : module.lead_detail?.email.charAt(0)}
) ) : ( "N/A" )}
MEMBERS
{module.members && module.members.length > 0 ? ( module?.members_detail?.map((member, index: number) => (
{member?.avatar && member.avatar !== "" ? (
{member?.first_name}
) : (
{member?.first_name && member.first_name !== "" ? member.first_name.charAt(0) : member?.email?.charAt(0)}
)}
)) ) : (
No user
)}
END DATE
{renderShortNumericDateFormat(module.target_date ?? "")}
STATUS
s.value === module.status)?.color, }} /> {module.status}
); };