Client - use user sports colors in charts
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
v-for="sport in translatedSports"
|
||||
type="checkbox"
|
||||
:key="sport.id"
|
||||
:style="{ color: sportColors[sport.label] }"
|
||||
:style="{ color: sport.color ? sport.color : sportColors[sport.label] }"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
|
@ -18,7 +18,10 @@ export const sportColors: Record<string, string> = {
|
||||
|
||||
export const sportIdColors = (sports: ISport[]): Record<number, string> => {
|
||||
const colors: Record<number, string> = {}
|
||||
sports.map((sport) => (colors[sport.id] = sportColors[sport.label]))
|
||||
sports.map(
|
||||
(sport) =>
|
||||
(colors[sport.id] = sport.color ? sport.color : sportColors[sport.label])
|
||||
)
|
||||
return colors
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ export const getDatasets = (displayedSports: ISport[]): TStatisticsDatasets => {
|
||||
total_descent: [],
|
||||
}
|
||||
displayedSports.map((sport) => {
|
||||
const color = sportColors[sport.label]
|
||||
const color = sport.color ? sport.color : sportColors[sport.label]
|
||||
datasets.nb_workouts.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_distance.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_duration.push(getStatisticsChartDataset(sport.label, color))
|
||||
|
Reference in New Issue
Block a user