import { useState } from "react"; import { XCircle } from "lucide-react"; import { IApiToken } from "@plane/types"; // components import { Tooltip } from "@plane/ui"; import { DeleteApiTokenModal } from "@/components/api-token"; import { renderFormattedDate, calculateTimeAgo } from "@/helpers/date-time.helper"; import { usePlatformOS } from "@/hooks/use-platform-os"; // ui // helpers // types type Props = { token: IApiToken; }; export const ApiTokenListItem: React.FC = (props) => { const { token } = props; // states const [deleteModalOpen, setDeleteModalOpen] = useState(false); // hooks const { isMobile } = usePlatformOS(); return ( <> setDeleteModalOpen(false)} tokenId={token.id} />
{token.label}
{token.is_active ? "Active" : "Expired"}
{token.description.trim() !== "" && (

{token.description}

)}

{token.is_active ? token.expired_at ? `Expires ${renderFormattedDate(token.expired_at!)}` : "Never expires" : `Expired ${calculateTimeAgo(token.expired_at)}`}

); };