From 27f02e2c2b863250db8d98a696db201cc901ceb7 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 6 Apr 2024 14:54:54 +0200 Subject: [PATCH 01/15] api & naming changes --- ...-s-unknown.png => loco-diesel-unknown.png} | Bin ...-unknown.png => loco-electric-unknown.png} | Bin ...-unknown.png => unit-electric-unknown.png} | Bin ...-unknown.png => wagon-freight-unknown.png} | Bin ...nknown.png => wagon-passenger-unknown.png} | Bin src/components/sections/InputsSection.vue | 35 +++--- src/components/sections/TrainImageSection.vue | 8 +- src/components/tabs/StockGeneratorTab.vue | 2 +- src/components/tabs/StockListTab.vue | 1 + src/components/tabs/WikiListTab.vue | 22 ++-- src/components/utils/StockThumbnails.vue | 2 +- src/enums/EVehicleUseType.ts | 9 -- src/locales/en.json | 38 +++--- src/locales/pl.json | 38 +++--- src/mixins/stockMixin.ts | 7 +- src/mixins/stockPreviewMixin.ts | 16 +-- src/store.ts | 10 +- src/types.ts | 45 ++++---- src/utils/vehicleUtils.ts | 108 +++++++++--------- vite.config.ts | 2 +- 20 files changed, 168 insertions(+), 175 deletions(-) rename public/images/{loco-s-unknown.png => loco-diesel-unknown.png} (100%) rename public/images/{loco-e-unknown.png => loco-electric-unknown.png} (100%) rename public/images/{loco-ezt-unknown.png => unit-electric-unknown.png} (100%) rename public/images/{car-cargo-unknown.png => wagon-freight-unknown.png} (100%) rename public/images/{car-passenger-unknown.png => wagon-passenger-unknown.png} (100%) delete mode 100644 src/enums/EVehicleUseType.ts diff --git a/public/images/loco-s-unknown.png b/public/images/loco-diesel-unknown.png similarity index 100% rename from public/images/loco-s-unknown.png rename to public/images/loco-diesel-unknown.png diff --git a/public/images/loco-e-unknown.png b/public/images/loco-electric-unknown.png similarity index 100% rename from public/images/loco-e-unknown.png rename to public/images/loco-electric-unknown.png diff --git a/public/images/loco-ezt-unknown.png b/public/images/unit-electric-unknown.png similarity index 100% rename from public/images/loco-ezt-unknown.png rename to public/images/unit-electric-unknown.png diff --git a/public/images/car-cargo-unknown.png b/public/images/wagon-freight-unknown.png similarity index 100% rename from public/images/car-cargo-unknown.png rename to public/images/wagon-freight-unknown.png diff --git a/public/images/car-passenger-unknown.png b/public/images/wagon-passenger-unknown.png similarity index 100% rename from public/images/car-passenger-unknown.png rename to public/images/wagon-passenger-unknown.png diff --git a/src/components/sections/InputsSection.vue b/src/components/sections/InputsSection.vue index bff3fb8..98e67c3 100644 --- a/src/components/sections/InputsSection.vue +++ b/src/components/sections/InputsSection.vue @@ -9,7 +9,7 @@ v-for="locoType in locomotiveTypeList" :key="locoType.id" class="btn btn--choice" - :data-selected="locoType.id == store.chosenLocoPower" + :data-selected="locoType.id == store.chosenLocoGroup" @click="selectLocoType(locoType.id)" > {{ $t(`inputs.${locoType.id}`) }} @@ -39,7 +39,7 @@ v-for="carType in carTypeList" :key="carType.id" class="btn btn--choice" - :data-selected="carType.id == store.chosenCarUseType" + :data-selected="carType.id == store.chosenCarGroup" @click="selectCarWagonType(carType.id)" > {{ $t(`inputs.${carType.id}`) }} @@ -70,7 +70,7 @@ id="cargo-select" :disabled=" (store.chosenCar && !store.chosenCar.loadable) || - (store.chosenCar && store.chosenCar.useType == 'car-passenger') || + (store.chosenCar && store.chosenCar.group == 'wagon-passenger') || !store.chosenCar " data-select="cargo" @@ -123,6 +123,7 @@ import imageMixin from '../../mixins/imageMixin'; import { useStore } from '../../store'; import stockPreviewMixin from '../../mixins/stockPreviewMixin'; import stockMixin from '../../mixins/stockMixin'; +import { LocoGroupType, WagonGroupType } from '../../types'; export default defineComponent({ mixins: [imageMixin, stockPreviewMixin, stockMixin], @@ -131,33 +132,33 @@ export default defineComponent({ store: useStore(), locomotiveTypeList: [ { - id: 'loco-e', + id: 'loco-electric', desc: 'ELEKTRYCZNE', }, { - id: 'loco-s', + id: 'loco-diesel', desc: 'SPALINOWE', }, { - id: 'loco-ezt', + id: 'unit-electric', desc: 'ELEKTR. ZESPOŁY TRAKCYJNE', }, { - id: 'loco-szt', + id: 'unit-diesel', desc: 'SPAL. ZESPOŁY TRAKCYJNE', }, - ], + ] as { id: LocoGroupType; desc: string }[], carTypeList: [ { - id: 'car-passenger', + id: 'wagon-passenger', desc: 'PASAŻERSKIE', }, { - id: 'car-cargo', + id: 'wagon-freight', desc: 'TOWAROWE', }, - ], + ] as { id: WagonGroupType; desc: string }[], }), computed: { @@ -165,14 +166,14 @@ export default defineComponent({ return this.store.locoDataList .slice() .sort((a, b) => (a.type > b.type ? 1 : -1)) - .filter((loco) => loco.power == this.store.chosenLocoPower); + .filter((loco) => loco.group == this.store.chosenLocoGroup); }, carOptions() { return this.store.carDataList .slice() .sort((a, b) => (a.type > b.type ? 1 : -1)) - .filter((car) => car.useType == this.store.chosenCarUseType); + .filter((car) => car.group == this.store.chosenCarGroup); }, }, @@ -209,14 +210,14 @@ export default defineComponent({ this.store.stockList[this.store.chosenStockListIndex] = stockObject; }, - selectLocoType(locoTypeId: string) { - this.store.chosenLocoPower = locoTypeId; + selectLocoType(locoGroupType: LocoGroupType) { + this.store.chosenLocoGroup = locoGroupType; this.store.chosenVehicle = this.locoOptions[0]; this.store.chosenLoco = this.locoOptions[0]; }, - selectCarWagonType(carWagonTypeId: string) { - this.store.chosenCarUseType = carWagonTypeId; + selectCarWagonType(wagonGroupType: WagonGroupType) { + this.store.chosenCarGroup = wagonGroupType; this.store.chosenVehicle = this.carOptions[0]; this.store.chosenCar = this.carOptions[0]; this.store.chosenCargo = null; diff --git a/src/components/sections/TrainImageSection.vue b/src/components/sections/TrainImageSection.vue index 5843d45..4ab8859 100644 --- a/src/components/sections/TrainImageSection.vue +++ b/src/components/sections/TrainImageSection.vue @@ -20,7 +20,7 @@ {{ $t( - `preview.${isLocomotive(store.chosenVehicle) ? store.chosenVehicle.power : store.chosenVehicle.useType}` + `preview.${isLocomotive(store.chosenVehicle) ? store.chosenVehicle.group : store.chosenVehicle.group}` ) }} @@ -37,7 +37,7 @@
{{ - store.chosenVehicle.useType == 'car-cargo' + store.chosenVehicle.group == 'wagon-freight' ? $t(`usage.${store.chosenVehicle.constructionType}`) : `${$t('preview.construction')} ${store.chosenVehicle.constructionType}` }} @@ -60,7 +60,7 @@ From 06eb4bc607c259cc105752ed5be7c8a7f32b6c5b Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 10 Apr 2024 16:18:32 +0200 Subject: [PATCH 14/15] fix: button bg color --- src/components/cards/RealStockCard.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/cards/RealStockCard.vue b/src/components/cards/RealStockCard.vue index 465cccf..6dbf799 100644 --- a/src/components/cards/RealStockCard.vue +++ b/src/components/cards/RealStockCard.vue @@ -9,7 +9,7 @@ {{ $t('realstock.title') }} Railtrains997 -
@@ -47,7 +47,7 @@ - @@ -222,13 +222,17 @@ export default defineComponent({