From bbf601c186b6070776ec0c19bd683ca579307f68 Mon Sep 17 00:00:00 2001 From: Paola Espinoza <71234240+hanakoori01@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:18:43 -0600 Subject: [PATCH 1/2] fix(webapp): apply new format to card component (#977) * fix(webapp): apply new format to card component * fix(webapp): code review remove unused code --- .env.example | 24 +++++------------ webapp/src/components/Card/index.js | 41 ++++++++++++++--------------- webapp/src/routes/Home/index.js | 4 +-- webapp/src/routes/Proxies/index.js | 1 + 4 files changed, 30 insertions(+), 40 deletions(-) diff --git a/.env.example b/.env.example index ba838eaf..ec26679e 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,6 @@ #GLOBAL APP_NAME=EOS-RATE STAGE=dev - # POSTGRES POSTGRES_HOST=localhost POSTGRES_PORT=5432 @@ -10,9 +9,8 @@ POSTGRES_PASSWORD=password POSTGRES_DB=eosrate POSTGRES_SCHEMA=public POSTGRES_DATA=./db_data - # HAPI -HAPI_POSTGRES_HOST=eosrate_postgres +HAPI_POSTGRES_HOST=postgres HAPI_POSTGRES_PORT=5432 HAPI_POSTGRES_USER=user HAPI_POSTGRES_PASSWORD=password @@ -20,7 +18,7 @@ HAPI_POSTGRES_DB=eosrate HAPI_POSTGRES_SCHEMA=public HAPI_SERVER_PORT=9090 HAPI_SERVER_ADDRESS=0.0.0.0 -HAPI_EOS_API_ENDPOINT=https://jungle.edenia.cloud +HAPI_EOS_API_ENDPOINT=https://jungle3.cryptolions.io HAPI_EOS_CHAIN_ID=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 HAPI_PROXY_CONTRACT=proxyaccount HAPI_RATING_CONTRACT=rateproducer @@ -28,32 +26,24 @@ HAPI_HYPERION_API=https://jungle3history.cryptolions.io HAPI_HYPERION_START_AT=2022-03-01T00:00:00.000+00:00 HAPI_HASURA_URL=http://hasura:8080/v1/graphql HAPI_HASURA_ADMIN_SECRET=myadminsecretkey - # HASURA HASURA_GRAPHQL_DATABASE_URL=postgres://user:password@eosrate_postgres:5432/eosrate HASURA_GRAPHQL_ADMIN_SECRET=hasurasecret HASURA_GRAPHQL_UNAUTHORIZED_ROLE=anonymous HASURA_GRAPHQL_ACTION_BASE_URL=http://hapi:9090 - # WEBAPP -REACT_APP_VERSION=$npm_package_version REACT_APP_RATING_CONTRACT=rateproducer -REACT_APP_MAINNET_VERSION=true -REACT_APP_EDEN_CONTRACT=genesis.eden REACT_APP_GRAPHQL_HTTP_URL=http://localhost:8080/v1/graphql +REACT_APP_API_URL=https://jungle3.cryptolions.io REACT_APP_GRAPHQL_WS_URL=ws://localhost:8080/v1/graphql -REACT_APP_EOS_API_URL=https://jungle.edenia.cloud -REACT_APP_EOS_API_HOST=jungle.edenia.cloud +REACT_APP_EOS_API_URL=https://jungle3.cryptolions.io +REACT_APP_EOS_API_HOST=jungle3.cryptolions.io REACT_APP_EOS_API_PORT=443 REACT_APP_EOS_API_PROTOCOL=https REACT_APP_EOS_CHAIN_ID=2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840 REACT_APP_BLOCK_EXPLORER=https://jungle3.bloks.io REACT_APP_NETWORK_MONITOR_URL=https://jungle.eosio.online/ REACT_APP_VERSION=v1.4.21 -REACT_APP_MAINNET_VERSION=v1.4.21 +REACT_APP_MAINNET_VERSION= v1.4.21 REACT_APP_EDEN_CONTRACT=genesisdeden -REACT_APP_UAL_APP_NAME=EOSRate - -# CONTRACT -CONTRACT_ENDPOINT='' -CONTRACT_ACCOUNT='' \ No newline at end of file +REACT_APP_UAL_APP_NAME=EOSRate \ No newline at end of file diff --git a/webapp/src/components/Card/index.js b/webapp/src/components/Card/index.js index deb7798a..a497f6a0 100644 --- a/webapp/src/components/Card/index.js +++ b/webapp/src/components/Card/index.js @@ -55,26 +55,32 @@ const CardData = ({ rate, showOptions, isNewRate, - disable + disable, + isProxy }) => { const { t } = useTranslation('translations') const [open, setOpen] = useState(false) const classes = useStyles() const theme = useTheme() const isMobile = useMediaQuery(theme.breakpoints.only('xs')) - const handleTooltip = e => { setOpen(!open) e.preventDefault() } - const formatRadarData = rateData => [ - parseFloat(formatNumber(rateData?.community || 0, 1)), - parseFloat(formatNumber(rateData?.development || 0, 1)), - parseFloat(formatNumber(rateData?.development || 0, 1)), - parseFloat(formatNumber(rateData?.transparency || 0, 1)), - parseFloat(formatNumber(rateData?.trustiness || 0, 1)) - ] + const formatRadarData = info => { + if (isProxy) return info.data + + return { + ...info.data, + data: [ + parseFloat(formatNumber(info.total_community || 0, 1)), + parseFloat(formatNumber(info.total_development || 0, 1)), + parseFloat(formatNumber(info.total_transparency || 0, 1)), + parseFloat(formatNumber(info.total_trustiness || 0, 1)) + ] + } + } return ( @@ -135,16 +141,7 @@ const CardData = ({ @@ -245,14 +242,16 @@ CardData.propTypes = { rate: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), showOptions: PropTypes.bool, isNewRate: PropTypes.bool, - disable: PropTypes.bool + disable: PropTypes.bool, + isProxy: PropTypes.bool } CardData.defaultProps = { useRateButton: true, average: '0', rate: '0', - showOptions: true + showOptions: true, + isProxy: false } TooltipWrapper.propTypes = { diff --git a/webapp/src/routes/Home/index.js b/webapp/src/routes/Home/index.js index 2ff22624..e1824789 100644 --- a/webapp/src/routes/Home/index.js +++ b/webapp/src/routes/Home/index.js @@ -103,9 +103,9 @@ const Home = () => { pathLink='block-producers' buttonLabel={t('addToVote')} average={getAverageValue( - _get(blockProducer, 'totalStats.average', 0) + _get(blockProducer, 'total_average', 0) )} - rate={_get(blockProducer, 'totalStats.ratings_cntr', 0)} + rate={_get(blockProducer, 'ratings_cntr', 0)} isNewRate={ state.user && state.user.userData.userRates.some( diff --git a/webapp/src/routes/Proxies/index.js b/webapp/src/routes/Proxies/index.js index 736bc87c..30edb07f 100644 --- a/webapp/src/routes/Proxies/index.js +++ b/webapp/src/routes/Proxies/index.js @@ -176,6 +176,7 @@ const AllProxies = ({ ual = {} }) => { useRateButton={false} pathLink='proxies' showOptions={false} + isProxy /> ))} From 432c9b3f8a3d5d8a4159af702712253f18ef1063 Mon Sep 17 00:00:00 2001 From: Paola Espinoza <71234240+hanakoori01@users.noreply.github.com> Date: Wed, 14 Sep 2022 09:19:57 -0600 Subject: [PATCH 2/2] fix(webapp): add missing data in card component (#981) --- webapp/src/components/Card/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/src/components/Card/index.js b/webapp/src/components/Card/index.js index a497f6a0..d1dbf04f 100644 --- a/webapp/src/components/Card/index.js +++ b/webapp/src/components/Card/index.js @@ -77,6 +77,7 @@ const CardData = ({ parseFloat(formatNumber(info.total_community || 0, 1)), parseFloat(formatNumber(info.total_development || 0, 1)), parseFloat(formatNumber(info.total_transparency || 0, 1)), + parseFloat(formatNumber(info.total_infrastructure || 0, 1)), parseFloat(formatNumber(info.total_trustiness || 0, 1)) ] }