From eb5b94c9f6a3bcc5d30acf3dfe9a45d3a3e96c4c Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 13 May 2024 15:02:15 +0200 Subject: [PATCH] chore: vehicle images hotfixes --- src/components/Global/StockList.vue | 2 +- src/components/Tooltip/VehiclePreviewTooltip.vue | 14 +++++++++++++- vite.config.ts | 8 -------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/Global/StockList.vue b/src/components/Global/StockList.vue index dbb0980..a2fbecc 100644 --- a/src/components/Global/StockList.vue +++ b/src/components/Global/StockList.vue @@ -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); diff --git a/src/components/Tooltip/VehiclePreviewTooltip.vue b/src/components/Tooltip/VehiclePreviewTooltip.vue index 95bce86..1d88c19 100644 --- a/src/components/Tooltip/VehiclePreviewTooltip.vue +++ b/src/components/Tooltip/VehiclePreviewTooltip.vue @@ -16,7 +16,9 @@ :src="`https://static.spythere.eu/images/${tooltipStore.content}--300px.jpg`" /> -
+
+ +
{{ tooltipStore.content.replace(/_/g, ' ') }}
@@ -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; +} diff --git a/vite.config.ts b/vite.config.ts index adf7a9e..58c5daa 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -34,10 +34,6 @@ export default defineConfig({ handler: 'CacheFirst', options: { cacheName: 'swdr-images-cache', - expiration: { - maxEntries: 100, - maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days - }, cacheableResponse: { statuses: [0, 200, 404] } @@ -48,10 +44,6 @@ export default defineConfig({ handler: 'CacheFirst', options: { cacheName: 'spythere-images-cache', - expiration: { - maxEntries: 100, - maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days - }, cacheableResponse: { statuses: [0, 200] }