mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* update styles of tx details * common color for text separator * remove bold fontWeight from some details items * address, block, token, pool, user ops details pages * refactor chain-specific views * unify grid column template for detailed views * remove TODO * update margins for text separator * update screenshots * update margin between icon and text for mobile * rename prop * update layout of decoded input data * update screenshots * fix tac operation and zilliqa quorum snippets
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { chakra } from '@chakra-ui/react';
|
|
import BigNumber from 'bignumber.js';
|
|
import React from 'react';
|
|
|
|
import config from 'configs/app';
|
|
import { Tooltip } from 'toolkit/chakra/tooltip';
|
|
|
|
import GasUsedToTargetRatio from '../GasUsedToTargetRatio';
|
|
import TextSeparator from '../TextSeparator';
|
|
import Utilization from '../Utilization/Utilization';
|
|
|
|
const rollupFeature = config.features.rollup;
|
|
|
|
interface Props {
|
|
className?: string;
|
|
gasUsed?: string;
|
|
gasLimit: string;
|
|
gasTarget?: number;
|
|
isLoading?: boolean;
|
|
}
|
|
|
|
const BlockGasUsed = ({ className, gasUsed, gasLimit, gasTarget, isLoading }: Props) => {
|
|
const hasGasUtilization =
|
|
gasUsed && gasUsed !== '0' &&
|
|
(!rollupFeature.isEnabled || rollupFeature.type === 'optimistic' || rollupFeature.type === 'shibarium');
|
|
|
|
if (!hasGasUtilization) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Tooltip content="Gas Used %" disabled={ isLoading }>
|
|
<Utilization
|
|
colorScheme="gray"
|
|
value={ BigNumber(gasUsed).dividedBy(BigNumber(gasLimit)).toNumber() }
|
|
isLoading={ isLoading }
|
|
className={ className }
|
|
/>
|
|
</Tooltip>
|
|
{ gasTarget && (
|
|
<>
|
|
<TextSeparator/>
|
|
<GasUsedToTargetRatio value={ gasTarget } isLoading={ isLoading }/>
|
|
</>
|
|
) }
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default React.memo(chakra(BlockGasUsed));
|