Client - update workout display when no gpx

This commit is contained in:
Sam 2021-09-25 09:40:10 +02:00
parent 2bbbd04657
commit 060c5d42d9
5 changed files with 30 additions and 3 deletions

View File

@ -22,13 +22,19 @@
{{ t('workouts.MAX_SPEED') }}: <span>{{ workout.max_speed }} km/h</span> {{ t('workouts.MAX_SPEED') }}: <span>{{ workout.max_speed }} km/h</span>
<WorkoutRecord :workout="workout" record_type="MS" /> <WorkoutRecord :workout="workout" record_type="MS" />
</div> </div>
<div class="workout-data"> <div
class="workout-data"
v-if="workout.max_alt !== null && workout.min_alt !== null"
>
<img class="mountains" src="/img/misc/mountains.svg" /> <img class="mountains" src="/img/misc/mountains.svg" />
{{ t('workouts.MIN_ALTITUDE') }}: <span>{{ workout.min_alt }} m</span {{ t('workouts.MIN_ALTITUDE') }}: <span>{{ workout.min_alt }} m</span
><br /> ><br />
{{ t('workouts.MAX_ALTITUDE') }}: <span>{{ workout.max_alt }} m</span> {{ t('workouts.MAX_ALTITUDE') }}: <span>{{ workout.max_alt }} m</span>
</div> </div>
<div class="workout-data"> <div
class="workout-data"
v-if="workout.ascent !== null && workout.descent !== null"
>
<i class="fa fa-location-arrow" aria-hidden="true" /> <i class="fa fa-location-arrow" aria-hidden="true" />
{{ t('workouts.ASCENT') }}: <span>{{ workout.ascent }} m</span><br /> {{ t('workouts.ASCENT') }}: <span>{{ workout.ascent }} m</span><br />
{{ t('workouts.DESCENT') }}: <span>{{ workout.descent }} m</span> {{ t('workouts.DESCENT') }}: <span>{{ workout.descent }} m</span>

View File

@ -19,6 +19,7 @@
<LGeoJson :geojson="geoJson.jsonData" /> <LGeoJson :geojson="geoJson.jsonData" />
</LMap> </LMap>
</div> </div>
<div v-else class="no-map">{{ t('workouts.NO_MAP') }}</div>
</div> </div>
</template> </template>
@ -26,6 +27,7 @@
import { gpx } from '@tmcw/togeojson' import { gpx } from '@tmcw/togeojson'
import { LGeoJson, LMap, LTileLayer } from '@vue-leaflet/vue-leaflet' import { LGeoJson, LMap, LTileLayer } from '@vue-leaflet/vue-leaflet'
import { ComputedRef, PropType, computed, defineComponent, ref } from 'vue' import { ComputedRef, PropType, computed, defineComponent, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { ROOT_STORE } from '@/store/constants' import { ROOT_STORE } from '@/store/constants'
import { GeoJSONData } from '@/types/geojson' import { GeoJSONData } from '@/types/geojson'
@ -46,6 +48,7 @@
}, },
}, },
setup(props) { setup(props) {
const { t } = useI18n()
const store = useStore() const store = useStore()
const workoutMap = ref<null | { const workoutMap = ref<null | {
leafletObject: { fitBounds: (bounds: number[][]) => null } leafletObject: { fitBounds: (bounds: number[][]) => null }
@ -104,6 +107,7 @@
: {} : {}
), ),
options: { zoom: 13 }, options: { zoom: 13 },
t,
workoutMap, workoutMap,
fitBounds, fitBounds,
getApiUrl, getApiUrl,
@ -116,16 +120,29 @@
@import '~@/scss/base'; @import '~@/scss/base';
#workout-map { #workout-map {
padding: $default-padding 0; padding: $default-padding 0;
.leaflet-container { .leaflet-container,
.no-map {
height: 400px; height: 400px;
width: 600px; width: 600px;
} }
.no-map {
text-align: center;
vertical-align: center;
font-style: italic;
line-height: 400px;
color: var(--workout-no-map-color);
background-color: var(--workout-no-map-bg-color);
}
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
padding: 0;
.leaflet-container { .leaflet-container {
width: 100%; width: 100%;
height: 300px; height: 300px;
} }
.no-map {
display: none;
}
} }
} }
</style> </style>

View File

@ -12,6 +12,7 @@
"MAX_SPEED": "max. speed", "MAX_SPEED": "max. speed",
"MIN_ALTITUDE": "min. altitude", "MIN_ALTITUDE": "min. altitude",
"NEXT_WORKOUT": "Next workout", "NEXT_WORKOUT": "Next workout",
"NO_MAP": "No map",
"NO_NEXT_WORKOUT": "No next workout", "NO_NEXT_WORKOUT": "No next workout",
"NO_PREVIOUS_WORKOUT": "No previous workout", "NO_PREVIOUS_WORKOUT": "No previous workout",
"NO_RECORDS": "No records.", "NO_RECORDS": "No records.",

View File

@ -12,6 +12,7 @@
"MAX_SPEED": "vitesse max", "MAX_SPEED": "vitesse max",
"MIN_ALTITUDE": "altitude min", "MIN_ALTITUDE": "altitude min",
"NEXT_WORKOUT": "Séance suivante", "NEXT_WORKOUT": "Séance suivante",
"NO_MAP": "Pas de carte",
"NO_NEXT_WORKOUT": "Pas de séance suivante", "NO_NEXT_WORKOUT": "Pas de séance suivante",
"NO_PREVIOUS_WORKOUT": "Pas de séances précédente", "NO_PREVIOUS_WORKOUT": "Pas de séances précédente",
"NO_RECORDS": "Pas de records.", "NO_RECORDS": "Pas de records.",

View File

@ -34,4 +34,6 @@
--workout-trophy-color: #daa520; --workout-trophy-color: #daa520;
--workout-img-color: invert(22%) sepia(25%) saturate(646%) hue-rotate(169deg) --workout-img-color: invert(22%) sepia(25%) saturate(646%) hue-rotate(169deg)
brightness(97%) contrast(96%); brightness(97%) contrast(96%);
--workout-no-map-bg-color: #eaeaea;
--workout-no-map-color: #666666;
} }