Client - use user sports colors in charts

This commit is contained in:
Sam 2021-11-12 18:55:15 +01:00
parent 7c49fd31ad
commit a6566c133c
15 changed files with 36 additions and 33 deletions

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.dc8b6d66.css" rel="prefetch"><link href="/static/css/main.411e7bd3.css" rel="prefetch"><link href="/static/css/main~workouts.c8c5694b.css" rel="prefetch"><link href="/static/css/profile.314b1d45.css" rel="prefetch"><link href="/static/css/reset.a71577d5.css" rel="prefetch"><link href="/static/css/workouts.773dfff0.css" rel="prefetch"><link href="/static/js/admin.2f1d393d.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.88fa3c28.js" rel="prefetch"><link href="/static/js/main~workouts.a74990d7.js" rel="prefetch"><link href="/static/js/profile.62578012.js" rel="prefetch"><link href="/static/js/reset.518e646f.js" rel="prefetch"><link href="/static/js/workouts.46dd8fa5.js" rel="prefetch"><link href="/static/css/app.97115085.css" rel="preload" as="style"><link href="/static/js/app.38e0c4d5.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.71654064.js" rel="preload" as="script"><link href="/static/css/app.97115085.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.71654064.js"></script><script src="/static/js/app.38e0c4d5.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.dc8b6d66.css" rel="prefetch"><link href="/static/css/main.411e7bd3.css" rel="prefetch"><link href="/static/css/main~workouts.c8c5694b.css" rel="prefetch"><link href="/static/css/profile.314b1d45.css" rel="prefetch"><link href="/static/css/reset.a71577d5.css" rel="prefetch"><link href="/static/css/workouts.773dfff0.css" rel="prefetch"><link href="/static/js/admin.2f1d393d.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.db9cee98.js" rel="prefetch"><link href="/static/js/main~workouts.a74990d7.js" rel="prefetch"><link href="/static/js/profile.62578012.js" rel="prefetch"><link href="/static/js/reset.518e646f.js" rel="prefetch"><link href="/static/js/workouts.46dd8fa5.js" rel="prefetch"><link href="/static/css/app.97115085.css" rel="preload" as="style"><link href="/static/js/app.42f9a78d.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.71654064.js" rel="preload" as="script"><link href="/static/css/app.97115085.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.71654064.js"></script><script src="/static/js/app.42f9a78d.js"></script></body></html>

View File

@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/img/workouts/mountains.svg"
},
{
"revision": "59c5cdf1d1708e7f936a0a30db0bbffb",
"revision": "79a6d6ba640460be2a46e87bcae39d40",
"url": "/index.html"
},
{
@ -80,7 +80,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/admin.dc8b6d66.css"
},
{
"revision": "9ae7710525db019efc86",
"revision": "222cb301523535983aa1",
"url": "/static/css/app.97115085.css"
},
{
@ -92,7 +92,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/leaflet.css"
},
{
"revision": "12cfbc42bf674769c6f0",
"revision": "be5a37c7e9ea6bfcb8d7",
"url": "/static/css/main.411e7bd3.css"
},
{
@ -196,8 +196,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/admin.2f1d393d.js"
},
{
"revision": "9ae7710525db019efc86",
"url": "/static/js/app.38e0c4d5.js"
"revision": "222cb301523535983aa1",
"url": "/static/js/app.42f9a78d.js"
},
{
"revision": "bd7d183c9f68e5f4027d",
@ -224,8 +224,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/chunk-vendors.71654064.js"
},
{
"revision": "12cfbc42bf674769c6f0",
"url": "/static/js/main.88fa3c28.js"
"revision": "be5a37c7e9ea6bfcb8d7",
"url": "/static/js/main.db9cee98.js"
},
{
"revision": "ce60ed388b792b0e9a0e",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.94b00578e2690280739258ebb12c465f.js"
"/precache-manifest.8e074113b353c30f1ebf86b7fd5f4735.js"
);
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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"

View File

@ -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
}

View File

@ -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))

View File

@ -175,7 +175,7 @@ describe('getDatasets', () => {
},
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
{
@ -192,7 +192,7 @@ describe('getDatasets', () => {
},
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
{
@ -209,7 +209,7 @@ describe('getDatasets', () => {
},
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
{
@ -226,7 +226,7 @@ describe('getDatasets', () => {
},
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
{
@ -243,7 +243,7 @@ describe('getDatasets', () => {
},
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
{
@ -260,35 +260,35 @@ describe('getDatasets', () => {
nb_workouts: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
],
total_distance: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
],
total_duration: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
],
total_ascent: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
],
total_descent: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [],
},
],
@ -334,35 +334,35 @@ describe('formatStats', () => {
nb_workouts: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [0, 0, 0],
},
],
total_distance: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [0, 0, 0],
},
],
total_duration: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [0, 0, 0],
},
],
total_ascent: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [0, 0, 0],
},
],
total_descent: [
{
label: 'Cycling (Transport)',
backgroundColor: ['#88af98'],
backgroundColor: ['#000000'],
data: [0, 0, 0],
},
],