import { useAutoAnimate } from "@formkit/auto-animate/react"; import Link from "next/link"; import { useAppContextWithSchema } from "@calcom/app-store/EventTypeAppContext"; import { classNames } from "@calcom/lib"; import type { RouterOutputs } from "@calcom/trpc/react"; import { Switch, Badge, Avatar } from "@calcom/ui"; import type { CredentialOwner } from "../types"; import OmniInstallAppButton from "./OmniInstallAppButton"; export default function AppCard({ app, description, switchOnClick, switchChecked, children, returnTo, teamId, }: { app: RouterOutputs["viewer"]["integrations"]["items"][number] & { credentialOwner?: CredentialOwner }; description?: React.ReactNode; switchChecked?: boolean; switchOnClick?: (e: boolean) => void; children?: React.ReactNode; returnTo?: string; teamId?: number; LockedIcon?: React.ReactNode; }) { const [animationRef] = useAutoAnimate(); const { setAppData, LockedIcon, disabled } = useAppContextWithSchema(); 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}
); }