import CommentIcon from '@mui/icons-material/CommentTwoTone'; import EastIcon from '@mui/icons-material/East'; import DownloadIcon from '@mui/icons-material/GetApp'; import GitHubIcon from '@mui/icons-material/GitHub'; import MenuBookIcon from '@mui/icons-material/MenuBookTwoTone'; import { Box, List, ListItem, ListItemAvatar, ListItemText, Link, Typography, Button } from '@mui/material'; import { useRequest } from 'alova'; import { toast } from 'react-toastify'; import type { FC } from 'react'; import { SectionContent, useLayoutTitle } from 'components'; import { useI18nContext } from 'i18n/i18n-react'; import * as EMSESP from 'project/api'; const Help: FC = () => { const { LL } = useI18nContext(); useLayoutTitle(LL.HELP_OF('')); const { send: getAPI, onSuccess: onGetAPI } = useRequest((data) => EMSESP.API(data), { immediate: false }); onGetAPI((event) => { const anchor = document.createElement('a'); anchor.href = URL.createObjectURL( new Blob([JSON.stringify(event.data, null, 2)], { type: 'text/plain' }) ); anchor.download = 'emsesp_' + event.sendArgs[0].device + '_' + event.sendArgs[0].entity + '.txt'; anchor.click(); URL.revokeObjectURL(anchor.href); toast.info(LL.DOWNLOAD_SUCCESSFUL()); }); const callAPI = async (device: string, entity: string) => { await getAPI({ device, entity, id: 0 }).catch((error) => { toast.error(error.message); }); }; return ( {LL.HELP_INFORMATION_1()}    {LL.CLICK_HERE()} {LL.HELP_INFORMATION_2()}    {LL.CLICK_HERE()} {LL.HELP_INFORMATION_3()}  {LL.CLICK_HERE()}
{LL.HELP_INFORMATION_4()} {LL.HELP_INFORMATION_5()} {'github.com/emsesp/EMS-ESP32'} @proddy @MichaelDvP
); }; export default Help;