import { FC, useState } from "react"; import Link from "next/link"; import { AlertCircle, X } from "lucide-react"; // hooks import { useIssueDetail, useMember } from "hooks/store"; // ui import { Tooltip } from "@plane/ui"; // components import { IssueAttachmentDeleteModal } from "./delete-attachment-confirmation-modal"; // icons import { getFileIcon } from "components/icons"; // helper import { truncateText } from "helpers/string.helper"; import { renderFormattedDate } from "helpers/date-time.helper"; import { convertBytesToSize, getFileExtension, getFileName } from "helpers/attachment.helper"; // type import { TIssueAttachmentsList } from "./attachments-list"; export type TIssueAttachmentsDetail = TIssueAttachmentsList & { attachmentId: string; }; export const IssueAttachmentsDetail: FC = (props) => { // props const { attachmentId, handleAttachmentOperations } = props; // store hooks const { getUserDetails } = useMember(); const { attachment: { getAttachmentById }, } = useIssueDetail(); // states const [attachmentDeleteModal, setAttachmentDeleteModal] = useState(false); const attachment = attachmentId && getAttachmentById(attachmentId); if (!attachment) return <>; return ( <>
{getFileIcon(getFileExtension(attachment.asset))}
{truncateText(`${getFileName(attachment.attributes.name)}`, 10)}
{getFileExtension(attachment.asset).toUpperCase()} {convertBytesToSize(attachment.attributes.size)}
); };