import { useAutoAnimate } from "@formkit/auto-animate/react"; import Link from "next/link"; import { classNames } from "@calcom/lib"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Switch, Badge, Avatar } from "@calcom/ui"; import type { SetAppDataGeneric } from "../EventTypeAppContext"; import type { eventTypeAppCardZod } from "../eventTypeAppCardZod"; import type { CredentialOwner } from "../types"; import OmniInstallAppButton from "./OmniInstallAppButton"; export default function AppCard({ app, description, switchOnClick, switchChecked, children, setAppData, returnTo, teamId, disableSwitch, LockedIcon, }: { app: RouterOutputs["viewer"]["integrations"]["items"][number] & { credentialOwner?: CredentialOwner }; description?: React.ReactNode; switchChecked?: boolean; switchOnClick?: (e: boolean) => void; children?: React.ReactNode; setAppData: SetAppDataGeneric; returnTo?: string; teamId?: number; disableSwitch?: boolean; LockedIcon?: React.ReactNode; }) { const [animationRef] = useAutoAnimate(); return (
{/* Don't know why but w-[42px] isn't working, started happening when I started using next/dynamic */} {app?.name}
{app?.name} {!app?.isInstalled && ( {app?.categories[0].charAt(0).toUpperCase() + app?.categories[0].slice(1)} )}

{description || app?.description}

{app.credentialOwner && (
{app.credentialOwner.name}
)} {app?.isInstalled || app.credentialOwner ? (
{ if (switchOnClick) { switchOnClick(enabled); } setAppData("enabled", enabled); }} checked={switchChecked} LockedIcon={LockedIcon} />
) : ( )}
{app?.isInstalled && switchChecked &&
} {app?.isInstalled && switchChecked ? (
{children}
) : null}
); }