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 15, 2021
2 parents 918740e + 1a02aa1 commit 4ea6cfe
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-master-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
BRANCH: production
NAMESPACE: mainnet-eosrate
# webapp
REACT_APP_VERSION: ${{ github.ref }}
REACT_APP_RATING_CONTRACT: rateproducer
REACT_APP_MAINNET_VERSION: true
REACT_APP_EDEN_CONTRACT: genesis.eden
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-staging-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
BRANCH: staging
NAMESPACE: jungle-eosrate
# webapp
REACT_APP_VERSION: ${{ github.ref }}
REACT_APP_RATING_CONTRACT: rateproducer
REACT_APP_MAINNET_VERSION: false
REACT_APP_EDEN_CONTRACT: genesisdeden
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ services:
- postgres
restart: always
environment:
REACT_APP_VERSION: "${REACT_APP_VERSION}"
REACT_APP_RATING_CONTRACT: "${REACT_APP_RATING_CONTRACT}"
REACT_APP_MAINNET_VERSION: "${REACT_APP_MAINNET_VERSION}"
REACT_APP_EDEN_CONTRACT: "${REACT_APP_EDEN_CONTRACT}"
Expand Down
2 changes: 2 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:12-slim as builder

ARG REACT_APP_VERSION
ARG REACT_APP_MAINNET_VERSION
ARG REACT_APP_RATING_CONTRACT
ARG REACT_APP_EDEN_CONTRACT
Expand All @@ -13,6 +14,7 @@ ARG REACT_APP_EOS_CHAIN_ID
ARG REACT_APP_BLOCK_EXPLORER
ARG REACT_APP_NETWORK_MONITOR_URL

