import * as React from "react"; import { toast } from "sonner"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Icon } from "../icon"; type ProgressToastProps = { message?: string; progress: number; toastId: string | number; onClose: (toastId: string | number) => void; }; export const ProgressToast = ({ message, progress, onClose, toastId }: ProgressToastProps) => { const { t } = useLocale(); const defaultMessage = t("downloading"); return (

{message || defaultMessage}

{Math.floor(progress)}%
); }; export function showProgressToast(progress: number, message?: string, toastId = "download-progress") { const onClose = (id: string | number) => { toast.dismiss(id); }; return toast.custom( (id) => , { id: toastId, duration: Infinity, // Keep the toast visible until dismissed position: "bottom-center", } ); } export function hideProgressToast(toastId = "download-progress") { toast.dismiss(toastId); }