chore: adjusted to new version of API vehicles data

This commit is contained in:
2024-06-08 20:53:22 +02:00
parent c252213ed9
commit 59a5fbe5ac
6 changed files with 61 additions and 68 deletions
@@ -23,9 +23,9 @@
<span v-if="vehicleCargo">({{ vehicleCargo.id }})</span>
</div>
<div class="vehicle-props" v-if="vehicleProps">
{{ vehicleProps.speed }}km/h &bull; {{ vehicleProps.length }}m &bull;
{{ (vehicleProps.weight / 1000).toFixed(1) }}t
<div class="vehicle-props" v-if="vehicleData">
{{ vehicleData.group.speed }}km/h &bull; {{ vehicleData.group.length }}m &bull;
{{ (vehicleData.group.weight / 1000).toFixed(1) }}t
<span v-if="vehicleCargo">(+{{ (vehicleCargo.weight / 1000).toFixed(1) }}t)</span>
</div>
</div>
@@ -72,23 +72,27 @@ export default defineComponent({
return this.tooltipStore.content.split(':')[0];
},
vehicleCargo() {
return this.vehicleProps?.cargoTypes?.find(
(c) => c.id == this.tooltipStore.content.split(':')[1]
);
vehicleData() {
return this.apiStore.vehiclesData?.find((v) => v.name == this.vehicleName);
},
vehicleProps() {
const vehicleDataArray = this.apiStore.vehiclesData?.vehicleList.find(
([name]) => name === this.vehicleName
);
if (!vehicleDataArray) return null;
return (
this.apiStore.vehiclesData!.vehicleProps.find((v) => v.type == vehicleDataArray[1]) ?? null
vehicleCargo() {
return this.vehicleData?.group.cargoTypes?.find(
(c) => c.id == this.tooltipStore.content.split(':')[1]
);
}
// vehicleProps() {
// const vehicleDataArray = this.apiStore.vehiclesData?.vehicleList.find(
// ([name]) => name === this.vehicleName
// );
// if (!vehicleDataArray) return null;
// return (
// this.apiStore.vehiclesData!.vehicleProps.find((v) => v.type == vehicleDataArray[1]) ?? null
// );
// }
}
});
</script>