import { CopyIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; import ApiKey from "~/models/ApiKey"; import Button from "~/components/Button"; import CopyToClipboard from "~/components/CopyToClipboard"; import Flex from "~/components/Flex"; import ListItem from "~/components/List/Item"; import useToasts from "~/hooks/useToasts"; import ApiKeyMenu from "~/menus/ApiKeyMenu"; type Props = { apiKey: ApiKey; }; const ApiKeyListItem = ({ apiKey }: Props) => { const { t } = useTranslation(); const { showToast } = useToasts(); const [linkCopied, setLinkCopied] = React.useState(false); React.useEffect(() => { if (linkCopied) { setTimeout(() => { setLinkCopied(false); }, 3000); } }, [linkCopied]); const handleCopy = React.useCallback(() => { setLinkCopied(true); showToast(t("API token copied to clipboard"), { type: "success", }); }, [showToast, t]); return ( {apiKey.secret.slice(0, 15)}…} actions={ } /> ); }; export default ApiKeyListItem;