From 8e0cf04562bb2df3b98b8ce5701a7d8deb2e0f7e Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 3 Jan 2023 19:21:54 +0100 Subject: [PATCH 1/3] =?UTF-8?q?update:=20pobieranie=20zdj=C4=99=C4=87=20z?= =?UTF-8?q?=20API=20(gh)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/components/TrainImageSection.vue | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index a706c30..f37cefd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -70,7 +70,7 @@ export default defineComponent({ async created() { const stockData = await ( - await fetch(`https://spythere.github.io/api/stockDataNew.json?t=${Math.floor(Date.now() / 60000)}`) + await fetch(`https://spythere.github.io/api/td2/data/stockData.json?t=${Math.floor(Date.now() / 60000)}`) ).json(); this.store.stockData = stockData; diff --git a/src/components/TrainImageSection.vue b/src/components/TrainImageSection.vue index cca95d4..b905b1a 100644 --- a/src/components/TrainImageSection.vue +++ b/src/components/TrainImageSection.vue @@ -3,20 +3,22 @@
-
ŁADOWANIE OBRAZU...
+
+ ŁADOWANIE OBRAZU... +
PODGLĄD WYBRANEGO POJAZDU
-
Ten pojazd nie ma jeszcze podglądu!
+
@@ -81,6 +83,8 @@ export default defineComponent({ watch: { chosenVehicle(vehicle: Vehicle, prevVehicle: Vehicle) { + console.log(vehicle); + if (vehicle && vehicle.type != prevVehicle?.type) { this.store.imageLoading = true; } @@ -101,7 +105,7 @@ export default defineComponent({ if (!chosenVehicle) return; - this.store.vehiclePreviewSrc = chosenVehicle.imageSrc.replace('300', '800'); + this.store.vehiclePreviewSrc = `https://spythere.github.io/api/td2/images/${chosenVehicle.type}--800px.jpg`; }, }, }); From 578dff25635e88968ef2e54c04e23558dbc3979c Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 3 Jan 2023 23:40:31 +0100 Subject: [PATCH 2/3] fix: carprops --- src/utils/vehicleUtils.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils/vehicleUtils.ts b/src/utils/vehicleUtils.ts index bc745f9..ba34193 100644 --- a/src/utils/vehicleUtils.ts +++ b/src/utils/vehicleUtils.ts @@ -133,12 +133,12 @@ export function carDataList(state: IStore) { return Object.keys(stockData.info).reduce((acc, vehicleTypeKey) => { if (!vehicleTypeKey.startsWith('car')) return acc; - const carVehiclesData = (stockData.info)[vehicleTypeKey as TStockInfoKey]; + const carVehiclesData = stockData.info[vehicleTypeKey as TStockInfoKey]; carVehiclesData.forEach((car) => { if (state.showSupporter && !car[3]) return; - const carPropsData = stockData.props.find((v) => car[0].toString().includes(v.type)); + const carPropsData = stockData.props.find((v) => car[0].toString().startsWith(v.type)); acc.push({ useType: vehicleTypeKey as 'car-passenger' | 'car-cargo', @@ -148,7 +148,7 @@ export function carDataList(state: IStore) { supportersOnly: car[3] as boolean, maxSpeed: Number(car[4] as string), imageSrc: car[5] as string, - cargoList: carPropsData?.cargo.includes(';') + cargoList: carPropsData?.cargo.split(';').filter((s) => s.length > 0) ? carPropsData.cargo.split(';').map((cargo) => ({ id: cargo.split(':')[0], totalMass: Number(cargo.split(':')[1]), @@ -327,5 +327,3 @@ export function chosenRealStock(state: IStore) { // }), // }; - - From 067173a684c4f584f8947654a45fcb1f33ced9df Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 3 Jan 2023 23:41:17 +0100 Subject: [PATCH 3/3] bump: 1.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fec7cd6..a8d3e64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pojazdownik", - "version": "1.2.2", + "version": "1.2.3", "private": true, "scripts": { "dev": "vite",