Client - display elevation only on Statistics (not in dashboard)
This commit is contained in:
		| @@ -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" | ||||||
|   | |||||||
| @@ -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} | ||||||
|  |       /> | ||||||
|  |     ) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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> | ||||||
|     ) |     ) | ||||||
|   | |||||||
| @@ -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 => ( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user