Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier506 committed Sep 8, 2021
2 parents c53a11e + 5c4528e commit 45a62ff
Show file tree
Hide file tree
Showing 7 changed files with 321 additions and 266 deletions.
12 changes: 11 additions & 1 deletion hapi/src/libs/sync-bp-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ const updateBpStatsEden = async (bpName, stat) => {
dbResult ? 'SUCCESSFULL' : 'UNSUCCESSFULL'
}`
)
return { bp: dbResult.bp, average: dbResult.average, ratings_cntr: dbResult.ratings_cntr }

return {
bp: dbResult.bp,
average: dbResult.average,
ratings_cntr: dbResult.ratings_cntr,
transparency: dbResult.transparency,
infrastructure: dbResult.infrastructure,
trustiness: dbResult.trustiness,
community: dbResult.community,
development: dbResult.development
}
} catch (error) {
console.log('Error:', error)
}
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@
"communityTooltip": "Community value creation through education, events, and other useful content.",
"development": "Development",
"developmentTooltip": "Technical know-how and usage of open-source software, scripts, frameworks, wallets, voting portals, metrics, etc.",
"globalRate": "Average Rating",
"globalRate": "General Rating",
"myRate": "My Rating",
"edenRates": "Eden Rating",
"rateWithoutLogin": "You need to login to rate this block producer",
"noBlockProducer": "This BP Does Not Exist.",
"success" : "Success!",
Expand All @@ -201,7 +202,6 @@
"generalInformation": "General Information",
"eosRates": "General Rating",
"edenRates": "Eden Rating",
"totalRates": "Total Rating",
"rankings": "Rankings",
"social": "Social",
"account": "Account",
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@
"communityTooltip": "Creación de valor comunitario a través de la educación, eventos y/o otros contenidos útiles.",
"development": "Desarrollo",
"developmentTooltip": "Conocimientos técnicos y uso de software de código abierto, scripts, marcos, billeteras, portales de votación, métricas, etc.",
"globalRate": "Evaluación Promedio",
"globalRate": "Evaluación General",
"myRate": "Mi Evaluación",
"edenRates": "Evaluación Eden",
"rateWithoutLogin": "Necesitas iniciar sesión para evaluar un productor de bloques",
"noBlockProducer": "No encontramos este PB",
"success": "¡Éxito!",
Expand All @@ -201,7 +202,6 @@
"generalInformation": "Información General",
"eosRates": "Calificación General",
"edenRates": "Calificación Eden",
"totalRates": "Calificación Total",
"rankings": "Clasificaciones",
"social": "Social",
"account": "Cuenta",
Expand Down
5 changes: 5 additions & 0 deletions webapp/src/models/BlockProducer/query_get_eden_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const QUERY_EDEN_RATING = gql`
bp
average
ratings_cntr
infrastructure
transparency
trustiness
development
community
}
}
`
Expand Down
40 changes: 38 additions & 2 deletions webapp/src/routes/block-producers/block-producer-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import AccountCircle from '@material-ui/icons/AccountCircle'
import { Box, useMediaQuery } from '@material-ui/core'
import _get from 'lodash.get'

import getBPRadarData from 'utils/getBPRadarData'
import TitlePage from 'components/title-page'
import Radar from 'components/radar'

Expand Down Expand Up @@ -73,13 +74,39 @@ const BlockProducerProfile = ({ account, ...props }) => {
)
const bPLogo =
bpHasInformation && _get(producer, 'bpjson.org.branding.logo_256', null)

const BlockProducerTitle = _get(
producer,
'bpjson.org.candidate_name',
_get(producer, 'system.owner', 'No Data')
)

const webInfo = _get(producer, 'general_info', null)

const getRatingData = () => {
if (edenRate) {
return {
community: edenRate.community,
development: edenRate.development,
infrastructure: edenRate.development,
transparency: edenRate.transparency,
trustiness: edenRate.trustiness
}
}
return {
community: 0,
development: 0,
infrastructure: 0,
transparency: 0,
trustiness: 0
}
}

const userDataSet = getBPRadarData({
name: t('edenRates'),
parameters: getRatingData()
})

useEffect(() => {
setSizes(isDesktop ? 400 : '100%')
}, [isDesktop])
Expand All @@ -104,8 +131,14 @@ const BlockProducerProfile = ({ account, ...props }) => {
<Grid container justify='center' className={classes.container}>
<TitlePage title={`${t('title')} ${BlockProducerTitle} - EOS Rate`} />
<Grid item md={12} xs={12}>
<Grid container direction='row' alignItems='center'>
<Grid
container
direction='row'
alignItems='center'
className={classes.breadcrumbText}
>
<Button
className={classes.backButtonStyle}
// eslint-disable-next-line react/display-name
component={forwardRef((props, ref) => (
<Link {...props} ref={ref} to='/block-producers' />
Expand Down Expand Up @@ -155,8 +188,11 @@ const BlockProducerProfile = ({ account, ...props }) => {
<Radar
height={sizes}
width={sizes}
showLabel
bpData={{
datasets: producer ? [{ ...producer.data }] : []
datasets: producer
? [{ ...producer.data, label: t('eosRates') }, userDataSet]
: []
}}
/>
</Grid>
Expand Down
Loading

0 comments on commit 45a62ff

Please sign in to comment.