From ae556bbb81c9d72dc22c3ba6c5a76dd31f94a566 Mon Sep 17 00:00:00 2001 From: Teto Gomez Date: Mon, 3 May 2021 11:16:54 -0600 Subject: [PATCH] fix(FE): use correct card title (#444) --- .../src/components/InformationCard/index.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/webapp/src/components/InformationCard/index.js b/webapp/src/components/InformationCard/index.js index fc7af5d0..713af120 100644 --- a/webapp/src/components/InformationCard/index.js +++ b/webapp/src/components/InformationCard/index.js @@ -1,3 +1,4 @@ +/* eslint camelcase: 0 */ import React, { memo, useState, useEffect } from 'react' import PropTypes from 'prop-types' import { makeStyles, useTheme } from '@material-ui/core/styles' @@ -17,7 +18,7 @@ import moment from 'moment' import 'flag-icon-css/css/flag-icon.min.css' import { onImgError } from '../../utils' -import { generalConfig } from '../../config' +import { generalConfig, eosConfig } from '../../config' import CountryFlag from '../CountryFlag' import ProducerSocialLinks from '../ProducerSocialLinks' import ProducerHealthIndicators from '../ProducerHealthIndicators' @@ -30,24 +31,31 @@ const InformationCard = ({ producer, rank, onNodeClick }) => { const classes = useStyles() const theme = useTheme() const { t } = useTranslation('producerCardComponent') - const matches = useMediaQuery(theme.breakpoints.up('lg')) const [expanded, setExpanded] = useState(false) const [producerOrg, setProducerOrg] = useState({}) const [producerNodes, setProducerNodes] = useState([]) + const [cardTitle, setCardTitle] = useState(null) const handleExpandClick = () => { setExpanded(!expanded) } useEffect(() => { + if (producer.bp_json?.org) { + if (eosConfig.networkName === 'lacchain') { + setCardTitle(`${t(`entityType${producer.bp_json.type}`)} Entity`) + } else { + setCardTitle(rank ? `Rank #${rank} -Top` : 'No Rank') + } + } setProducerOrg(producer.bp_json?.org || {}) setProducerNodes(producer.bp_json?.nodes || []) }, [producer]) return ( - + { Stats - Votes: N/A - Rewards: 0 eos + {eosConfig.networkName !== 'lacchain' && ( + <> + Votes: N/A + Rewards: 0 eos + + )} Last Checked: {` ${moment(new Date()).diff( @@ -166,7 +178,7 @@ const InformationCard = ({ producer, rank, onNodeClick }) => { - Health Social + Health