import { Box, styled } from '@mui/material'; import { useMemo } from 'react'; import { AllocationBar } from '../Bars'; import { toBinaryByte } from '../../lib/format_data_size_wrappers'; import { BodyText } from '../Text'; const PREFIX = 'SharedStorageHost'; const classes = { fs: `${PREFIX}-fs`, bar: `${PREFIX}-bar`, decoratorBox: `${PREFIX}-decoratorBox`, }; const StyledDiv = styled('div')(() => ({ [`& .${classes.fs}`]: { paddingLeft: '.7em', paddingRight: '.7em', }, [`& .${classes.bar}`]: { paddingLeft: '.7em', paddingRight: '.7em', }, [`& .${classes.decoratorBox}`]: { paddingRight: '.3em', }, })); const SharedStorageHost = ({ group, }: { group: AnvilSharedStorageGroup; }): JSX.Element => { const { storage_group_free: sgFree, storage_group_total: sgTotal } = group; const nFree = useMemo(() => BigInt(sgFree), [sgFree]); const nTotal = useMemo(() => BigInt(sgTotal), [sgTotal]); const nAllocated = useMemo(() => nTotal - nFree, [nFree, nTotal]); const percentAllocated = useMemo( () => Number((nAllocated * BigInt(100)) / nTotal), [nAllocated, nTotal], ); return ( ); }; export default SharedStorageHost;