Client - display elevation only on Statistics (not in dashboard)

This commit is contained in:
Sam 2021-09-01 13:31:43 +02:00
parent 8dc7e37ab1
commit d0b305ec6f
4 changed files with 39 additions and 21 deletions

View File

@ -28,7 +28,7 @@ export default class StatsCharts extends React.PureComponent {
render() { render() {
const { displayedData } = this.state const { displayedData } = this.state
const { sports, stats, t } = this.props const { sports, stats, t, withElevation } = this.props
if (Object.keys(stats).length === 0) { if (Object.keys(stats).length === 0) {
return t('common:No workouts.') return t('common:No workouts.')
} }
@ -53,6 +53,8 @@ export default class StatsCharts extends React.PureComponent {
/> />
{t('statistics:duration')} {t('statistics:duration')}
</label> </label>
{withElevation && (
<>
<label className="radioLabel col"> <label className="radioLabel col">
<input <input
type="radio" type="radio"
@ -71,6 +73,8 @@ export default class StatsCharts extends React.PureComponent {
/> />
{t('statistics:descent')} {t('statistics:descent')}
</label> </label>
</>
)}
<label className="radioLabel col"> <label className="radioLabel col">
<input <input
type="radio" type="radio"

View File

@ -40,6 +40,7 @@ class Statistics extends React.PureComponent {
displayEmpty, displayEmpty,
t, t,
user, user,
withElevation,
} = this.props } = this.props
if (!displayEmpty && Object.keys(statistics).length === 0) { if (!displayEmpty && Object.keys(statistics).length === 0) {
return <span>{t('common:No workouts.')}</span> return <span>{t('common:No workouts.')}</span>
@ -51,7 +52,14 @@ class Statistics extends React.PureComponent {
displayedSports, displayedSports,
user.weekm user.weekm
) )
return <StatsChart sports={sports} stats={stats} t={t} /> return (
<StatsChart
sports={sports}
stats={stats}
t={t}
withElevation={withElevation}
/>
)
} }
} }

View File

@ -21,7 +21,12 @@ export default class Statistics extends React.Component {
<div className="card workout-card"> <div className="card workout-card">
<div className="card-header">{t('dashboard:This month')}</div> <div className="card-header">{t('dashboard:This month')}</div>
<div className="card-body"> <div className="card-body">
<Stats displayEmpty={false} statsParams={this.state} t={t} /> <Stats
displayEmpty={false}
statsParams={this.state}
t={t}
withElevation={false}
/>
</div> </div>
</div> </div>
) )

View File

@ -175,6 +175,7 @@ class Statistics extends React.Component {
displayedSports={displayedSports} displayedSports={displayedSports}
statsParams={statsParams} statsParams={statsParams}
t={t} t={t}
withElevation
/> />
<div className="row chart-workouts"> <div className="row chart-workouts">
{translatedSports.map(sport => ( {translatedSports.map(sport => (