chore: vehicle images hotfixes

This commit is contained in:
2024-05-13 15:02:15 +02:00
parent 328e8c0573
commit eb5b94c9f6
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ export default defineComponent({
if (isLoco) {
if (/^\d?EN\d{2}/.test(stockName)) fallbackName = 'loco-ezt';
else if (/^SN\d{2}/.test(stockName)) fallbackName = 'loco-szt';
else if (/^\d{1,}?E/.test(stockName)) fallbackName = 'loco-e';
else if (/^\d{0,}?E/.test(stockName)) fallbackName = 'loco-e';
else fallbackName = 'loco-s';
} else {
const isCarPassenger = /(\d{3}a|(Bau|Gor)\d{2}|304C)_/.test(stockName);
@@ -16,7 +16,9 @@
:src="`https://static.spythere.eu/images/${tooltipStore.content}--300px.jpg`"
/>
<div class="vehicle-name" v-if="imageState != 'error'">
<div v-if="imageState == 'error'" class="error-placeholder"></div>
<div class="vehicle-name">
{{ tooltipStore.content.replace(/_/g, ' ') }}
</div>
</div>
@@ -38,6 +40,12 @@ export default defineComponent({
this.imageState = 'loading';
},
watch: {
'tooltipStore.type'(prev, val) {
if (prev != val) this.imageState = 'loading';
}
},
methods: {
onImageLoad() {
this.imageState = 'loaded';
@@ -80,4 +88,8 @@ img {
color: #ccc;
text-wrap: wrap;
}
.error-placeholder {
height: 176px;
}
</style>