import classNames from "classnames"; import { FaMobileAlt } from "react-icons/fa"; import { HelpCircle, LogIn, RefreshCcw, SparkleIcon } from "lucide-react"; import { FaLaptopCode } from "react-icons/fa6"; import { HtmlHistory, Page } from "@/types"; import { Button } from "@/components/ui/button"; import { MdAdd } from "react-icons/md"; import { History } from "@/components/editor/history"; import { UserMenu } from "@/components/user-menu"; import { useUser } from "@/hooks/useUser"; import Link from "next/link"; import { useLocalStorage } from "react-use"; import { isTheSameHtml } from "@/lib/compare-html-diff"; const DEVICES = [ { name: "desktop", icon: FaLaptopCode, }, { name: "mobile", icon: FaMobileAlt, }, ]; export function Footer({ pages, isNew = false, htmlHistory, setPages, device, setDevice, iframeRef, }: { pages: Page[]; isNew?: boolean; htmlHistory?: HtmlHistory[]; device: "desktop" | "mobile"; setPages: (pages: Page[]) => void; iframeRef?: React.RefObject; setDevice: React.Dispatch>; }) { const { user, openLoginWindow } = useUser(); const handleRefreshIframe = () => { if (iframeRef?.current) { const iframe = iframeRef.current; const content = iframe.srcdoc; iframe.srcdoc = ""; setTimeout(() => { iframe.srcdoc = content; }, 10); } }; const [, setStorage] = useLocalStorage("pages"); const handleClick = async () => { if (pages && !isTheSameHtml(pages[0].html)) { setStorage(pages); } openLoginWindow(); }; return ( ); }