import Link from "next/link"; import { useRouter } from "next/router"; import { ReactNode, useEffect, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Badge, ListItem, ListItemText, ListItemTitle, showToast } from "@calcom/ui"; import { FiAlertCircle } from "@calcom/ui/components/icon"; import classNames from "@lib/classNames"; function IntegrationListItem(props: { imageSrc?: string; slug: string; name?: string; title?: string; description: string; actions?: ReactNode; children?: ReactNode; logo: string; destination?: boolean; separate?: boolean; invalidCredential?: boolean; isTemplate?: boolean; }): JSX.Element { const { t } = useLocale(); const router = useRouter(); const { hl } = router.query; const [highlight, setHighlight] = useState(hl === props.slug); const title = props.name || props.title; // The highlight is to show a newly installed app, coming from the app's // redirection after installation, so we proceed to show the corresponding // message if (highlight) { showToast(t("app_successfully_installed"), "success"); } useEffect(() => { const timer = setTimeout(() => setHighlight(false), 3000); return () => { clearTimeout(timer); }; }, []); return (
{props.logo && {title}}
{props.name || title} {props.isTemplate && ( Template )} {props.description} {/* Alert error that key stopped working. */} {props.invalidCredential && (
{t("invalid_credential")}
)}
{props.actions}
{props.children &&
{props.children}
}
); } export default IntegrationListItem;