diff --git a/hapi/src/services/eosio.service.js b/hapi/src/services/eosio.service.js index 3ce5e48a..c7699745 100644 --- a/hapi/src/services/eosio.service.js +++ b/hapi/src/services/eosio.service.js @@ -233,15 +233,15 @@ const getChains = async producerUrl => { } const getProducerHealthStatus = bpJson => { + if (!bpJson || !Object.keys(bpJson).length) return [] + const healthStatus = [] healthStatus.push({ name: 'bpJson', - valid: !!bpJson && !!Object.keys(bpJson).length + valid: true }) - if (!healthStatus[0].valid) return healthStatus - healthStatus.push({ name: 'organization_name', valid: !!bpJson.org?.candidate_name diff --git a/hapi/src/services/producer.service.js b/hapi/src/services/producer.service.js index af8f5dcf..801f6c79 100644 --- a/hapi/src/services/producer.service.js +++ b/hapi/src/services/producer.service.js @@ -9,7 +9,7 @@ const statsService = require('./stats.service') const updateBPJSONs = async (producers = []) => { const upsertMutation = ` mutation ($producers: [producer_insert_input!]!) { - insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ bp_json ]}) { + insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ bp_json, health_status ]}) { affected_rows, } } @@ -21,7 +21,7 @@ const updateBPJSONs = async (producers = []) => { const updateProducers = async (producers = []) => { const upsertMutation = ` mutation ($producers: [producer_insert_input!]!) { - insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ producer_key, unpaid_blocks,last_claim_time, url, location, producer_authority, is_active, total_votes, total_votes_percent, total_votes_eos, vote_rewards,block_rewards, total_rewards, health_status, endpoints, rank]}) { + insert_producer(objects: $producers, on_conflict: {constraint: producer_owner_key, update_columns: [ producer_key, unpaid_blocks,last_claim_time, url, location, producer_authority, is_active, total_votes, total_votes_percent, total_votes_eos, vote_rewards,block_rewards, total_rewards, endpoints, rank]}) { affected_rows, returning { id, diff --git a/webapp/public/empty-states/Error.webp b/webapp/public/empty-states/Error.webp new file mode 100644 index 00000000..1c08de7c Binary files /dev/null and b/webapp/public/empty-states/Error.webp differ diff --git a/webapp/src/components/InformationCard/EmptyState.js b/webapp/src/components/InformationCard/EmptyState.js new file mode 100644 index 00000000..a87198f5 --- /dev/null +++ b/webapp/src/components/InformationCard/EmptyState.js @@ -0,0 +1,30 @@ +import React, { memo } from 'react' +import PropTypes from 'prop-types' + +const EmptyState = ({ classes, t }) => { + return ( +
+
+
+ + {t('emptyState')} +
+
+ ) +} + +EmptyState.propTypes = { + classes: PropTypes.object, + t: PropTypes.func, +} + +EmptyState.defaultProps = { + classes: {}, +} + +export default memo(EmptyState) diff --git a/webapp/src/components/InformationCard/index.js b/webapp/src/components/InformationCard/index.js index 6fa713de..e295db04 100644 --- a/webapp/src/components/InformationCard/index.js +++ b/webapp/src/components/InformationCard/index.js @@ -19,6 +19,7 @@ import { eosConfig } from '../../config' import ProducerHealthIndicators from '../ProducerHealthIndicators' import NodesCard from '../NodeCard/NodesCard' +import EmptyState from './EmptyState' import ProducerInformation from './ProducerInformation' import Nodes from './Nodes' import Social from './Social' @@ -59,6 +60,9 @@ const InformationCard = ({ producer, rank, type }) => { } const BlockProducerInfo = () => { + if (producerOrg.healthStatus?.length <= 1) + return + return (
@@ -136,7 +140,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 ( diff --git a/webapp/src/components/InformationCard/styles.js b/webapp/src/components/InformationCard/styles.js index 507d84ba..c14446e2 100644 --- a/webapp/src/components/InformationCard/styles.js +++ b/webapp/src/components/InformationCard/styles.js @@ -34,7 +34,7 @@ export default (theme) => ({ flexDirection: 'row', '& .bodyWrapper': { flexDirection: 'row', - justifyContent: 'space-evenly', + justifyContent: 'space-between', width: '100%', }, '& .MuiTypography-overline': { @@ -75,8 +75,8 @@ export default (theme) => ({ }, [theme.breakpoints.up('lg')]: { padding: theme.spacing(0, 6), - width: 300, - maxWidth: 300, + width: 250, + minWidth: 250, justifyContent: 'center', }, }, @@ -323,4 +323,45 @@ export default (theme) => ({ marginLeft: theme.spacing(1), }, }, + centerWrapper: { + width: '100%', + display: 'flex', + justifyContent: 'center', + }, + emptyState: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + '& span': { + width: '16em', + height: '45px', + fontSize: '1.2em', + fontWeight: 'bold', + fontStretch: 'normal', + fontStyle: 'normal', + lineHeight: '1.12', + letterSpacing: '-0.22px', + textAlign: 'center', + color: '#3d3d3dde', + }, + }, + horizontalLine: { + [theme.breakpoints.down('lg')]: { + width: '270px', + height: '1px', + margin: '15.2px 32px 40px 33px', + backgroundColor: '#e0e0e0', + }, + }, + imgError: { + [theme.breakpoints.down('lg')]: { + width: '200px', + height: '120px', + }, + [theme.breakpoints.up('lg')]: { + width: '260px', + height: '160px', + }, + objectFit: 'contain', + }, }) diff --git a/webapp/src/language/en.json b/webapp/src/language/en.json index ec14491e..3a9a09c3 100644 --- a/webapp/src/language/en.json +++ b/webapp/src/language/en.json @@ -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", diff --git a/webapp/src/language/es.json b/webapp/src/language/es.json index 58e31667..40cab434 100644 --- a/webapp/src/language/es.json +++ b/webapp/src/language/es.json @@ -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", diff --git a/webapp/src/routes/BlockProducers/styles.js b/webapp/src/routes/BlockProducers/styles.js index 3d66cc7f..5227cac6 100644 --- a/webapp/src/routes/BlockProducers/styles.js +++ b/webapp/src/routes/BlockProducers/styles.js @@ -9,7 +9,6 @@ export default (theme) => ({ display: 'flex', [theme.breakpoints.up('sm')]: { justifyContent: 'center', - flex: 'content', }, [theme.breakpoints.down('sm')]: { flex: 'auto',