mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 19:48:11 +00:00
eslint & prettier update; api fetching from static server
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import { defineComponent } from "vue";
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
methods: {
|
||||
getIconURL(name: string, ext = "svg"): string {
|
||||
getIconURL(name: string, ext = 'svg'): string {
|
||||
return `/images/icon-${name}.${ext}`;
|
||||
},
|
||||
|
||||
getThumbnailURL(vehicleType: string, size: "small" | "large") {
|
||||
getThumbnailURL(vehicleType: string, size: 'small' | 'large') {
|
||||
return `${
|
||||
import.meta.env.VITE_API_DEV === "1"
|
||||
? "http://localhost:5500"
|
||||
: "https://spythere.github.io/api"
|
||||
}/td2/images/${vehicleType}--${size == "small" ? 300 : 800}px.jpg`;
|
||||
import.meta.env.VITE_API_DEV === '1'
|
||||
? 'http://localhost:5500'
|
||||
: 'https://static.spythere.eu'
|
||||
}/images/${vehicleType}--${size == 'small' ? 300 : 800}px.jpg`;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../store';
|
||||
import { ICarWagon, ILocomotive, IStock, ICargo, Vehicle } from '../types';
|
||||
import { ICarWagon, ILocomotive, IStock, ICargo, IVehicle } from '../types';
|
||||
import { isLocomotive } from '../utils/vehicleUtils';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -15,7 +15,7 @@ export default defineComponent({
|
||||
return `${Math.random().toString(36).slice(5)}`;
|
||||
},
|
||||
|
||||
getStockObject(vehicle: Vehicle, cargo?: ICargo | null, count = 1): IStock {
|
||||
getStockObject(vehicle: IVehicle, cargo?: ICargo | null, count = 1): IStock {
|
||||
const isLoco = isLocomotive(vehicle);
|
||||
|
||||
return {
|
||||
@@ -35,7 +35,7 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
|
||||
addVehicle(vehicle: Vehicle | null, cargo?: ICargo | null) {
|
||||
addVehicle(vehicle: IVehicle | null, cargo?: ICargo | null) {
|
||||
if (!vehicle) return;
|
||||
|
||||
const stock = this.getStockObject(vehicle, cargo);
|
||||
@@ -47,7 +47,8 @@ export default defineComponent({
|
||||
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);
|
||||
},
|
||||
|
||||
@@ -70,7 +71,7 @@ export default defineComponent({
|
||||
this.store.swapVehicles = false;
|
||||
|
||||
stockArray.forEach((type, i) => {
|
||||
let vehicle: Vehicle | null = null;
|
||||
let vehicle: IVehicle | null = null;
|
||||
let vehicleCargo: ICargo | null = null;
|
||||
|
||||
const isLoco = /^(EU|EP|ET|SM|EN|2EN|SN)/.test(type);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../store';
|
||||
import { ICarWagon, ILocomotive, IStock, Vehicle } from '../types';
|
||||
import { ICarWagon, ILocomotive, IStock, IVehicle } from '../types';
|
||||
import { isLocomotive } from '../utils/vehicleUtils';
|
||||
|
||||
export default defineComponent({
|
||||
@@ -46,7 +46,7 @@ export default defineComponent({
|
||||
this.store.chosenCargo = null;
|
||||
},
|
||||
|
||||
previewVehicle(vehicle: Vehicle) {
|
||||
previewVehicle(vehicle: IVehicle) {
|
||||
if (isLocomotive(vehicle)) this.previewLocomotive(vehicle);
|
||||
else this.previewCarWagon(vehicle);
|
||||
},
|
||||
|
||||
@@ -11,7 +11,10 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
trainTooLong() {
|
||||
return (this.store.totalLength > 350 && this.store.isTrainPassenger) || (this.store.totalLength > 650 && !this.store.isTrainPassenger);
|
||||
return (
|
||||
(this.store.totalLength > 350 && this.store.isTrainPassenger) ||
|
||||
(this.store.totalLength > 650 && !this.store.isTrainPassenger)
|
||||
);
|
||||
},
|
||||
|
||||
trainTooHeavy() {
|
||||
|
||||
Reference in New Issue
Block a user