Skip to content

Commit

Permalink
feat(webapp): add empty state when the bpjson is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Torresmorah committed Dec 7, 2022
1 parent c1a1097 commit 7852d84
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
Binary file added webapp/public/empty-states/Error.webp
Binary file not shown.
17 changes: 16 additions & 1 deletion webapp/src/components/InformationCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ const InformationCard = ({ producer, rank, type }) => {
}

const BlockProducerInfo = () => {
if (producerOrg.healthStatus?.length <= 1) {
return (
<div className={`bodyWrapper ${classes.borderLine}`}>
<div className={classes.emptyState}>
<img
className={classes.imgError}
src="/empty-states/Error.webp"
alt=""
/>
<span>{t('emptyState')}</span>
</div>
</div>
)
}

return (
<div className="bodyWrapper">
<div className={clsx(classes.info, classes[type])}>
Expand Down Expand Up @@ -136,7 +151,7 @@ const InformationCard = ({ producer, rank, type }) => {
// eslint-disable-next-line
}, [producer])

if(!producerOrg || !Object.keys(producerOrg)?.length) return <></>
if (!producerOrg || !Object.keys(producerOrg)?.length) return <></>

return (
<Card className={classes.root}>
Expand Down
21 changes: 21 additions & 0 deletions webapp/src/components/InformationCard/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,25 @@ export default (theme) => ({
marginLeft: theme.spacing(1),
},
},
emptyState: {
display: 'flex',
flexDirection: 'column',
'& span': {
width: '298px',
height: '45px',
fontSize: '20px',
fontWeight: 'bold',
fontStretch: 'normal',
fontStyle: 'normal',
lineHeight: '1.12',
letterSpacing: '-0.22px',
textAlign: 'center',
color: '#3d3d3dde'
}
},
imgError: {
width: '257.5px',
height: '160px',
objectFit: 'contain',
},
})
3 changes: 2 additions & 1 deletion webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@
"noData": "No Data",
"peer_keys": "Peer Key",
"account_key": "Account Key",
"hs_bpJson": "BP Json"
"hs_bpJson": "BP Json",
"emptyState": "This block producer does not provide any information."
},
"nodeCardComponent": {
"features": "Features",
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@
"noData": "No hay Datos",
"peer_keys": "Peer",
"account_key": "Cuenta",
"hs_bpJson": "BP Json"
"hs_bpJson": "BP Json",
"emptyState": "Este productor de bloques no proporciona ninguna información."
},
"nodeCardComponent": {
"features": "Características",
Expand Down

0 comments on commit 7852d84

Please sign in to comment.