import React, { useEffect, useState } from 'react'; import { styled, Dialog, Button, DialogContent } from '@mui/material'; import { DEVTOOLS_Z_INDEX, CHROME_EXTENSION_LINK } from '../../../constants'; type Props = { onClose: () => void; }; const ScTitle = styled('div')` display: flex; margin: 0px 0px 26px 0px; font-size: 19px; `; const ScText = styled('div')` margin: 8px 0px; `; const ScControls = styled('div')` display: flex; justify-content: flex-end; margin: ${({ theme }) => theme.spacing(1)}; min-height: 36px; `; export const ExtensionPrompt: React.FC = ({ onClose }) => { const [installClicked, setInstallClicked] = useState(false); const onReload = () => { window.location.reload(); }; useEffect(() => { const handler = () => { setInstallClicked(true); }; // act like extension was installed after user returns to this window window.addEventListener('focus', handler); return () => window.removeEventListener('focus', handler); }, []); return ( {installClicked ? ( <> Browser extension required After installing the extension, you need to reload this page. ) : ( <> Browser extension required To make automatic screenshots please install Tolgee browser extension. )} ); };