@@ -29,14 +29,14 @@ const currentCategoryIndex = ref(0)
2929const slideDirection = ref (' slide-next' )
3030const hoveredSpecId = ref <string | null >(null )
3131
32- const categories = [
32+ const categories = computed (() => [
3333 { id: ' consumption' , label: t (' dashboard.peer_consumption' ), unit: ' kWh/100km' , shortUnit: ' kWh/100km' , color: ' blue' , sortAsc: true },
3434 { id: ' costPerKwh' , label: t (' dashboard.peer_cost_label' ), unit: ' €/kWh' , shortUnit: ' €/kWh' , color: ' purple' , sortAsc: true },
3535 { id: ' costPer100km' , label: t (' dashboard.peer_cost_per_distance' ), unit: ' €/100km' , shortUnit: ' €/100km' , color: ' orange' , sortAsc: true },
36- { id: ' range' , label: t (' dashboard.peer_range' ), unit: ' km (Nettokapazität) ' , shortUnit: ' km' , color: ' green' , sortAsc: false },
37- ]
36+ { id: ' range' , label: t (' dashboard.peer_range' ), unit: t ( ' dashboard.peer_range_unit ' ) , shortUnit: ' km' , color: ' green' , sortAsc: false },
37+ ])
3838
39- const currentCategory = computed (() => categories [currentCategoryIndex .value ])
39+ const currentCategory = computed (() => categories . value [currentCategoryIndex .value ])
4040
4141const visibleComparisons = computed (() =>
4242 comparisons .value
@@ -55,12 +55,12 @@ const visibleComparisons = computed(() =>
5555
5656function nextCategory() {
5757 slideDirection .value = ' slide-next'
58- currentCategoryIndex .value = (currentCategoryIndex .value + 1 ) % categories .length
58+ currentCategoryIndex .value = (currentCategoryIndex .value + 1 ) % categories .value . length
5959}
6060
6161function prevCategory() {
6262 slideDirection .value = ' slide-prev'
63- currentCategoryIndex .value = (currentCategoryIndex .value - 1 + categories .length ) % categories .length
63+ currentCategoryIndex .value = (currentCategoryIndex .value - 1 + categories .value . length ) % categories . value .length
6464}
6565
6666onMounted (async () => {
@@ -70,7 +70,7 @@ onMounted(async () => {
7070 const response = await peerModelComparisonService .getPeerModelComparison (props .carId )
7171 comparisons .value = response .modelComparisons
7272 } catch (err ) {
73- error .value = err instanceof Error ? err .message : ' Failed to load peer data '
73+ error .value = err instanceof Error ? err .message : t ( ' dashboard.peer_load_error ' )
7474 } finally {
7575 loading .value = false
7676 }
@@ -145,7 +145,7 @@ function getRelativePercent(item: PeerModelComparisonItem): string | null {
145145 const refVal = getItemValue (hoveredItem , currentCategory .value .id )
146146 const ownVal = getItemValue (item , currentCategory .value .id )
147147 if (refVal === null || ownVal === null || refVal === 0 ) return null
148- if (item .vehicleSpecificationId === hoveredSpecId .value ) return ' Referenz '
148+ if (item .vehicleSpecificationId === hoveredSpecId .value ) return t ( ' dashboard.peer_reference ' )
149149 const diff = Math .round ((ownVal - refVal ) / refVal * 100 )
150150 return diff > 0 ? ` +${diff }% ` : ` ${diff }% `
151151}
@@ -182,7 +182,7 @@ function getDisplayBarWidth(item: PeerModelComparisonItem): number {
182182 <ChevronLeftIcon class="w-4 h-4 text-gray-600 dark:text-gray-300 " />
183183 </button >
184184 <button @click =" toggleCollapsed" class =" flex-1 flex flex-col items-center text-center min-w-0" >
185- <p class =" text-xs font-semibold text-gray-800 dark:text-gray-200" >Dein {{ carBrandModel }} im Vergleich </p >
185+ <p class =" text-xs font-semibold text-gray-800 dark:text-gray-200" >{{ t('dashboard.peer_card_title', { model: carBrandModel }) }} </p >
186186 <p class =" text-xs text-gray-500 dark:text-gray-400 mt-0.5" >{{ currentCategory.label }} · {{ currentCategory.unit }} · {{ currentCategoryIndex + 1 }}/{{ categories.length }}</p >
187187 </button >
188188 <button @click =" nextCategory" class =" p-1.5 hover:bg-gray-100 dark:hover:bg-gray-600 rounded shrink-0" >
@@ -202,8 +202,8 @@ function getDisplayBarWidth(item: PeerModelComparisonItem): number {
202202 </button >
203203
204204 <div class =" flex-1 text-center" >
205- <p class =" text-sm font-semibold text-gray-800 dark:text-gray-200" >Dein {{ carBrandModel }} im Vergleich </p >
206- <p class =" text-xs text-gray-400 dark:text-gray-500" >{{ visibleComparisons.length }} Varianten · gesamter Zeitraum </p >
205+ <p class =" text-sm font-semibold text-gray-800 dark:text-gray-200" >{{ t('dashboard.peer_card_title', { model: carBrandModel }) }} </p >
206+ <p class =" text-xs text-gray-400 dark:text-gray-500" >{{ t('dashboard.peer_card_variants', { count: visibleComparisons.length }) }} </p >
207207 </div >
208208
209209 <div class =" flex items-center gap-3" >
@@ -235,7 +235,7 @@ function getDisplayBarWidth(item: PeerModelComparisonItem): number {
235235
236236 <!-- Empty state -->
237237 <div v-else-if =" visibleComparisons.length === 0" class =" p-4 text-center text-xs text-gray-500 dark:text-gray-400" >
238- <p >Keine Vergleichsdaten verfügbar </p >
238+ <p >{{ t('dashboard.peer_no_comparison_data') }} </p >
239239 </div >
240240
241241 <!-- Category Carousel -->
0 commit comments