ENV REACT_APP_VERSION $REACT_APP_VERSION
ENV REACT_APP_MAINNET_VERSION $REACT_APP_MAINNET_VERSION
ENV REACT_APP_RATING_CONTRACT $REACT_APP_RATING_CONTRACT
ENV REACT_APP_EDEN_CONTRACT $REACT_APP_EDEN_CONTRACT
Expand Down
1 change: 1 addition & 0 deletions webapp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ build-docker: ./Dockerfile
@docker build \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_WEBAPP):$(VERSION) --target server \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_WEBAPP):$(LATEST_TAG) --target server \
--build-arg REACT_APP_VERSION="$(REACT_APP_VERSION)" \
--build-arg REACT_APP_RATING_CONTRACT="$(REACT_APP_RATING_CONTRACT)" \
--build-arg REACT_APP_MAINNET_VERSION="$(REACT_APP_MAINNET_VERSION)" \
--build-arg REACT_APP_EDEN_CONTRACT="$(REACT_APP_EDEN_CONTRACT)" \
Expand Down
1 change: 0 additions & 1 deletion webapp/src/components/card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ CardData.propTypes = {

CardData.defaultProps = {
useRateButton: true,
buttonLabel: 'ADD TO VOTE',
average: '0',
rate: '0',
showOptions: true
Expand Down
5 changes: 4 additions & 1 deletion webapp/src/components/language-select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const LanguageSelect = ({ style, alt }) => {

const handleClose = (item) => {
setAnchorEl(null)
if (typeof item === 'string') i18n.changeLanguage(item)
if (typeof item === 'string') {
localStorage.setItem('LANGUAGE', item)
i18n.changeLanguage(item)
}
}

const languages = [
Expand Down
27 changes: 23 additions & 4 deletions webapp/src/components/main-drawer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import ListItem from '@material-ui/core/ListItem'
import ListItemText from '@material-ui/core/ListItemText'
import Link from '@material-ui/core/Link'
import { useTranslation } from 'react-i18next'
import { appVersion } from '../../config'
import classnames from 'classnames'
import LaunchIcon from '@material-ui/icons/Launch'

import routes from 'routes'

Expand All @@ -33,7 +35,9 @@ const Menu = ({ onClick, currentPathname, links, sortBy, setSortBy }) => {

return (
<Fragment key={`link-${to}`}>
{label === 'About' && <Divider className={classes.divider} />}
{(label === 'About' || label.includes('Versi')) && (
<Divider className={classes.divider} />
)}
<Link
href={to}
className={classes.link}
Expand All @@ -49,7 +53,16 @@ const Menu = ({ onClick, currentPathname, links, sortBy, setSortBy }) => {
selected={isSelected}
className={classnames({ [classes.linkSelected]: isSelected })}
>
<ListItemText primary={label} />
{!label.includes('Versi') && <ListItemText primary={label} />}
{label.includes('Versi') && (
<>
<ListItemText
primary={label}
style={{ display: 'contents' }}
/>
<LaunchIcon className={classes.iconLink} />
</>
)}
</ListItem>
</Link>
{collapsedItems && !!collapsedItems.length && (
Expand Down Expand Up @@ -119,7 +132,10 @@ const MainDrawer = ({
currentPathname={currentPathname}
links={routes.map((route) => ({
to: route.path,
label: t(route.drawerLabel),
label:
route.drawerLabel !== 'version'
? t(route.drawerLabel)
: `${t(route.drawerLabel)} ${appVersion}`,
collapsedItems: route.drawerComponents,
target: route.target
}))}
Expand All @@ -140,7 +156,10 @@ const MainDrawer = ({
currentPathname={currentPathname}
links={routes.map((route) => ({
to: route.path,
label: t(route.drawerLabel),
label:
route.drawerLabel !== 'version'
? t(route.drawerLabel)
: `${t(route.drawerLabel)} ${appVersion}`,
collapsedItems: route.drawerComponents,
target: route.target
}))}
Expand Down
5 changes: 5 additions & 0 deletions webapp/src/components/main-drawer/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ export default (theme) => ({
},
divider: {
marginBottom: theme.spacing(2)
},
iconLink: {
marginLeft: '10px',
width: '20px',
color: theme.palette.secondary.main
}
})
2 changes: 2 additions & 0 deletions webapp/src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const appName = 'EOSRate'
export const stage = process.env.REACT_APP_MAINNET_VERSION
export const contract = process.env.REACT_APP_RATING_CONTRACT || 'rateproducer'
export const appVersion =
process.env.REACT_APP_VERSION.split('/').pop() || '1.0.0'
export const contractEden =
process.env.REACT_APP_EDEN_CONTRACT || 'genesis.eden'
export const eosApiHost = process.env.REACT_APP_EOS_API_HOST
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ i18n
.init({
resources,
fallbackLng: 'en',
lng: localStorage.getItem('LANGUAGE') || 'en',
caches: ['localStorage', 'cookie'],
interpolation: {
escapeValue: false
}
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@

"hideComparisonTool": "Hide comparison tool",
"showComparisonTool": "Show comparison tool",
"language": "language"
"language": "language",
"version": "Version"
},

"sortInput": {
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@

"hideComparisonTool": "Ocultar herramienta de comparación",
"showComparisonTool": "Mostrar herramienta de comparación",
"language": "Idioma"
"language": "Idioma",
"version": "Versión"
},

"sortInput": {
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/language/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"loadMore": "더 보기",
"view": "추가정보",
"rate": "평가",
"updateRatingButton": "평가 내용 업데이트하기",
"remove": "투표 철회",
"addToVote": "투표대상 추가",
"selected": "선택됨",
Expand Down Expand Up @@ -215,6 +216,7 @@
"websiteInfo": "제공된 웹사이트",
"buttonRate": "선택한 BP 평가",
"buttonVote": "선택한 프록시 투표",
"updateRatingButton": "평가 내용 업데이트하기",
"allBP": "모든 BPs",
"allP": "모든 프록시",
"noBpJson": "선택한 BP의 bp.json 파일을 찾을 수 없습니다.",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/routes/block-producers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ const AllBps = ({ ual }) => {
owner={_get(blockProducer, 'owner')}
title={_get(blockProducer, 'bpjson.org.candidate_name')}
pathLink='block-producers'
buttonLabel={t('addToVote')}
average={getAverageValue(_get(blockProducer, 'average', 0))}
rate={_get(blockProducer, 'ratings_cntr', 0)}
isNewRate={handleSetIsNewRate(blockProducer.owner)}
Expand Down
5 changes: 5 additions & 0 deletions webapp/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@ export default [
Component: Help,
drawerLabel: 'drawerLinkHelp',
target: '_self'
},
{
path: 'https://github.com/eoscostarica/eos-rate/releases',
drawerLabel: 'version',
target: '_blank'
}
]
1 change: 1 addition & 0 deletions webapp/src/routes/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const Settings = ({ i18n }) => {
const lang = 'en'

i18n.changeLanguage(lang)
localStorage.setItem('LANGUAGE', lang)
dispatch.settings.setSettings({ key: value, value: lang })
} else if (value === 'notifications')
dispatch.settings.setSettings({ key: value, value: !currentValue })
Expand Down

0 comments on commit 4ea6cfe

Please sign in to comment.