Client - update workout display when no gpx
This commit is contained in:
		@@ -22,13 +22,19 @@
 | 
			
		||||
      {{ t('workouts.MAX_SPEED') }}: <span>{{ workout.max_speed }} km/h</span>
 | 
			
		||||
      <WorkoutRecord :workout="workout" record_type="MS" />
 | 
			
		||||
    </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" />
 | 
			
		||||
      {{ t('workouts.MIN_ALTITUDE') }}: <span>{{ workout.min_alt }} m</span
 | 
			
		||||
      ><br />
 | 
			
		||||
      {{ t('workouts.MAX_ALTITUDE') }}: <span>{{ workout.max_alt }} m</span>
 | 
			
		||||
    </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" />
 | 
			
		||||
      {{ t('workouts.ASCENT') }}: <span>{{ workout.ascent }} m</span><br />
 | 
			
		||||
      {{ t('workouts.DESCENT') }}: <span>{{ workout.descent }} m</span>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@
 | 
			
		||||
        <LGeoJson :geojson="geoJson.jsonData" />
 | 
			
		||||
      </LMap>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div v-else class="no-map">{{ t('workouts.NO_MAP') }}</div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -26,6 +27,7 @@
 | 
			
		||||
  import { gpx } from '@tmcw/togeojson'
 | 
			
		||||
  import { LGeoJson, LMap, LTileLayer } from '@vue-leaflet/vue-leaflet'
 | 
			
		||||
  import { ComputedRef, PropType, computed, defineComponent, ref } from 'vue'
 | 
			
		||||
  import { useI18n } from 'vue-i18n'
 | 
			
		||||
 | 
			
		||||
  import { ROOT_STORE } from '@/store/constants'
 | 
			
		||||
  import { GeoJSONData } from '@/types/geojson'
 | 
			
		||||
@@ -46,6 +48,7 @@
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    setup(props) {
 | 
			
		||||
      const { t } = useI18n()
 | 
			
		||||
      const store = useStore()
 | 
			
		||||
      const workoutMap = ref<null | {
 | 
			
		||||
        leafletObject: { fitBounds: (bounds: number[][]) => null }
 | 
			
		||||
@@ -104,6 +107,7 @@
 | 
			
		||||
            : {}
 | 
			
		||||
        ),
 | 
			
		||||
        options: { zoom: 13 },
 | 
			
		||||
        t,
 | 
			
		||||
        workoutMap,
 | 
			
		||||
        fitBounds,
 | 
			
		||||
        getApiUrl,
 | 
			
		||||
@@ -116,16 +120,29 @@
 | 
			
		||||
  @import '~@/scss/base';
 | 
			
		||||
  #workout-map {
 | 
			
		||||
    padding: $default-padding 0;
 | 
			
		||||
    .leaflet-container {
 | 
			
		||||
    .leaflet-container,
 | 
			
		||||
    .no-map {
 | 
			
		||||
      height: 400px;
 | 
			
		||||
      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) {
 | 
			
		||||
      padding: 0;
 | 
			
		||||
      .leaflet-container {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 300px;
 | 
			
		||||
      }
 | 
			
		||||
      .no-map {
 | 
			
		||||
        display: none;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
  "MAX_SPEED": "max. speed",
 | 
			
		||||
  "MIN_ALTITUDE": "min. altitude",
 | 
			
		||||
  "NEXT_WORKOUT": "Next workout",
 | 
			
		||||
  "NO_MAP": "No map",
 | 
			
		||||
  "NO_NEXT_WORKOUT": "No next workout",
 | 
			
		||||
  "NO_PREVIOUS_WORKOUT": "No previous workout",
 | 
			
		||||
  "NO_RECORDS": "No records.",
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
  "MAX_SPEED": "vitesse max",
 | 
			
		||||
  "MIN_ALTITUDE": "altitude min",
 | 
			
		||||
  "NEXT_WORKOUT": "Séance suivante",
 | 
			
		||||
  "NO_MAP": "Pas de carte",
 | 
			
		||||
  "NO_NEXT_WORKOUT": "Pas de séance suivante",
 | 
			
		||||
  "NO_PREVIOUS_WORKOUT": "Pas de séances précédente",
 | 
			
		||||
  "NO_RECORDS": "Pas de records.",
 | 
			
		||||
 
 | 
			
		||||
@@ -34,4 +34,6 @@
 | 
			
		||||
  --workout-trophy-color: #daa520;
 | 
			
		||||
  --workout-img-color: invert(22%) sepia(25%) saturate(646%) hue-rotate(169deg)
 | 
			
		||||
        brightness(97%) contrast(96%);
 | 
			
		||||
  --workout-no-map-bg-color: #eaeaea;
 | 
			
		||||
  --workout-no-map-color: #666666;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user