import { useTranslation } from "@browser-skill/i18n/react"; import { RiStopCircleLine } from "@remixicon/react"; import { useEffect, useState } from "react"; import logoUrl from "../../assets/logo.png"; export interface ControlOverlayProps { visible: boolean; interrupting: boolean; automationBypass: boolean; onInterrupt: () => void; } export function ControlOverlay({ visible, interrupting, automationBypass, onInterrupt, }: ControlOverlayProps) { const { t } = useTranslation("extension"); const [show, setShow] = useState(false); useEffect(() => { if (visible) { const raf = requestAnimationFrame(() => setShow(true)); return () => cancelAnimationFrame(raf); } setShow(false); }, [visible]); if (!visible) return null; const pointerEvents = automationBypass ? "none" : "auto"; return ( <>
{ if (automationBypass) return; event.preventDefault(); event.stopPropagation(); }} onClick={(event) => { if (automationBypass) return; event.preventDefault(); event.stopPropagation(); }} style={{ position: "fixed", inset: 0, zIndex: 2147483646, pointerEvents, background: "transparent", opacity: show ? 1 : 0, transition: "opacity 300ms ease-out", }} />
browser-skill {t("controlOverlay.status")}
); }