import classNames from "classnames"; import { useRef } from "react"; import { TbReload } from "react-icons/tb"; import { toast } from "react-toastify"; import { FaLaptopCode } from "react-icons/fa6"; import { defaultHTML } from "../../../utils/consts"; function Preview({ html, isResizing, isAiWorking, setView, ref, }: { html: string; isResizing: boolean; isAiWorking: boolean; setView: React.Dispatch>; ref: React.RefObject; }) { const iframeRef = useRef(null); const handleRefreshIframe = () => { if (iframeRef.current) { const iframe = iframeRef.current; const content = iframe.srcdoc; iframe.srcdoc = ""; setTimeout(() => { iframe.srcdoc = content; }, 10); } }; return (
{ if (isAiWorking) { e.preventDefault(); e.stopPropagation(); toast.warn("Please wait for the AI to finish working."); } }} >