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"; import { executeEvent } from "../../utils/events"; 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); // React.useEffect(() => { // if (hasGroups) setChecked3(true); // }, [hasGroups]); React.useEffect(() => { if (balance && +balance >= 6) { setChecked1(true); } }, [balance]); React.useEffect(() => { if (name) setChecked2(true); }, [name]); const isLoaded = React.useMemo(()=> { if(userInfo !== null) return true return false }, [ userInfo]) const hasDoneNameAndBalanceAndIsLoaded = React.useMemo(()=> { if(isLoaded && checked1 && checked2) return true return false }, [checked1, isLoaded, checked2]) if(hasDoneNameAndBalanceAndIsLoaded){ return ( ); } if(!isLoaded) return null return ( {!isLoaded ? 'Loading...' : 'Getting Started' } {isLoaded && ( { executeEvent("openBuyQortInfo", {}) }} > {/* */} // // // } disablePadding > { executeEvent('openRegisterName', {}) }} sx={{ "& .MuiTypography-root": { fontSize: "1rem", fontWeight: 400, }, }} primary={`Register a name`} /> {/* */} )} ); };