import { FC, useState } from "react"; // hooks import useToast from "hooks/use-toast"; import { useIssueDetail } from "hooks/store"; // ui import { ExternalLinkIcon, Tooltip } from "@plane/ui"; // icons import { Pencil, Trash2, LinkIcon } from "lucide-react"; // types import { IssueLinkCreateUpdateModal, TLinkOperationsModal } from "./create-update-link-modal"; // helpers import { calculateTimeAgo } from "helpers/date-time.helper"; import { copyTextToClipboard } from "helpers/string.helper"; export type TIssueLinkDetail = { linkId: string; linkOperations: TLinkOperationsModal; isNotAllowed: boolean; }; export const IssueLinkDetail: FC = (props) => { // props const { linkId, linkOperations, isNotAllowed } = props; // hooks const { toggleIssueLinkModal: toggleIssueLinkModalStore, link: { getLinkById }, } = useIssueDetail(); const { setToastAlert } = useToast(); // state const [isIssueLinkModalOpen, setIsIssueLinkModalOpen] = useState(false); const toggleIssueLinkModal = (modalToggle: boolean) => { toggleIssueLinkModalStore(modalToggle); setIsIssueLinkModalOpen(modalToggle); }; const linkDetail = getLinkById(linkId); if (!linkDetail) return <>; return (
{ copyTextToClipboard(linkDetail.url); setToastAlert({ type: "success", title: "Link copied!", message: "Link copied to clipboard", }); }} >
{linkDetail.title && linkDetail.title !== "" ? linkDetail.title : linkDetail.url}
{!isNotAllowed && (
)}

Added {calculateTimeAgo(linkDetail.created_at)}
by{" "} {linkDetail.created_by_detail.is_bot ? linkDetail.created_by_detail.first_name + " Bot" : linkDetail.created_by_detail.display_name}

); };