import { useState, useEffect } from "react"; import type { InstallAppButtonProps } from "@calcom/app-store/types"; import useApp from "@calcom/lib/hooks/useApp"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { DialogProps } from "@calcom/ui"; import { Button } from "@calcom/ui"; import { Dialog, DialogClose, DialogContent, DialogFooter } from "@calcom/ui"; import useAddAppMutation from "../../_utils/useAddAppMutation"; export default function InstallAppButton(props: InstallAppButtonProps) { const [showWarningDialog, setShowWarningDialog] = useState(false); return ( <> {props.render({ onClick() { setShowWarningDialog(true); // mutation.mutate(""); }, disabled: showWarningDialog, })} ); } function WarningDialog(props: DialogProps) { const { t } = useLocale(); const googleCalendarData = useApp("google-calendar"); const googleCalendarPresent = googleCalendarData.data?.isInstalled; const mutation = useAddAppMutation(googleCalendarPresent ? "google_video" : "google_calendar", { installGoogleVideo: !googleCalendarPresent, }); return ( <> { props.onOpenChange?.(false); }}> {t("cancel")} ); }