mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1723a1b0bd | |||
| 86ba9112de | |||
| cd41e46ef5 | |||
| 32d5f0269b | |||
| 1750e406e0 | |||
| 7457d59dea | |||
| 2578f5c8d4 | |||
| 6af6764c30 | |||
| 50102c6127 | |||
| 210c49fb04 | |||
| bc3db163b1 | |||
| b364586ebc | |||
| f3509ef217 | |||
| d584d99f4c | |||
| 078c941910 | |||
| 76670ceb29 | |||
| 4cdd8ea06a | |||
| 454ae138f7 | |||
| 640c5e262b | |||
| 7416d7d59f |
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pojazdownik",
|
"name": "pojazdownik",
|
||||||
"version": "1.8.5",
|
"version": "1.8.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "yarn build && vite preview --port 4174",
|
"preview": "yarn build && vite preview",
|
||||||
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
||||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||||
"format": "prettier --write src/"
|
"format": "prettier --write src/"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<div class="thumbnail-container">
|
<div class="thumbnail-container">
|
||||||
<div>{{ stockType }}</div>
|
<div>{{ stockType }}</div>
|
||||||
<img
|
<img
|
||||||
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stockType}.png`"
|
:src="`https://static.spythere.eu/thumbnails/${stockType}.png`"
|
||||||
:title="stockType"
|
:title="stockType"
|
||||||
style="opacity: 0"
|
style="opacity: 0"
|
||||||
@error="(e) => onStockItemError(e, stockType)"
|
@error="(e) => onStockItemError(e, stockType)"
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="train-image-section">
|
<section class="train-image-section">
|
||||||
<div v-if="store.chosenVehicle">
|
<div v-if="store.chosenVehicle">
|
||||||
<img
|
<div class="image-wrapper">
|
||||||
:src="getThumbnailURL(store.chosenVehicle.type, 'small')"
|
<img
|
||||||
:data-preview-active="store.chosenVehicle !== null"
|
:src="getThumbnailURL(store.chosenVehicle.type, 'small')"
|
||||||
:data-sponsor-only="
|
:data-preview-active="store.chosenVehicle !== null"
|
||||||
store.chosenVehicle.sponsorOnlyTimestamp &&
|
:data-sponsor-only="
|
||||||
store.chosenVehicle.sponsorOnlyTimestamp > Date.now()
|
store.chosenVehicle.sponsorOnlyTimestamp &&
|
||||||
"
|
store.chosenVehicle.sponsorOnlyTimestamp > Date.now()
|
||||||
:data-team-only="store.chosenVehicle.teamOnly"
|
"
|
||||||
@click="onImageClick"
|
:data-team-only="store.chosenVehicle.teamOnly"
|
||||||
@keydown.enter="onImageClick"
|
@click="onImageClick"
|
||||||
@error="onImageError"
|
@keydown.enter="onImageClick"
|
||||||
tabindex="0"
|
@load="onImageLoad"
|
||||||
/>
|
@error="onImageError"
|
||||||
|
tabindex="0"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="image-info">
|
<div class="image-info">
|
||||||
<b class="text--accent">{{ store.chosenVehicle.type }}</b> •
|
<b class="text--accent">{{ store.chosenVehicle.type }}</b> •
|
||||||
@@ -77,6 +80,10 @@ import { computed, defineComponent } from 'vue';
|
|||||||
import { useStore } from '../../store';
|
import { useStore } from '../../store';
|
||||||
import { isTractionUnit } from '../../utils/vehicleUtils';
|
import { isTractionUnit } from '../../utils/vehicleUtils';
|
||||||
import imageMixin from '../../mixins/imageMixin';
|
import imageMixin from '../../mixins/imageMixin';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { Ref } from 'vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
mixins: [imageMixin],
|
mixins: [imageMixin],
|
||||||
@@ -89,9 +96,17 @@ export default defineComponent({
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
const { chosenVehicle } = storeToRefs(store);
|
||||||
|
|
||||||
|
const imageStatus = ref('none') as Ref<'none' | 'loading' | 'loaded' | 'error'>;
|
||||||
|
|
||||||
|
watch(chosenVehicle, () => {
|
||||||
|
imageStatus.value = 'loading';
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
store,
|
store,
|
||||||
|
imageStatus,
|
||||||
chosenVehicle: computed(() => store.chosenVehicle),
|
chosenVehicle: computed(() => store.chosenVehicle),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -104,6 +119,11 @@ export default defineComponent({
|
|||||||
if (el.src == '/images/placeholder.jpg') return;
|
if (el.src == '/images/placeholder.jpg') return;
|
||||||
|
|
||||||
el.src = '/images/placeholder.jpg';
|
el.src = '/images/placeholder.jpg';
|
||||||
|
this.imageStatus = 'error';
|
||||||
|
},
|
||||||
|
|
||||||
|
onImageLoad(e: Event) {
|
||||||
|
this.imageStatus = 'loaded';
|
||||||
},
|
},
|
||||||
|
|
||||||
onImageClick(e: Event) {
|
onImageClick(e: Event) {
|
||||||
@@ -132,6 +152,7 @@ export default defineComponent({
|
|||||||
min-height: 250px;
|
min-height: 250px;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
|
position: relative;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 380px;
|
width: 380px;
|
||||||
}
|
}
|
||||||
@@ -154,18 +175,25 @@ img {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder {
|
.image-wrapper {
|
||||||
height: 250px;
|
position: relative;
|
||||||
|
min-height: 220px;
|
||||||
background-color: $bgColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sponsor-only {
|
.loading-placeholder {
|
||||||
color: $sponsorColor;
|
position: absolute;
|
||||||
}
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.team-only {
|
display: flex;
|
||||||
color: $teamColor;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
background-color: #2b2b2b;
|
||||||
|
padding: 1em;
|
||||||
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-info {
|
.image-info {
|
||||||
@@ -181,6 +209,20 @@ img {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
height: 250px;
|
||||||
|
|
||||||
|
background-color: $bgColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sponsor-only {
|
||||||
|
color: $sponsorColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.team-only {
|
||||||
|
color: $teamColor;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: $breakpointMd) {
|
@media screen and (max-width: $breakpointMd) {
|
||||||
.train-image-section {
|
.train-image-section {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
<template #href>
|
<template #href>
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://docs.google.com/spreadsheets/d/1KVa5vn2d8XGkXQFwbavVudwKqUQxbLOucHWs2VYqAUE"
|
href="https://docs.google.com/spreadsheets/d/1BvTU-U7huIaEheov22TrhTtROUM4MwVfdbq03GVAEM8"
|
||||||
>
|
>
|
||||||
{{ $t('stocklist.acceptable-mass-docs') }}
|
{{ $t('stocklist.acceptable-mass-docs') }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<img
|
<img
|
||||||
draggable="false"
|
draggable="false"
|
||||||
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stock.vehicleRef.type}.png`"
|
:src="`https://static.spythere.eu/thumbnails/${stock.vehicleRef.type}.png`"
|
||||||
:alt="stock.vehicleRef.type"
|
:alt="stock.vehicleRef.type"
|
||||||
:title="stock.vehicleRef.type"
|
:title="stock.vehicleRef.type"
|
||||||
@error="stockImageError($event, stock)"
|
@error="stockImageError($event, stock)"
|
||||||
|
|||||||
@@ -27,20 +27,8 @@
|
|||||||
},
|
},
|
||||||
"categoriesRules": {
|
"categoriesRules": {
|
||||||
"EI": [null, "00", "99"],
|
"EI": [null, "00", "99"],
|
||||||
"EC": [null, "001", "049"],
|
"EC": [null, "000", "049"],
|
||||||
"EN": [null, "001", "049"],
|
"EN": [null, "000", "049"],
|
||||||
"MP": [null, "050", "169"],
|
|
||||||
"RO": [null, "200", "999"],
|
|
||||||
"RP": [null, "050", "169"],
|
|
||||||
"PW": ["6", "000", "899"],
|
|
||||||
"TK": ["3", "000", "899"],
|
|
||||||
"TM": ["4", "000", "899"],
|
|
||||||
"LT": ["5", "000", "899"]
|
|
||||||
},
|
|
||||||
"categoriesNextVersion": {
|
|
||||||
"EI": [null, "00", "99"],
|
|
||||||
"EC": [null, "001", "049"],
|
|
||||||
"EN": [null, "001", "049"],
|
|
||||||
|
|
||||||
"RO": [null, "200", "999"],
|
"RO": [null, "200", "999"],
|
||||||
"RP": [null, "050", "169"],
|
"RP": [null, "050", "169"],
|
||||||
|
|||||||
@@ -47,6 +47,26 @@
|
|||||||
"cargo": null,
|
"cargo": null,
|
||||||
"none": 160
|
"none": 160
|
||||||
},
|
},
|
||||||
|
"ET22": {
|
||||||
|
"passenger": {
|
||||||
|
"650000": 125
|
||||||
|
},
|
||||||
|
"cargo": {
|
||||||
|
"1200000": 100,
|
||||||
|
"3100000": 70
|
||||||
|
},
|
||||||
|
"none": 125
|
||||||
|
},
|
||||||
|
"201E": {
|
||||||
|
"passenger": {
|
||||||
|
"650000": 125
|
||||||
|
},
|
||||||
|
"cargo": {
|
||||||
|
"1200000": 100,
|
||||||
|
"3100000": 70
|
||||||
|
},
|
||||||
|
"none": 125
|
||||||
|
},
|
||||||
"ET41": {
|
"ET41": {
|
||||||
"passenger": {
|
"passenger": {
|
||||||
"700000": 125
|
"700000": 125
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ export default defineComponent({
|
|||||||
let vehicle: IVehicle | null = null;
|
let vehicle: IVehicle | null = null;
|
||||||
let vehicleCargo: ICargo | null = null;
|
let vehicleCargo: ICargo | null = null;
|
||||||
|
|
||||||
const isTractionUnit = /^(EU|EP|ET|SM|EN|2EN|SN)/.test(type);
|
const isTractionUnit = /^([a-zA-Z\d]{0,}-\d{0,})/.test(type);
|
||||||
|
|
||||||
|
console.log(type, isTractionUnit);
|
||||||
|
|
||||||
if (isTractionUnit) {
|
if (isTractionUnit) {
|
||||||
const [locoType, spawnProps] = type.split(',');
|
const [locoType, spawnProps] = type.split(',');
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ export const useStore = defineStore({
|
|||||||
|
|
||||||
stockSupportsColdStart: (state) => {
|
stockSupportsColdStart: (state) => {
|
||||||
if (state.stockList.length == 0) return false;
|
if (state.stockList.length == 0) return false;
|
||||||
|
|
||||||
if (!isTractionUnit(state.stockList[0].vehicleRef)) return false;
|
if (!isTractionUnit(state.stockList[0].vehicleRef)) return false;
|
||||||
|
else if (state.stockList.length > 1) return false;
|
||||||
|
|
||||||
const headingLoco = state.stockList[0];
|
const headingLoco = state.stockList[0];
|
||||||
|
|
||||||
|
|||||||
+6
-18
@@ -8,6 +8,9 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
port: 2138,
|
port: 2138,
|
||||||
},
|
},
|
||||||
|
preview: {
|
||||||
|
port: 4138,
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
@@ -25,25 +28,10 @@ export default defineConfig({
|
|||||||
|
|
||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
{
|
{
|
||||||
urlPattern: new RegExp('^https://rj.td2.info.pl/dist/img/thumbnails/*', 'i'),
|
urlPattern: /^https:\/\/.*\.spythere\.eu\/.*/i,
|
||||||
handler: 'CacheFirst',
|
handler: 'StaleWhileRevalidate',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'swdr-images-cache',
|
cacheName: 'spythere-cache',
|
||||||
expiration: {
|
|
||||||
maxEntries: 50,
|
|
||||||
maxAgeSeconds: 60 * 60 * 24, // <== 1 day
|
|
||||||
},
|
|
||||||
cacheableResponse: {
|
|
||||||
statuses: [0, 200, 404],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
urlPattern: new RegExp('^https://stacjownik.spythere.eu/vehicles', 'i'),
|
|
||||||
handler: 'NetworkFirst',
|
|
||||||
options: {
|
|
||||||
cacheName: 'vehicles-cache',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user