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 13, 2021
2 parents 7cc3574 + 1773cf6 commit 93734f3
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 193 deletions.
Binary file modified webapp/public/eoscostarica-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
193 changes: 8 additions & 185 deletions webapp/public/eoscostarica-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions webapp/src/components/card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const CardData = ({
average,
rate,
showOptions,
isNewRate,
...props
}) => {
const { t } = useTranslation('translations')
Expand Down Expand Up @@ -185,7 +186,7 @@ const CardData = ({
variant='contained'
size='small'
>
{t('rate')}
{isNewRate ? t('updateRatingButton') : t('rate')}
</Button>
</>
)}
Expand Down Expand Up @@ -218,7 +219,8 @@ CardData.propTypes = {
pathLink: PropTypes.string,
average: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
rate: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
showOptions: PropTypes.bool
showOptions: PropTypes.bool,
isNewRate: PropTypes.bool
}

CardData.defaultProps = {
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"loadMore": "Load more",
"view": "MORE",
"rate": "RATE",
"updateRatingButton": "UPDATE RATING",
"remove": "Remove vote",
"addToVote": "Add to vote",
"selected": "Selected",
Expand Down Expand Up @@ -214,6 +215,7 @@
"average": "Average",
"websiteInfo": "From Their Website",
"buttonRate": "Rate this BP",
"updateRatingButton": "Update Rating",
"buttonVote": "Vote for this Proxy",
"allBP": "All Block Producers",
"allP": "All Proxies",
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"loadMore": "Cargar más",
"view": "MÁS",
"rate": "CALIFICAR",
"updateRatingButton": "ACTUALIZAR CALIFICACIÓN",
"remove": "Remover",
"addToVote": "Agregar para votar",
"selected": "Seleccionado",
Expand Down Expand Up @@ -173,7 +174,7 @@
"rateText": "Si cree que no tiene suficiente conocimiento sobre una categoría específica, puede deshabilitarla.",
"helpText": "Publique su calificación iniciando sesión con tu billetera favorita.",
"publishRatingButton": "Publicar Calificación",
"updateRatingButton": "Actualizar calificación",
"updateRatingButton": "Actualizar Calificación",
"cancelRatingButton": "Cancelar",
"transparency": "Transparencia",
"transparencyTooltip": "Cumplimiento de la divulgación de la información.",
Expand Down Expand Up @@ -214,6 +215,7 @@
"average": "Promedio",
"websiteInfo": "De su sitio web",
"buttonRate": "Evalúa este PB",
"updateRatingButton": "Actualizar Calificación",
"buttonVote": "Vota por este Proxy",
"allBP": "Lista de productores de bloques",
"allP": "Lista de Proxies",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/language/kr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

21 changes: 17 additions & 4 deletions webapp/src/routes/block-producers/block-producer-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,20 @@ const ProfileTitle = ({
)
}

const BlockProducerProfile = ({ account, ...props }) => {
const BlockProducerProfile = ({ account, ual, ...props }) => {
const { t } = useTranslation('profile')
const classes = useStyles()
const dispatch = useDispatch()
const isDesktop = useMediaQuery('(min-width:767px)')
const isMobile = useMediaQuery('(max-width:768px)')
const accountName = _get(ual, 'activeUser.accountName', null)
const [sizes, setSizes] = useState()
const [isNewRate, setIsNewRate] = useState(true)
const {
list: blockProducers,
producer,
edenRate
edenRate,
userRate
} = useSelector((state) => state.blockProducers)
const { isContentLoading } = useSelector((state) => state.isLoading)
const bpHasInformation = Boolean(
Expand Down Expand Up @@ -118,6 +121,10 @@ const BlockProducerProfile = ({ account, ...props }) => {
dispatch.blockProducers.getBlockProducerEdenRating({
bp: account
})
dispatch.blockProducers.getBlockProducerRatingByOwner({
bp: account,
userAccount: accountName
})
}

getData()
Expand All @@ -127,6 +134,11 @@ const BlockProducerProfile = ({ account, ...props }) => {
dispatch.blockProducers.setShowSortSelected(false)
}, [])

useEffect(() => {
if (userRate) setIsNewRate(false)
else setIsNewRate(true)
}, [userRate])

return (
<Grid container justify='center' className={classes.container}>
<TitlePage title={`${t('title')} ${BlockProducerTitle} - EOS Rate`} />
Expand Down Expand Up @@ -213,7 +225,7 @@ const BlockProducerProfile = ({ account, ...props }) => {
))}
className={classes.btnBP}
>
{t('buttonRate')}
{isNewRate ? t('buttonRate') : t('updateRatingButton')}
</Button>
</Grid>
</Grid>
Expand Down Expand Up @@ -244,7 +256,8 @@ const BlockProducerProfile = ({ account, ...props }) => {
}

BlockProducerProfile.propTypes = {
account: PropTypes.string
account: PropTypes.string,
ual: PropTypes.object
}

ProfileTitle.propTypes = {
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/routes/block-producers/block-producer-rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ const BlockProducerRate = ({ account, ual }) => {
processing: false,
txSuccess: true
})

setTimeout(handleSetLastTransactionId, 4000)
} catch (err) {
setRatingState({
...ratingState,
Expand Down Expand Up @@ -318,7 +320,7 @@ const BlockProducerRate = ({ account, ual }) => {
{t('allBPs')}
</Button>
<Button
className={classes.backButtonStyle}
style={{ marginLeft: !isDesktop ? 16 : 0, padding: '6px 16px' }}
component={forwardRef((props, ref) => (
<Link
{...props}
Expand Down
12 changes: 12 additions & 0 deletions webapp/src/routes/block-producers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ const AllBps = ({ ual }) => {
})
}

const handleSetIsNewRate = (owner) => {
if (user) {
for (const userRate of user.userRates) {
if (userRate.owner === owner) {
return true
}
}
return false
}
}

const sendVoteBps = async (BPs) => {
if (!accountName) return

Expand Down Expand Up @@ -231,6 +242,7 @@ const AllBps = ({ ual }) => {
pathLink='block-producers'
average={getAverageValue(_get(blockProducer, 'average', 0))}
rate={_get(blockProducer, 'ratings_cntr', 0)}
isNewRate={handleSetIsNewRate(blockProducer.owner)}
/>
</Grid>
))}
Expand Down

0 comments on commit 93734f3

Please sign in to comment.