mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore: vehicle images hotfixes
This commit is contained in:
@@ -118,7 +118,7 @@ export default defineComponent({
|
|||||||
if (isLoco) {
|
if (isLoco) {
|
||||||
if (/^\d?EN\d{2}/.test(stockName)) fallbackName = 'loco-ezt';
|
if (/^\d?EN\d{2}/.test(stockName)) fallbackName = 'loco-ezt';
|
||||||
else if (/^SN\d{2}/.test(stockName)) fallbackName = 'loco-szt';
|
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 fallbackName = 'loco-s';
|
||||||
} else {
|
} else {
|
||||||
const isCarPassenger = /(\d{3}a|(Bau|Gor)\d{2}|304C)_/.test(stockName);
|
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`"
|
: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, ' ') }}
|
{{ tooltipStore.content.replace(/_/g, ' ') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,6 +40,12 @@ export default defineComponent({
|
|||||||
this.imageState = 'loading';
|
this.imageState = 'loading';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
'tooltipStore.type'(prev, val) {
|
||||||
|
if (prev != val) this.imageState = 'loading';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onImageLoad() {
|
onImageLoad() {
|
||||||
this.imageState = 'loaded';
|
this.imageState = 'loaded';
|
||||||
@@ -80,4 +88,8 @@ img {
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
text-wrap: wrap;
|
text-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-placeholder {
|
||||||
|
height: 176px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -34,10 +34,6 @@ export default defineConfig({
|
|||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'swdr-images-cache',
|
cacheName: 'swdr-images-cache',
|
||||||
expiration: {
|
|
||||||
maxEntries: 100,
|
|
||||||
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
|
|
||||||
},
|
|
||||||
cacheableResponse: {
|
cacheableResponse: {
|
||||||
statuses: [0, 200, 404]
|
statuses: [0, 200, 404]
|
||||||
}
|
}
|
||||||
@@ -48,10 +44,6 @@ export default defineConfig({
|
|||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'spythere-images-cache',
|
cacheName: 'spythere-images-cache',
|
||||||
expiration: {
|
|
||||||
maxEntries: 100,
|
|
||||||
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
|
|
||||||
},
|
|
||||||
cacheableResponse: {
|
cacheableResponse: {
|
||||||
statuses: [0, 200]
|
statuses: [0, 200]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user