e5f41731ae
* bootstrap next app + add overview page * fix AssetList type * fix up nav stuff * Refactor Nav component and add network components pages * Refactor WorldMap component and update TelegramIcon, GitHubIcon, NymVpnIcon, DiscordIcon, and TwitterIcon components * add service providers page * mixnodes page * delegations page + use material react table for all tables * nodes map page * Refactor StyledLink component and remove unnecessary console.log statements * Refactor ESLint configuration, remove unused dependencies, and update component imports * update deps * Refactor imports and update dependencies * fix dark mode * build single mixnode page * build single gateway page * Refactor handleOnDelegate function to use useCallback in mixnodes page.tsx * Add defaults for constants --------- Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgress';
|
|
import { useTheme } from '@mui/material/styles';
|
|
import { Box } from '@mui/system';
|
|
|
|
const parseToNumber = (value: number | undefined | string) =>
|
|
typeof value === 'string' ? parseInt(value || '', 10) : value || 0;
|
|
|
|
export const EconomicsProgress: FCWithChildren<
|
|
LinearProgressProps & {
|
|
threshold?: number;
|
|
color: string;
|
|
}
|
|
> = ({ threshold, color, ...props }) => {
|
|
const theme = useTheme();
|
|
const { value } = props;
|
|
|
|
const valueNumber: number = parseToNumber(value);
|
|
const thresholdNumber: number = parseToNumber(threshold);
|
|
const percentageToDisplay = Math.min(valueNumber, thresholdNumber);
|
|
|
|
return (
|
|
<Box
|
|
sx={{
|
|
width: 6 / 10,
|
|
color: valueNumber > (threshold || 100) ? theme.palette.warning.main : theme.palette.nym.wallet.fee,
|
|
}}
|
|
>
|
|
<LinearProgress
|
|
{...props}
|
|
variant="determinate"
|
|
color={color}
|
|
value={percentageToDisplay}
|
|
sx={{ width: '100%', borderRadius: '5px' }}
|
|
/>
|
|
</Box>
|
|
);
|
|
};
|