From 9ed142e100b8226b8745063acdf75fed95e27d64 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 27 Aug 2022 19:23:01 +0200 Subject: [PATCH] Client - minor fixes --- fittrackee_client/src/components/Common/Pagination.vue | 2 +- fittrackee_client/src/components/Statistics/index.vue | 4 ++-- .../src/components/User/UserSportPreferences.vue | 9 +++++++-- fittrackee_client/src/types/user.ts | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fittrackee_client/src/components/Common/Pagination.vue b/fittrackee_client/src/components/Common/Pagination.vue index 47d113dc..6cac5b2b 100644 --- a/fittrackee_client/src/components/Common/Pagination.vue +++ b/fittrackee_client/src/components/Common/Pagination.vue @@ -66,7 +66,7 @@ function getQuery( page: number, cursor?: number - ): TWorkoutsPayload | TPaginationPayload { + ): TPaginationPayload | IOauth2ClientsPayload { const newQuery = Object.assign({}, query.value) newQuery.page = cursor ? page + cursor : page return newQuery diff --git a/fittrackee_client/src/components/Statistics/index.vue b/fittrackee_client/src/components/Statistics/index.vue index 14d240e0..4116b0d9 100644 --- a/fittrackee_client/src/components/Statistics/index.vue +++ b/fittrackee_client/src/components/Statistics/index.vue @@ -28,13 +28,13 @@ import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue' import { ISport, ITranslatedSport } from '@/types/sports' import { IStatisticsDateParams } from '@/types/statistics' - import { IUserProfile } from '@/types/user' + import { IAuthUserProfile } from '@/types/user' import { translateSports } from '@/utils/sports' import { getStatsDateParams, updateChartParams } from '@/utils/statistics' interface Props { sports: ISport[] - user: IUserProfile + user: IAuthUserProfile } const props = defineProps() diff --git a/fittrackee_client/src/components/User/UserSportPreferences.vue b/fittrackee_client/src/components/User/UserSportPreferences.vue index 96a4662e..81f4aacc 100644 --- a/fittrackee_client/src/components/User/UserSportPreferences.vue +++ b/fittrackee_client/src/components/User/UserSportPreferences.vue @@ -184,7 +184,8 @@ const { t } = useI18n() const { isEdition, user } = toRefs(props) - const sportColors = inject('sportColors') + const defaultColor = '#838383' + const sportColors: Record | undefined = inject('sportColors') const sports: ComputedRef = computed( () => store.getters[SPORTS_STORE.GETTERS.SPORTS] ) @@ -207,7 +208,11 @@ function updateSportInEdition(sport: ISport | null) { if (sport !== null) { sportPayload.sport_id = sport.id - sportPayload.color = sport.color ? sport.color : sportColors[sport.label] + sportPayload.color = sport.color + ? sport.color + : sportColors + ? sportColors[sport.label] + : defaultColor sportPayload.is_active = sport.is_active_for_user sportPayload.stopped_speed_threshold = sport.stopped_speed_threshold } else { diff --git a/fittrackee_client/src/types/user.ts b/fittrackee_client/src/types/user.ts index f63858e9..a2412237 100644 --- a/fittrackee_client/src/types/user.ts +++ b/fittrackee_client/src/types/user.ts @@ -18,6 +18,7 @@ export interface IUserProfile { picture: string | boolean records: IRecord[] sports_list: number[] + total_ascent: number total_distance: number total_duration: string username: string