import React, { useState } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; import Image from "next/image"; // components import { DeleteModuleModal } from "components/modules"; // ui import { AssigneesList, Avatar, CustomMenu } from "components/ui"; // icons import User from "public/user.png"; import { CalendarDaysIcon } from "@heroicons/react/24/outline"; // helpers import { renderShortNumericDateFormat } from "helpers/date-time.helper"; // types import { IModule } from "types"; // common import { MODULE_STATUS } from "constants/module"; import useToast from "hooks/use-toast"; import { copyTextToClipboard } from "helpers/string.helper"; type Props = { module: IModule; handleEditModule: () => void; }; export const SingleModuleCard: React.FC = ({ module, handleEditModule }) => { const [moduleDeleteModal, setModuleDeleteModal] = useState(false); const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { setToastAlert } = useToast(); const handleDeleteModule = () => { if (!module) return; setModuleDeleteModal(true); }; const handleCopyText = () => { const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; copyTextToClipboard( `${originURL}/${workspaceSlug}/projects/${projectId}/modules/${module.id}` ).then(() => { setToastAlert({ type: "success", title: "Link Copied!", message: "Module link copied to clipboard.", }); }); }; return ( <>
Edit module Delete module Copy module link
{module.name}
LEAD
{module.lead_detail ? ( ) : (
N/A N/A
)}
MEMBERS
{module.members_detail && module.members_detail.length > 0 ? ( ) : (
N/A N/A
)}
END DATE
{module.target_date ? renderShortNumericDateFormat(module?.target_date) : "N/A"}
STATUS
s.value === module.status)?.color, }} /> {module.status}
); };