import * as React from "react"; import List from "@mui/material/List"; import ListItem from "@mui/material/ListItem"; import ListItemButton from "@mui/material/ListItemButton"; import ListItemIcon from "@mui/material/ListItemIcon"; import ListItemText from "@mui/material/ListItemText"; import Checkbox from "@mui/material/Checkbox"; import IconButton from "@mui/material/IconButton"; import CommentIcon from "@mui/icons-material/Comment"; import InfoIcon from "@mui/icons-material/Info"; import { Box, Typography } from "@mui/material"; import { Spacer } from "../../common/Spacer"; import { isMobile } from "../../App"; import { QMailMessages } from "./QMailMessages"; export const ThingsToDoInitial = ({ myAddress, name, hasGroups, balance , userInfo}) => { const [checked1, setChecked1] = React.useState(false); const [checked2, setChecked2] = React.useState(false); const [checked3, setChecked3] = React.useState(false); // const getAddressInfo = async (address) => { // const response = await fetch(getBaseApiReact() + "/addresses/" + address); // const data = await response.json(); // if (data.error && data.error === 124) { // setChecked1(false); // } else if (data.address) { // setChecked1(true); // } // }; // const checkInfo = async () => { // try { // getAddressInfo(myAddress); // } catch (error) {} // }; React.useEffect(() => { if (balance && +balance >= 6) { setChecked1(true); } }, [balance]); React.useEffect(() => { if (hasGroups) setChecked3(true); }, [hasGroups]); React.useEffect(() => { if (name) setChecked2(true); }, [name]); const isLoaded = React.useMemo(()=> { if(balance !== null && userInfo !== null) return true return false }, [balance, userInfo]) const hasDoneNameAndBalanceAndIsLoaded = React.useMemo(()=> { if(isLoaded && checked1 && checked2) return true return false }, [checked1, isLoaded, checked2]) if(hasDoneNameAndBalanceAndIsLoaded){ return ( ); } return ( {!isLoaded ? 'Loading...' : 'Getting Started' } // // // } disablePadding sx={{ marginBottom: '20px' }} > {/* */} // // // } disablePadding > // // // } disablePadding > ); };