Skip to content

Commit

Permalink
Merge pull request #3856 from c2corg/deniv
Browse files Browse the repository at this point in the history
feat: Add total climb (denivelé)  to single-line route display
  • Loading branch information
brunobesson authored Mar 11, 2024
2 parents e8c9b30 + 42cdd1d commit 34b99b5
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions src/components/generics/pretty/PrettyRoute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
:activities="route.activities"
class="is-size-4 has-text-secondary icon-activities"
/>
<span v-if="heightUpText" :title="$gettext('height_diff_up')" class="has-text-normal .is-nowrap">
{{ heightUpText }}&#8202;m
</span>
<span :title="$gettext('height_diff_difficulties')" class="has-text-normal .is-nowrap">
{{ heightDiffText }},
</span>
<span
v-if="route.height_diff_difficulties && !hideHeightDiffDifficulties"
:title="$gettext('height_diff_difficulties')"
v-if="route.orientations && route.orientations.length < 3 && !hideOrientation"
:title="$gettext('orientations')"
class="has-text-normal"
>
{{ route.height_diff_difficulties }}&nbsp;m,
</span>
<span v-if="route.orientations && !hideOrientation" :title="$gettext('orientations')" class="has-text-normal">
{{ route.orientations.join(', ') }},
</span>
<document-rating :document="route" class="has-text-normal" />
Expand Down Expand Up @@ -58,6 +61,36 @@ export default {
rangeAreas() {
return this.route.areas.filter((area) => area.area_type === 'range');
},
heightUpText() {
if (
this.route.activities &&
(this.route.activities.includes('skitouring') ||
this.route.activities.includes('snowshoeing') ||
this.route.activities.includes('hiking'))
) {
if (this.route.height_diff_up) return '+' + this.route.height_diff_up;
if (this.route.height_diff_down) return '-' + this.route.height_diff_down;
}
return '';
},
heightDiffText() {
if (this.hideHeightDiffDifficulties) return '';
const act = this.route.activities;
if (!act) return;
const is_alpinism =
act.includes('snow_ice_mixed') ||
act.includes('mountain_climbing') ||
act.includes('rock_climbing') ||
act.includes('ice_climbing') ||
act.includes('skitouring');
// don't clutter with difficulties for "easy" activities
if (this.heightUpText && !is_alpinism) return '';
const dd = this.route.height_diff_difficulties;
if (!dd || (this.heightUpText && dd === this.route.height_diff_up)) return '';
// to differentiate the 2 heights, use parenthesis
const ddstr = dd + '\u200am';
return this.heightUpText ? '(' + ddstr + ')' : ddstr;
},
},
};
</script>
Expand Down

0 comments on commit 34b99b5

Please sign in to comment.