Client - display records on Calendar

This commit is contained in:
Sam 2021-09-08 18:35:32 +02:00
parent 07f192c12e
commit 262f01a055
5 changed files with 44 additions and 1 deletions

View File

@ -1,11 +1,24 @@
<template> <template>
<div class="calendar-workout"> <div class="calendar-workout">
<img alt="workout sport logo" :src="sportImg" :title="workout.title" /> <img alt="workout sport logo" :src="sportImg" :title="workout.title" />
<sup>
<i
v-if="workout.records.length > 0"
class="fa fa-trophy custom-fa-small"
aria-hidden="true"
:title="
workout.records.map(
(record) => ` ${t(`workouts.RECORD_${record.record_type}`)}`
)
"
/>
</sup>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType } from 'vue' import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { IWorkout } from '@/types/workouts' import { IWorkout } from '@/types/workouts'
@ -21,6 +34,10 @@
required: true, required: true,
}, },
}, },
setup() {
const { t } = useI18n()
return { t }
},
}) })
</script> </script>
@ -28,17 +45,30 @@
@import '~@/scss/base'; @import '~@/scss/base';
.calendar-workout { .calendar-workout {
padding: 2px; padding: 2px 0;
img { img {
max-width: 18px; max-width: 18px;
max-height: 18px; max-height: 18px;
} }
sup {
position: relative;
top: -0.6em;
left: -0.4em;
.custom-fa-small {
font-size: 0.7em;
}
}
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
img { img {
max-width: 14px; max-width: 14px;
max-height: 14px; max-height: 14px;
} }
sup {
.custom-fa-small {
font-size: 0.6em;
}
}
} }
} }
</style> </style>

View File

@ -3,6 +3,10 @@
"DISTANCE": "distance", "DISTANCE": "distance",
"DURATION": "duration", "DURATION": "duration",
"KM": "km", "KM": "km",
"RECORD_AS": "Ave. speed",
"RECORD_FD": "Farest distance",
"RECORD_LD": "Longest duration",
"RECORD_MS": "Max. speed",
"SPORT": "sport | sports", "SPORT": "sport | sports",
"WORKOUT": "workout | workouts" "WORKOUT": "workout | workouts"
} }

View File

@ -3,6 +3,10 @@
"DISTANCE": "distance", "DISTANCE": "distance",
"DURATION": "durée", "DURATION": "durée",
"KM": "km", "KM": "km",
"RECORD_AS": "Vitesse moy.",
"RECORD_FD": "Distance la + longue",
"RECORD_LD": "Durée la + longue",
"RECORD_MS": "Vitesse max.",
"SPORT": "sport | sports", "SPORT": "sport | sports",
"WORKOUT": "séance | séances" "WORKOUT": "séance | séances"
} }

View File

@ -86,3 +86,7 @@ button {
.upper { .upper {
text-transform: uppercase; text-transform: uppercase;
} }
.fa-trophy {
color: var(--workout-trophy-color)
}

View File

@ -31,4 +31,5 @@
--disabled-background-color: #e0e0e0; --disabled-background-color: #e0e0e0;
--disabled-color: #a3a3a3; --disabled-color: #a3a3a3;
--workout-trophy-color: #daa520;
} }