import React, { useState, useRef, useEffect, useMemo } from "react"; 
 | 
import { 
 | 
    Fab, 
 | 
} from '@mui/material'; 
 | 
import LensBlurIcon from '@mui/icons-material/LensBlur'; 
 | 
import { getFakeSign, setFakeSign } from "../http"; 
 | 
  
 | 
const FakeFab = (props) => { 
 | 
    const [fakeRun, setFakeRun] = useState(false); 
 | 
  
 | 
    useEffect(() => { 
 | 
        getFakeSign(null, (res) => { 
 | 
            setFakeRun(res); 
 | 
        }); 
 | 
    }, [props]); 
 | 
  
 | 
    const handleToggle = () => { 
 | 
        getFakeSign(null, (res) => { 
 | 
            let pass = true; 
 | 
            // if (!res) { 
 | 
            //     const pwd = prompt("please enter password:"); 
 | 
            //     if (pwd === 'xltys1995') { 
 | 
            //         pass = true; 
 | 
            //     } else { 
 | 
            //         pass = false; 
 | 
            //         alert('Incorrect password'); 
 | 
            //     } 
 | 
            // } 
 | 
            if (pass) { 
 | 
                setFakeSign(!res, (updatedSign) => { 
 | 
                    setFakeRun(updatedSign); 
 | 
                }); 
 | 
            } 
 | 
        }); 
 | 
    } 
 | 
  
 | 
    return ( 
 | 
        <> 
 | 
            <Fab 
 | 
                variant="extended" 
 | 
                color={fakeRun ? 'primary' : 'default'} 
 | 
                size="small" 
 | 
                onClick={handleToggle} 
 | 
            > 
 | 
                <LensBlurIcon /> 
 | 
                {/*  {translate('page.map.action.adapt')} */} 
 | 
            </Fab> 
 | 
        </> 
 | 
    ) 
 | 
} 
 | 
  
 | 
export default FakeFab; 
 |