-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: validator details page loading (#1316)
## Description Closes: #XXXX [BDU-1132](https://forbole.atlassian.net/jira/software/c/projects/BDU/issues/BDU-1132) <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [x] ran linting via `yarn lint` - [ ] wrote tests where necessary - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] targeted the correct branch - [x] provided a link to the relevant issue or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed - [x] added a changeset via [`yarn && yarn changeset`](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) [BDU-1132]: https://forbole.atlassian.net/browse/BDU-1132?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
16 changed files
with
161 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'ui': patch | ||
--- | ||
|
||
fix validator details page loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
apps/web-nomic/src/screens/validator_details/components/blocks/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import Typography from '@mui/material/Typography'; | ||
import useAppTranslation from '@/hooks/useAppTranslation'; | ||
import numeral from 'numeral'; | ||
import { FC } from 'react'; | ||
import Loading from '@/components/loading'; | ||
import AvatarName from '@/components/avatar_name'; | ||
import Box from '@/components/box'; | ||
import Result from '@/components/result'; | ||
import { useProfileRecoil } from '@/recoil/profiles/hooks'; | ||
import { useBlocks } from '@/screens/validator_details/components/blocks/hooks'; | ||
import useStyles from '@/screens/validator_details/components/blocks/styles'; | ||
|
||
type BlockBoxProps = { | ||
i: number; | ||
item: ReturnType<typeof useBlocks>['state'][number]; | ||
state: ReturnType<typeof useBlocks>['state']; | ||
}; | ||
|
||
const BlockBox: FC<BlockBoxProps> = ({ i, item, state }) => { | ||
const { address, imageUrl, name } = useProfileRecoil(item.proposer); | ||
const { t } = useAppTranslation('validators'); | ||
const { classes, cx } = useStyles(); | ||
return ( | ||
<Tooltip | ||
enterTouchDelay={50} | ||
title={ | ||
<Box className={classes.toolTip}> | ||
<div className={classes.item}> | ||
<Typography variant="h4" className="label"> | ||
{t('proposer')} | ||
</Typography> | ||
<AvatarName address={address} imageUrl={imageUrl} name={name} /> | ||
</div> | ||
<div className={classes.item}> | ||
<Typography variant="h4" className="label"> | ||
{t('block')} | ||
</Typography> | ||
<Typography variant="body1" className="value"> | ||
{numeral(item.height).format('0,0')} | ||
</Typography> | ||
</div> | ||
<div className={classes.item}> | ||
<Typography variant="h4" className="label"> | ||
{t('txs')} | ||
</Typography> | ||
<Typography variant="body1" className="value"> | ||
{numeral(item.txs).format('0,0')} | ||
</Typography> | ||
</div> | ||
<div className={classes.item}> | ||
<Typography variant="h4" className="label"> | ||
{t('signed')} | ||
</Typography> | ||
<Result success={item.signed} /> | ||
</div> | ||
</Box> | ||
} | ||
placement="top" | ||
> | ||
<div | ||
className={cx(classes.singleBlock, { | ||
signed: state[i].signed, | ||
})} | ||
/> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
const Blocks: FC<ComponentDefault> = ({ className }) => { | ||
const { t } = useAppTranslation('validators'); | ||
const { state, loading } = useBlocks(); | ||
const { classes, cx } = useStyles(); | ||
return ( | ||
<Box className={cx(classes.root, className)}> | ||
<Typography variant="h2">{t('lastBlocks')}</Typography> | ||
{loading && <Loading />} | ||
<div className={classes.blocks}> | ||
{state.map((x, i) => ( | ||
<BlockBox key={x.height} i={i} item={x} state={state} /> | ||
))} | ||
</div> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default Blocks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
8789ccb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
cosmos – ./
cosmos-git-main-bigdipper.vercel.app
cosmos-bigdipper.vercel.app
bigdipper.vercel.app