mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore: added cargo warnings to driver propositions
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<template>
|
||||
<div class="driver-propositions">
|
||||
<h3 style="margin-bottom: 0.5em">{{ t('trains.number-propositions-header') }}</h3>
|
||||
|
||||
<div class="categories-select">
|
||||
<button
|
||||
v-for="(category, i) in availableCategories"
|
||||
@@ -44,6 +42,21 @@
|
||||
</div>
|
||||
|
||||
<div class="no-propositions" v-else>{{ t('trains.number-propositions-empty') }}</div>
|
||||
|
||||
<div class="cargo-warnings" v-if="getCargoWarnings.size > 0">
|
||||
<hr />
|
||||
<h3>{{ t('cargo-warnings.title') }}</h3>
|
||||
|
||||
<div class="warnings-container">
|
||||
<div
|
||||
v-for="warning in getCargoWarnings"
|
||||
class="train-badge"
|
||||
:class="`${warning.split('-')[0]}`"
|
||||
>
|
||||
{{ t('cargo-warnings.' + warning) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -145,6 +158,27 @@ const chosenCategory = computed(() => {
|
||||
return availableCategories.value[chosenCategoryIndex.value];
|
||||
});
|
||||
|
||||
const getCargoWarnings = computed(() => {
|
||||
const stockList = props.chosenTrain.stockList;
|
||||
|
||||
let warnings: Set<string> = new Set();
|
||||
|
||||
stockList.forEach((stockVehicle) => {
|
||||
const [vehicleName, vehicleCargo] = stockVehicle.split(':');
|
||||
|
||||
if (vehicleName.startsWith('WB117')) warnings.add(vehicleCargo ? 'twr-un1965' : 'tn-un1965');
|
||||
else if (vehicleName.startsWith('445Rb')) warnings.add('tn-un1202');
|
||||
else if (vehicleName.startsWith('EDK80')) warnings.add('pn-edk80');
|
||||
|
||||
if (vehicleCargo) {
|
||||
if (vehicleCargo.startsWith('wt_20')) warnings.add('pn-innofreight');
|
||||
else if (/^(tank|vehicles_01|truck)/.test(vehicleCargo)) warnings.add('pn-military');
|
||||
}
|
||||
});
|
||||
|
||||
return warnings;
|
||||
});
|
||||
|
||||
const availableCategories = computed(() => {
|
||||
const stockList = props.chosenTrain.stockList;
|
||||
const headVehicle = stockList[0]?.split('-')[0] ?? '';
|
||||
@@ -221,6 +255,7 @@ function selectCategory(i: number) {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '../../styles/responsive';
|
||||
@use '../../styles/badge';
|
||||
|
||||
.driver-propositions {
|
||||
margin-bottom: 1em;
|
||||
@@ -256,6 +291,19 @@ function selectCategory(i: number) {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.cargo-warnings {
|
||||
margin-top: 0.5em;
|
||||
|
||||
h3 {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
}
|
||||
|
||||
.warnings-container {
|
||||
display: flex;
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
@include responsive.smallScreen {
|
||||
.driver-propositions {
|
||||
text-align: center;
|
||||
|
||||
@@ -447,6 +447,15 @@
|
||||
"number-propositions-title": "Propositions:",
|
||||
"number-propositions-empty": "No propositions available for the chosen category! :/"
|
||||
},
|
||||
"cargo-warnings": {
|
||||
"title": "Additional cargo warnings:",
|
||||
"pn-innofreight": "PN - Innofreight C45: exceeded gauge",
|
||||
"twr-un1965": "TWR - LPG tanks (UN 1965)",
|
||||
"tn-un1965": "TN - empty LPG tanks (UN 1965)",
|
||||
"tn-un1202": "TN - diesel fuel (UN 1202)",
|
||||
"pn-military": "PN - military transport",
|
||||
"pn-edk80": "PN - EDK80 railway crane"
|
||||
},
|
||||
"train-stats": {
|
||||
"stats-button": "STATISTICS",
|
||||
"title": "ONLINE TRAINS STATS",
|
||||
|
||||
@@ -434,6 +434,15 @@
|
||||
"number-propositions-title": "Propozycje:",
|
||||
"number-propositions-empty": "Brak propozycji dla wybranej kategorii! :/"
|
||||
},
|
||||
"cargo-warnings": {
|
||||
"title": "Dodatkowe uwagi przewozowe:",
|
||||
"pn-innofreight": "PN - Innofreight C45: przekroczona skrajnia",
|
||||
"twr-un1965": "TWR - gazy węglowodorowe skroplone (UN 1965)",
|
||||
"tn-un1965": "TN - gazy węglowodorowe skroplone - puste cysterny (UN 1965)",
|
||||
"tn-un1202": "TN - olej napędowy (UN 1202)",
|
||||
"pn-military": "PN - transport wojskowy",
|
||||
"pn-edk80": "PN - żuraw kolejowy EDK80"
|
||||
},
|
||||
"train-stats": {
|
||||
"stats-button": "STATYSTYKI",
|
||||
"title": "STATYSTYKI AKTYWNYCH POCIĄGÓW",
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
padding: 0.1em 0.3em;
|
||||
border-radius: 0.2em;
|
||||
font-weight: bold;
|
||||
user-select: none;
|
||||
|
||||
&.twr {
|
||||
background-color: var(--clr-twr);
|
||||
@@ -151,4 +150,4 @@
|
||||
&.active {
|
||||
background-color: lightblue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user