Wyświetlanie liczby wagonów

This commit is contained in:
2021-06-29 16:24:50 +02:00
parent 34ab981988
commit b48f7a58dc
3 changed files with 29 additions and 15 deletions
+19 -13
View File
@@ -219,6 +219,10 @@
</div> </div>
<span class="driver-loco"> <span class="driver-loco">
<div class="driver-cars">
<span v-if="train.cars.length > 0">{{ $t("trains.cars") }}: <span class="count">{{ train.cars.length }}</span></span>
<span v-else>{{ displayLocoInfo(train.locoType) }}</span>
</div>
<img <img
class="train-image" class="train-image"
:src="train.locoURL" :src="train.locoURL"
@@ -226,12 +230,6 @@
/> />
</span> </span>
<div
class="driver-cars"
v-html="calculateCars(train.locoType, train.cars) "
>
</div>
</span> </span>
<span class="stats"> <span class="stats">
@@ -454,13 +452,13 @@ export default defineComponent({
.join(" > "); .join(" > ");
}, },
calculateCars(locoType: string, cars: string[]) { displayLocoInfo(locoType: string) {
if (cars.length == 0 && locoType.includes("EN")) return "EZT"; if (locoType.includes("EN")) return `${this.$t("trains.EZT")}`;
else if (cars.length == 0) return "LOK"; if (locoType.includes("SN")) return `${this.$t("trains.SZT")}`;
if (locoType.startsWith("E")) return `${this.$t("trains.loco-electric")}`;
if (locoType.startsWith("S")) return `${this.$t("trains.loco-diesel")}`;
return `${this.$t("trains.cars")}: <span style='color:gold'> ${ return "";
cars.length
}</span>`;
}, },
}, },
@@ -611,7 +609,15 @@ img.train-image {
} }
&-cars { &-cars {
margin-top: 0.5em; margin-bottom: 0.5em;
white-space: pre-wrap;
text-align: center;
color: #c5c5c5;
.count {
color: var(--clr-primary);
}
} }
} }
+5 -1
View File
@@ -110,7 +110,11 @@
"via-title": "Via: ", "via-title": "Via: ",
"no-timetable": "no current timetable", "no-timetable": "no current timetable",
"distance-exceeded": "Attention! Due to an internal error, timetables with route distance greater than 200km might be incorrect!", "distance-exceeded": "Attention! Due to an internal error, timetables with route distance greater than 200km might be incorrect!",
"cars": "Cars" "cars": "Car count",
"EZT": "EMU",
"SZT": "DMU",
"loco-electric": "ELECTRIC LOCO",
"loco-diesel": "DIESEL LOCO"
}, },
"journal": { "journal": {
"title": "SCENERY ACTIVITY JOURNAL", "title": "SCENERY ACTIVITY JOURNAL",
+5 -1
View File
@@ -110,7 +110,11 @@
"via-title": "Przez: ", "via-title": "Przez: ",
"no-timetable": "brak rozkładu jazdy", "no-timetable": "brak rozkładu jazdy",
"distance-exceeded": "Uwaga! Z powodu wewnętrznego błędu serwera TD2, rozkłady jazdy o kilometrażu powyżej 200km mogą być niepoprawne!", "distance-exceeded": "Uwaga! Z powodu wewnętrznego błędu serwera TD2, rozkłady jazdy o kilometrażu powyżej 200km mogą być niepoprawne!",
"cars": "Wagony" "cars": "Wagony",
"EZT": "EZT",
"SZT": "SZT",
"loco-electric": "Lok. elektryczna",
"loco-diesel": "Lok. spalinowa"
}, },
"journal": { "journal": {
"title": "DZIENNIK AKTYWNOŚCI SCENERII", "title": "DZIENNIK AKTYWNOŚCI SCENERII",