From c38debb4589e709d7366cfb46d4bdfb91b5aefe2 Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 15 Apr 2025 21:18:18 +0200 Subject: [PATCH] chore: replaced footer version check with vehicle counters --- src/components/app/Footer.vue | 29 ++++++++++++++++++++++++++++- src/locales/en.json | 3 ++- src/locales/pl.json | 3 ++- src/types/common.types.ts | 1 + 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/components/app/Footer.vue b/src/components/app/Footer.vue index bd84d44..c454ecc 100644 --- a/src/components/app/Footer.vue +++ b/src/components/app/Footer.vue @@ -9,7 +9,13 @@
- {{ $t('footer.version-check', { version: store.compatibleSimulatorVersion }) }} + {{ + $t('footer.vehicles-count', { + all: vehiclesCounters.all, + units: vehiclesCounters.units, + cars: vehiclesCounters.cars, + }) + }}
@@ -33,6 +39,27 @@ export default defineComponent({ store: useStore(), }; }, + + computed: { + vehiclesCounters() { + let counters = { + all: 0, + cars: 0, + units: 0, + }; + + if (!this.store.vehiclesData) return counters; + + this.store.vehiclesData?.forEach((v) => { + counters.all += 1; + + if (v.group.locoProps !== null) counters.units += 1; + else counters.cars += 1; + }); + + return counters; + }, + }, }); diff --git a/src/locales/en.json b/src/locales/en.json index d640eb1..304e3c2 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -6,7 +6,8 @@ "disclaimer": "This site has only an informational intent. The author does not carry any responsibility for creating trains against {tos}!", "tos": "Train Driver 2 simulator rules", "tos-href": "https://docs.google.com/document/d/1UAAPUtN0d_RoS4RgOzEzllJZJhA0VcizzCzKW4QylbY/edit#heading=h.1ldcvhomwjp9", - "version-check": "Site is complete for version {version} of Train Driver 2 simulator" + "version-check": "Site is complete for version {version} of Train Driver 2 simulator", + "vehicles-count": "Site contains currently {all} vehicles - including {units} traction units and {cars} car wagons!" }, "inputs": { "title": "CHOOSE A VEHICLE", diff --git a/src/locales/pl.json b/src/locales/pl.json index 7ed3657..62ffeeb 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -6,7 +6,8 @@ "disclaimer": "Ta strona ma charakter informacyjny. Autor nie ponosi odpowiedzialności za tworzenie pociągów niezgodnych z {tos}!", "tos": "regulaminem symulatora Train Driver 2", "tos-href": "https://docs.google.com/document/d/1UAAPUtN0d_RoS4RgOzEzllJZJhA0VcizzCzKW4QylbY/edit", - "version-check": "Strona jest kompletna dla wersji {version} symulatora TD2" + "version-check": "Strona jest kompletna dla wersji {version} symulatora TD2", + "vehicles-count": "Strona zawiera obecnie {all} pojazdów - w tym {units} jednostek trakcyjnych i {cars} wagonów!" }, "inputs": { "title": "WYBIERZ POJAZD", diff --git a/src/types/common.types.ts b/src/types/common.types.ts index 21d5609..8191609 100644 --- a/src/types/common.types.ts +++ b/src/types/common.types.ts @@ -70,6 +70,7 @@ export interface IVehicleData { cabinName: string | null; restrictions: IVehicleRestrictions | null; vehicleGroupsId: number; + simulatorVersion: string; group: IVehicleGroup; }