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() {
const { displayedData } = this.state
const { sports, stats, t } = this.props
const { sports, stats, t, withElevation } = this.props
if (Object.keys(stats).length === 0) {
return t('common:No workouts.')
}
@ -53,24 +53,28 @@ export default class StatsCharts extends React.PureComponent {
/>
{t('statistics:duration')}
</label>
<label className="radioLabel col">
<input
type="radio"
name="ascent"
checked={displayedData === 'ascent'}
onChange={e => this.handleRadioChange(e)}
/>
{t('statistics:ascent')}
</label>
<label className="radioLabel col">
<input
type="radio"
name="descent"
checked={displayedData === 'descent'}
onChange={e => this.handleRadioChange(e)}
/>
{t('statistics:descent')}
</label>
{withElevation && (
<>
<label className="radioLabel col">
<input
type="radio"
name="ascent"
checked={displayedData === 'ascent'}
onChange={e => this.handleRadioChange(e)}
/>
{t('statistics:ascent')}
</label>
<label className="radioLabel col">
<input
type="radio"
name="descent"
checked={displayedData === 'descent'}
onChange={e => this.handleRadioChange(e)}
/>
{t('statistics:descent')}
</label>
</>
)}
<label className="radioLabel col">
<input
type="radio"

View File

@ -40,6 +40,7 @@ class Statistics extends React.PureComponent {
displayEmpty,
t,
user,
withElevation,
} = this.props
if (!displayEmpty && Object.keys(statistics).length === 0) {
return <span>{t('common:No workouts.')}</span>
@ -51,7 +52,14 @@ class Statistics extends React.PureComponent {
displayedSports,
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-header">{t('dashboard:This month')}</div>
<div className="card-body">
<Stats displayEmpty={false} statsParams={this.state} t={t} />
<Stats
displayEmpty={false}
statsParams={this.state}
t={t}
withElevation={false}
/>
</div>
</div>
)

View File

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