Updated Registration Column name and distance achievement units
This commit is contained in:
@@ -9,8 +9,6 @@ import ButtonLink from "@/Components/FlightsGoneBy/ButtonLink.vue";
|
||||
import Distance from "@/Components/Distance.vue";
|
||||
import FormattedNumber from "@/Components/FormattedNumber.vue";
|
||||
|
||||
const distanceAchievementCategoryId = 6
|
||||
|
||||
const props = defineProps<{
|
||||
achievement: Achievement
|
||||
userAchievement?: UserAchievement
|
||||
@@ -18,6 +16,20 @@ const props = defineProps<{
|
||||
distanceUnit? : "mi" | "km" | "nm"
|
||||
}>()
|
||||
|
||||
const dynamicDistanceUnit = computed(() => {
|
||||
if(props.achievement.internal_name == 'distance.million_miles'){
|
||||
return 'mi'
|
||||
}
|
||||
|
||||
if(props.achievement.internal_name == 'distance.million_kilometers'){
|
||||
return 'km'
|
||||
}
|
||||
|
||||
return props.distanceUnit ?? 'km';
|
||||
})
|
||||
|
||||
|
||||
|
||||
const progress = computed(() => {
|
||||
if (!props.achievement.progressive || !props.achievement.threshold) return null
|
||||
const current = props.userAchievement?.progress ?? 0
|
||||
@@ -88,9 +100,9 @@ const unlocked = computed(() => {
|
||||
|
||||
<template v-if="achievement.progressive && progress">
|
||||
<div class="progress-label">
|
||||
<span v-if="achievement.achievement_category_id == distanceAchievementCategoryId">
|
||||
<Distance :unit="distanceUnit" :showUnits="false" :value="Math.min(progress.current, progress.threshold)" /> /
|
||||
<Distance :unit="distanceUnit" :value="progress.threshold" />
|
||||
<span v-if="achievement.category?.internal_name == 'distance'">
|
||||
<Distance :unit="dynamicDistanceUnit" :showUnits="false" :value="Math.min(progress.current, progress.threshold)" /> /
|
||||
<Distance :unit="dynamicDistanceUnit" :value="progress.threshold" />
|
||||
</span>
|
||||
<span v-else>
|
||||
<FormattedNumber :value="Math.min(progress.current, progress.threshold)" /> /
|
||||
|
||||
Reference in New Issue
Block a user