@@ -66,14 +73,7 @@ class DashBoard extends React.Component {
/>
))
) : (
-
-
- No workouts.{' '}
-
- Upload one !
-
-
-
+
)}
{!paginationEnd && (
({
- activities: state.activities.data,
- message: state.message,
- records: state.records.data,
- sports: state.sports.data,
- user: state.user,
- }),
- dispatch => ({
- loadActivities: () => {
- dispatch(getOrUpdateData('getData', 'activities', { page: 1 }))
- dispatch(getOrUpdateData('getData', 'records'))
- },
- loadMoreActivities: page => {
- dispatch(getMoreActivities({ page }))
- },
- })
-)(DashBoard)
+export default withTranslation()(
+ connect(
+ state => ({
+ activities: state.activities.data,
+ message: state.message,
+ records: state.records.data,
+ sports: state.sports.data,
+ user: state.user,
+ }),
+ dispatch => ({
+ loadActivities: () => {
+ dispatch(getOrUpdateData('getData', 'activities', { page: 1 }))
+ dispatch(getOrUpdateData('getData', 'records'))
+ },
+ loadMoreActivities: page => {
+ dispatch(getMoreActivities({ page }))
+ },
+ })
+ )(DashBoard)
+)
diff --git a/fittrackee_client/src/components/NavBar/index.jsx b/fittrackee_client/src/components/NavBar/index.jsx
index 6492adb2..22ff2917 100644
--- a/fittrackee_client/src/components/NavBar/index.jsx
+++ b/fittrackee_client/src/components/NavBar/index.jsx
@@ -1,6 +1,6 @@
import React from 'react'
-import { Translation } from 'react-i18next'
import { connect } from 'react-redux'
+import { withTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
import LanguageDropdown from './LanguageDropdown'
@@ -8,163 +8,161 @@ import { apiUrl } from '../../utils'
class NavBar extends React.PureComponent {
render() {
- const { id, isAuthenticated, picture, username } = this.props
+ const { id, isAuthenticated, picture, t, username } = this.props
return (
-
- {t => (
-
-
+
)
}
}
-export default connect(({ user }) => ({
- id: user.id,
- isAuthenticated: user.isAuthenticated,
- picture: user.picture,
- username: user.username,
-}))(NavBar)
+export default withTranslation()(
+ connect(({ user }) => ({
+ id: user.id,
+ isAuthenticated: user.isAuthenticated,
+ picture: user.picture,
+ username: user.username,
+ }))(NavBar)
+)
diff --git a/fittrackee_client/src/components/Statistics/index.jsx b/fittrackee_client/src/components/Statistics/index.jsx
index 2c0de9c3..0526c727 100644
--- a/fittrackee_client/src/components/Statistics/index.jsx
+++ b/fittrackee_client/src/components/Statistics/index.jsx
@@ -14,9 +14,10 @@ import {
} from 'date-fns'
import React from 'react'
import { Helmet } from 'react-helmet'
+import { withTranslation } from 'react-i18next'
import { connect } from 'react-redux'
-import { activityColors } from '../../utils/activities'
+import { activityColors, translateSports } from '../../utils/activities'
import Stats from '../Common/Stats'
const durations = ['week', 'month', 'year']
@@ -114,15 +115,16 @@ class Statistics extends React.Component {
render() {
const { displayedSports, statsParams } = this.state
- const { sports } = this.props
+ const { sports, t } = this.props
+ const translatedSports = translateSports(sports, t)
return (
<>
- FitTrackee - Statistics
+ FitTrackee - {t('statistics:Statistics')}
-
Statistics
+
{t('statistics:Statistics')}
@@ -145,7 +147,7 @@ class Statistics extends React.Component {
checked={d === statsParams.duration}
onChange={e => this.handleOnChangeDuration(e)}
/>
- {d}
+ {t(`statistics:${d}`)}
))}
@@ -164,9 +166,10 @@ class Statistics extends React.Component {
displayEmpty
displayedSports={displayedSports}
statsParams={statsParams}
+ t={t}
/>
- {sports.map(sport => (
+ {translatedSports.map(sport => (