import { Box } from '@mui/material'; import { useContext, useMemo } from 'react'; import API_BASE_URL from '../lib/consts/API_BASE_URL'; import { AnvilContext } from './AnvilContext'; import { AllocationBar } from './Bars'; import { toBinaryByte } from '../lib/format_data_size_wrappers'; import { Panel, PanelHeader } from './Panels'; import periodicFetch from '../lib/fetchers/periodicFetch'; import Spinner from './Spinner'; import { HeaderText, BodyText } from './Text'; const Memory = (): JSX.Element => { const { uuid } = useContext(AnvilContext); const { data: { allocated = '0', reserved = '0', total = '0' } = {}, isLoading, } = periodicFetch(`${API_BASE_URL}/anvil/${uuid}/memory`); const nAllocated = useMemo(() => BigInt(allocated), [allocated]); const nReserved = useMemo(() => BigInt(reserved), [reserved]); const nTotal = useMemo(() => BigInt(total), [total]); return ( {!isLoading ? ( <> ) : ( )} ); }; export default Memory;