Skip to content

Commit

Permalink
added not deposited status for validator page, added status for valid…
Browse files Browse the repository at this point in the history
…ators on operator dashboard
  • Loading branch information
axelrod-blox committed Sep 15, 2024
1 parent 493d9e3 commit 0da9081
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/app/common/components/Status/Status.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface StatusEntry {
is_deleted?: boolean;
is_valid?: boolean;
status?: string;
isNotDepositedValidator?: boolean;
}

export interface StatusProps {
Expand Down Expand Up @@ -43,8 +44,8 @@ export const useStyles = makeStyles(() => ({
color = 'rgb(236, 28, 38)';
backgroundColor = 'rgba(236, 28, 38, 0.12)';

// Not validators (for operator status only)
} else if (props.entry?.is_active === -1) {
// Not validators or Not deposited
} else if (props.entry?.is_active === -1 || props.entry?.isNotDepositedValidator) {
color = '#34455a';
backgroundColor = '#e6eaf7';
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/app/common/components/Status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const Status = (props: StatusProps) => {
let statusText = props.entry.status;
if (props.entry.is_deleted) {
statusText = 'Deleted';
} else if (props.entry.isNotDepositedValidator) {
statusText = 'Not Deposited';
} else if (!props.entry.is_valid) {
statusText = 'Invalid';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { longStringShorten } from '~lib/utils/strings';
import BeaconchaLink from '~app/common/components/BeaconchaLink';
import DataTable from '~app/common/components/DataTable/DataTable';
import CopyToClipboardIcon from '~app/common/components/CopyToClipboardIcon';
import Status from '~app/common/components/Status';

type ValidatorsInOperatorTableProps = {
validators: any[],
Expand Down Expand Up @@ -43,10 +44,11 @@ const ValidatorsInOperatorTable = (props: ValidatorsInOperatorTableProps) => {
0x{longStringShorten(validator.public_key, 20)}
</Box>
<Box className={classes.blackLinkColor} component="div" display={{ xs: 'none', sm: 'none', md: 'none', lg: 'block' }}>
0x{validator.public_key}
0x{longStringShorten(validator.public_key, 30)}
</Box>
</Typography>
</Link>,
<Status entry={validator} />,
<div style={{ marginTop: 3, whiteSpace: 'nowrap' }}>
<CopyToClipboardIcon data={validator.public_key} />
<BeaconchaLink height={24} width={24} address={`validator/${validator.public_key}`} />
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/Validator/Validator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import BeaconchaLink from '~app/common/components/BeaconchaLink/BeaconchaLink';
import ValidatorDuties from '~app/components/Validator/components/ValidatorDuties';
import ValidatorOperators from '~app/components/Validator/components/ValidatorOperators';
import { BreadCrumb, BreadCrumbDivider } from '~app/common/components/Breadcrumbs';
import chainService, { EChain } from '~lib/utils/ChainService';

const StatsBlock = styled.div<({ maxWidth?: any })>`
max-width: ${({ maxWidth }) => `${Number.isNaN(maxWidth ?? 200) ? (maxWidth) : `${(maxWidth ?? 200)}px`}`};
Expand Down Expand Up @@ -48,6 +49,9 @@ const Validator = () => {
const [notFound, setNotFound] = useState(false);
const [validator, setValidator] = useState(defaultValidator);
const [loadingValidator, setLoadingValidator] = useState(false);
const currentNetwork = chainService().getNetwork();
const isHoleskyTestnet = currentNetwork === EChain.Holesky;
const isNotDepositedValidator = !validator.validatorInfo && isHoleskyTestnet;

/**
* Fetch one operator by it's address
Expand Down Expand Up @@ -86,7 +90,7 @@ const Validator = () => {
</StatsBlock>
</Grid>
<Grid item>
{!_.isEmpty(validator) && <Status size="big" entry={validator} />}
{!_.isEmpty(validator) && <Status size="big" entry={{ ...validator, isNotDepositedValidator }} />}
</Grid>
<Grid item>
{!_.isEmpty(validator) && <IsValidBadge size="big" entry={validator} />}
Expand Down

0 comments on commit 0da9081

Please sign in to comment.