import { useEffect, useState } from 'react'; import { Box, Button } from '@mui/material'; import { detectExtension, openPlugin } from '../../../tools/extension'; import { CHROME_EXTENSION_LINK } from '../../../constants'; export function OpenExtension() { const [present, setPresent] = useState(); useEffect(() => { let mounted = true; detectExtension().then((found) => mounted && setPresent(found)); return () => { mounted = false; }; }, []); if (present === undefined) { return null; } return ( {present ? ( ) : ( )} ); }