format; linting; aktualizacja do 2023.2.1

This commit is contained in:
2023-10-24 23:28:42 +02:00
parent 57ab6cc02d
commit 1c2a93fbd5
40 changed files with 2019 additions and 1640 deletions
+21 -15
View File
@@ -1,7 +1,7 @@
import { defineComponent } from 'vue';
import { useStore } from '../store';
import { ICargo, ICarWagon, ILocomotive, IStock, Vehicle } from '../types';
import { isLocomotive } from '../utils/vehicleUtils';
import { defineComponent } from "vue";
import { useStore } from "../store";
import { ICargo, ICarWagon, ILocomotive, IStock, Vehicle } from "../types";
import { isLocomotive } from "../utils/vehicleUtils";
export default defineComponent({
setup() {
@@ -39,14 +39,16 @@ export default defineComponent({
const stock = this.getStockObject(vehicle, cargo);
if (stock.isLoco && !this.store.stockList[0]?.isLoco) this.store.stockList.unshift(stock);
if (stock.isLoco && !this.store.stockList[0]?.isLoco)
this.store.stockList.unshift(stock);
else this.store.stockList.push(stock);
},
addLocomotive(loco: ILocomotive) {
const stockObj = this.getStockObject(loco);
if (this.store.stockList.length > 0 && !this.store.stockList[0].isLoco) this.store.stockList.unshift(stockObj);
if (this.store.stockList.length > 0 && !this.store.stockList[0].isLoco)
this.store.stockList.unshift(stockObj);
else this.store.stockList.push(stockObj);
},
@@ -57,7 +59,7 @@ export default defineComponent({
},
loadStockFromString(stockString: string) {
const stockArray = stockString.trim().split(';');
const stockArray = stockString.trim().split(";");
this.store.stockList.length = 0;
this.store.chosenVehicle = null;
@@ -73,22 +75,26 @@ export default defineComponent({
let vehicleCargo: ICargo | null = null;
if (/^(EU|EP|ET|SM|EN|2EN|SN)/.test(type)) {
const [locoType, coldStart] = type.split(',');
vehicle = this.store.locoDataList.find((loco) => loco.type == locoType) || null;
const [locoType, coldStart] = type.split(",");
vehicle =
this.store.locoDataList.find((loco) => loco.type == locoType) ||
null;
if (i == 0 && coldStart == 'c') this.store.isColdStart = true;
if (i == 0 && coldStart == "c") this.store.isColdStart = true;
} else {
const [carType, cargo] = type.split(':');
vehicle = this.store.carDataList.find((car) => car.type == carType) || null;
const [carType, cargo] = type.split(":");
vehicle =
this.store.carDataList.find((car) => car.type == carType) || null;
if (cargo) vehicleCargo = vehicle?.cargoList.find((c) => c.id == cargo) || null;
if (cargo)
vehicleCargo =
vehicle?.cargoList.find((c) => c.id == cargo) || null;
}
if (!vehicle) console.log('Brak pojazdu:', type);
if (!vehicle) console.log("Brak pojazdu:", type);
this.addVehicle(vehicle, vehicleCargo);
});
},
},
});