import { useContext } from 'react'; import { Box } from '@mui/material'; import { Panel } from './Panels'; import { HeaderText, BodyText } from './Text'; import PeriodicFetch from '../lib/fetchers/periodicFetch'; import { AnvilContext } from './AnvilContext'; import Spinner from './Spinner'; const CPU = (): JSX.Element => { const { uuid } = useContext(AnvilContext); const { data, isLoading } = PeriodicFetch( `${process.env.NEXT_PUBLIC_API_URL}/get_cpu?anvil_uuid=${uuid}`, ); const cpuData = isLoading || !data ? { allocated: 0, cores: 0, threads: 0 } : data; return ( {!isLoading ? ( <> ) : ( )} ); }; export default CPU;