Skip to content

Commit

Permalink
fix(webapp): add logic to load more (soft paginations) and fix respon…
Browse files Browse the repository at this point in the history
…sive polar graph (#816)
  • Loading branch information
tetogomez authored Oct 7, 2021
1 parent 4cbf5f5 commit dc8e83a
Show file tree
Hide file tree
Showing 19 changed files with 290 additions and 304 deletions.
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"apollo-link-ws": "^1.0.19",
"apollo-utilities": "^1.3.3",
"chart.js": "^3.5.1",
"classnames": "^2.3.1",
"core-js": "^3.15.2",
"date-fns": "^2.24.0",
"env-cmd": "^10.1.0",
Expand Down Expand Up @@ -79,6 +78,7 @@
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"serve": "^12.0.0",
"string-to-color": "^2.2.2",
"subscriptions-transport-ws": "^0.9.19",
"text-encoding": "^0.7.0",
"ual-anchor": "^1.0.6",
Expand Down
5 changes: 3 additions & 2 deletions webapp/src/components/Card/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ export default theme => ({
letterSpacing: '0.44px'
},
chartWrapper: {
width: '100%',
'& .highcharts-container ': {
height: '400px !important',
width: '350px !important',
width: '100% !important',
'& > svg': {
height: '400px !important',
width: '350px !important'
width: '100% !important'
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions webapp/src/components/CompareTool/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ export default theme => ({
overflow: 'hidden'
},
chartWrapperSliderView: {
width: '100%',
'& .highcharts-container ': {
height: '400px !important',
width: '340px !important',
width: '100% !important',
'& > svg': {
height: '400px !important',
width: '340px !important'
width: '100% !important'
}
}
},
Expand Down Expand Up @@ -306,13 +307,14 @@ export default theme => ({
alignItems: 'center'
},
chartWrapper: {
width: '100%',
'& .highcharts-container ': {
height: '300px !important',
width: '340px !important',
width: '100% !important',
'& > svg': {
marginTop: '-60px !important',
height: '400px !important',
width: '340px !important'
width: '100% !important'
}
}
},
Expand Down
10 changes: 7 additions & 3 deletions webapp/src/components/PolarChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ HighchartsMore(Highcharts)

const useStyles = makeStyles(styles)

const PolarChart = ({ data = [] }) => {
const PolarChart = ({ data = [], showLegend = false }) => {
const { t } = useTranslation('translations')
const classes = useStyles()
const [options] = useState(polarCharConfig.options)
Expand All @@ -36,15 +36,19 @@ const PolarChart = ({ data = [] }) => {
t('trustiness')
]
},
series: data
series: data,
legend: {
enabled: showLegend
}
}}
/>
</Box>
)
}

PolarChart.propTypes = {
data: PropTypes.array
data: PropTypes.array,
showLegend: PropTypes.bool
}

export default PolarChart
45 changes: 4 additions & 41 deletions webapp/src/components/PolarChart/styles.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
export default theme => ({
highchartsFigure: {
margin: '1em auto',
[theme.breakpoints.down('md')]: {
margin: '0 auto',
width: '100% !important'
},
margin: 0,
width: '100% !important',
'& .highcharts-container ': {
margin: '1em auto',
margin: 0,
[theme.breakpoints.down('md')]: {
margin: '0 auto',
margin: 0,
width: '100% !important'
}

// height: '400px !important',
// width: '350px !important',
// border: '2px dashed purple',

// '& > svg': {
// fill: '#94d31b',
// height: '400px !important',
// width: '350px !important'
// },

// [theme.breakpoints.up('sm')]: {
// border: '2px solid green',
// height: '400px !important',
// width: '600px !important',
// '& > svg': {
// fill: '#94d31b',
// height: '400px !important',
// width: '600px !important'
// }
// },
// [theme.breakpoints.up('md')]: {
// border: '2px solid blue',
// height: '400px !important',
// width: '400px !important',
// '& > svg': {
// fill: '#94d31b',
// height: '400px !important',
// width: '450px !important'
// }
// },
// [theme.breakpoints.up('lg')]: {
// border: '2px solid orange'
// }
}
}
})
6 changes: 3 additions & 3 deletions webapp/src/routes/BlockProducers/BlockProducerProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const BlockProducerProfile = () => {
</Grid>
<Grid container className={classes.reliefGrid}>
<Grid item md={12} xs={12}>
<Box style={{ display: 'flex' }}>
<Box className={classes.pageTitle}>
{blockProducerLogo ? (
<Avatar aria-label='Block Producer' className={classes.avatar}>
<img src={blockProducerLogo} alt='' width='100%' />
Expand Down Expand Up @@ -226,8 +226,8 @@ const BlockProducerProfile = () => {
</Grid>
)}
<Grid container justifyContent='center' md={6}>
<Grid item md={12} style={{ marginTop: 20 }} xs={12}>
<PolarChart data={polarChartData} />
<Grid item className={classes.profileChartWrapper} xs={12}>
<PolarChart data={polarChartData} showLegend />
</Grid>
<Grid item md={4} xs={7}>
<Button
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/routes/BlockProducers/BlockProducerRate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Typography from '@mui/material/Typography'
import AccountCircle from '@mui/icons-material/AccountCircle'
import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft'
import _get from 'lodash.get'
import classNames from 'classnames'
import clsx from 'clsx'
import Snackbar from '@mui/material/Snackbar'
import MuiAlert from '@mui/material/Alert'
import { makeStyles } from '@mui/styles'
Expand Down Expand Up @@ -404,7 +404,7 @@ const BlockProducerRate = () => {
producer={state.blockProducer}
/>
<Grid
className={classNames(classes.ctasWrapper, classes.showOnlyLg)}
className={clsx(classes.ctasWrapper, classes.showOnlyLg)}
style={{ margin: '10px 0 10px 0' }}
item
xs={12}
Expand Down
32 changes: 16 additions & 16 deletions webapp/src/routes/BlockProducers/GeneralInformationProfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import clsx from 'clsx'
import { useTranslation } from 'react-i18next'
import countries from 'i18n-iso-countries'
import Grid from '@mui/material/Grid'
Expand Down Expand Up @@ -52,7 +52,7 @@ const SocialNetworks = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={`https://github.com/${github}`}
Expand All @@ -72,7 +72,7 @@ const SocialNetworks = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={`https://twitter.com/${twitter}`}
Expand All @@ -92,7 +92,7 @@ const SocialNetworks = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={`https://www.linkedin.com/in/${linkedin}`}
Expand All @@ -112,7 +112,7 @@ const SocialNetworks = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={`https://web.telegram.org/#/${telegram}`}
Expand All @@ -132,7 +132,7 @@ const SocialNetworks = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={`https://www.instagram.com/${instagram}`}
Expand Down Expand Up @@ -169,11 +169,11 @@ const AdditionalResources = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
<a
href={additionalResources.alohaEOS}
className={classNames(classes.links, classes.noWrap)}
className={clsx(classes.links, classes.noWrap)}
target='_blank'
rel='noopener noreferrer'
>
Expand All @@ -189,12 +189,12 @@ const AdditionalResources = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
noWrap
>
<a
href={additionalResources.eosNation}
className={classNames(classes.links, classes.noWrap)}
className={clsx(classes.links, classes.noWrap)}
target='_blank'
rel='noopener noreferrer'
>
Expand All @@ -210,12 +210,12 @@ const AdditionalResources = ({ classes, producer }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
noWrap
>
<a
href={{ edenInterview }}
className={classNames(classes.links, classes.noWrap)}
className={clsx(classes.links, classes.noWrap)}
target='_blank'
rel='noopener noreferrer'
>
Expand Down Expand Up @@ -278,7 +278,7 @@ const GeneralInformation = ({ classes, producer = {} }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
{_get(producer, 'system.owner', '- -')}
</Typography>
Expand All @@ -289,7 +289,7 @@ const GeneralInformation = ({ classes, producer = {} }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
{countryName}
</Typography>
Expand All @@ -300,7 +300,7 @@ const GeneralInformation = ({ classes, producer = {} }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
{webpageURL ? (
<a
Expand All @@ -322,7 +322,7 @@ const GeneralInformation = ({ classes, producer = {} }) => {
</Typography>
<Typography
variant='subtitle1'
className={classNames(classes.value, classes.subTitle)}
className={clsx(classes.value, classes.subTitle)}
>
{formatNumber(parseFloat(totalVotes), 0)}
</Typography>
Expand Down
Loading

0 comments on commit dc8e83a

Please sign in to comment.