poprawki miniatur

This commit is contained in:
2023-10-02 22:05:54 +02:00
parent 4ac054e947
commit 85a1a0216e
11 changed files with 106 additions and 15992 deletions
+4
View File
@@ -31,7 +31,11 @@ node_modules
.firebase .firebase
.firebaserc .firebaserc
# Env
.env .env
# Mock data
mockWebsocketData.json
.fake .fake
.ionide .ionide
Binary file not shown.

Before

Width:  |  Height:  |  Size: 953 B

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

+35 -25
View File
@@ -1,22 +1,37 @@
<template> <template>
<div class="thumbnail-wrapper"> <img class="train-thumbnail" :src="placeholderUrl" v-if="!isLoaded || isNotFound" />
<img :src="placeholderUrl" v-if="!isLoaded || isNotFound" />
<img <img
v-show="isLoaded" class="train-thumbnail"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}${stockType == 'loco-ezt' ? 'rb' : ''}.png`" v-if="!isNotFound"
@error="onImageError" v-show="isLoaded"
@load="onImageLoad" :src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}${stockType == 'loco-ezt' ? 'rb' : ''}.png`"
width="220" @error="onImageError"
height="60" @load="onImageLoad"
/> width="220"
height="60"
/>
<!-- Handling członów EZT --> <!-- Handling członów EZT -->
<img v-if="!onlyFirstSegment && isLoaded && /^EN/.test(name)" :src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}s.png`" /> <img
<img v-if="!onlyFirstSegment && isLoaded && /^EN71/.test(name)" :src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}s.png`" /> class="train-thumbnail"
<img v-if="!onlyFirstSegment && isLoaded && /^EN/.test(name)" :src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}ra.png`" /> v-if="!onlyFirstSegment && isLoaded && /^EN/.test(name)"
<img v-if="!onlyFirstSegment && !isLoaded && /^2EN/.test(name)" :src="placeholderUrl" /> :src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}s.png`"
</div> />
<img
class="train-thumbnail"
v-if="!onlyFirstSegment && isLoaded && /^EN71/.test(name)"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}s.png`"
/>
<img
class="train-thumbnail"
v-if="!onlyFirstSegment && isLoaded && /^EN/.test(name)"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${name.split(':')[0]}ra.png`"
/>
<img class="train-thumbnail" v-if="!onlyFirstSegment && !isLoaded && /^2EN/.test(name)" :src="placeholderUrl" />
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -58,12 +73,12 @@ export default defineComponent({
}, },
stockType() { stockType() {
if (!this.store.rollingStockData) return 'unknown'; if (!this.store.rollingStockData) return 'vehicle-unknown';
return ( return (
Object.keys(this.store.rollingStockData.info).find((type) => { Object.keys(this.store.rollingStockData.info).find((type) => {
return this.store.rollingStockData?.info[type as keyof RollingStockInfo].find((v) => v[0] === this.name.split(':')[0]); return this.store.rollingStockData?.info[type as keyof RollingStockInfo].find((v) => v[0] === this.name.split(':')[0]);
}) || 'unknown' }) || 'vehicle-unknown'
); );
}, },
}, },
@@ -83,14 +98,9 @@ export default defineComponent({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.thumbnail-wrapper { .train-thumbnail {
display: flex;
justify-content: center;
align-items: baseline;
}
img {
width: auto; width: auto;
height: auto; height: auto;
max-height: 60px;
} }
</style> </style>
@@ -17,12 +17,18 @@
<span class="badge"> <span class="badge">
<span>{{ $t('journal.stock-length') }}</span> <span>{{ $t('journal.stock-length') }}</span>
<span> {{ currentHistoryIndex == 0 ? timetable.stockLength : stockHistory[currentHistoryIndex].stockLength || timetable.stockLength }}m </span> <span>
{{ currentHistoryIndex == 0 ? timetable.stockLength : stockHistory[currentHistoryIndex].stockLength || timetable.stockLength }}m
</span>
</span> </span>
<span class="badge"> <span class="badge">
<span>{{ $t('journal.stock-mass') }}</span> <span>{{ $t('journal.stock-mass') }}</span>
<span> {{ Math.floor((currentHistoryIndex == 0 ? timetable.stockMass! : stockHistory[currentHistoryIndex].stockMass || timetable.stockMass) / 1000) }}t </span> <span>
{{
Math.floor((currentHistoryIndex == 0 ? timetable.stockMass! : stockHistory[currentHistoryIndex].stockMass || timetable.stockMass) / 1000)
}}t
</span>
</span> </span>
</div> </div>
@@ -34,9 +40,9 @@
</div> </div>
<ul class="stock-list"> <ul class="stock-list">
<li v-for="(car, i) in (currentHistoryIndex == 0 ? timetable.stockString : stockHistory[currentHistoryIndex].stockString).split(';')" :key="i"> <li v-for="(stockName, i) in (currentHistoryIndex == 0 ? timetable.stockString : stockHistory[currentHistoryIndex].stockString).split(';')" :key="i">
<TrainThumbnail :name="car" /> <TrainThumbnail :name="stockName" />
<div>{{ car.replace(/_/g, ' ').split(':')[0] }}</div> <div>{{ stockName.split(':')[0].split('_').splice(0, 2).join(' ') }} {{ stockName.split(':')[1] }}</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -146,6 +152,5 @@ ul.stock-list {
color: #aaa; color: #aaa;
font-size: 0.9em; font-size: 0.9em;
} }
} }
</style> </style>
+7 -19
View File
@@ -2,7 +2,7 @@
<div class="scenery-info"> <div class="scenery-info">
<section v-if="!timetableOnly"> <section v-if="!timetableOnly">
<div class="scenery-info-general" v-if="station.generalInfo"> <div class="scenery-info-general" v-if="station.generalInfo">
<scenery-info-icons :station="station" /> <SceneryInfoIcons :station="station" />
<div class="scenery-general-list"> <div class="scenery-general-list">
<span> <span>
@@ -26,28 +26,16 @@
</span> </span>
<span v-if="station.generalInfo.project"> <span v-if="station.generalInfo.project">
&bull; <b>{{ $t('scenery.project-title') }}: </b> &bull; <b>{{ $t('scenery.project-title') }}: </b>
<a <a style="color: salmon; text-decoration: underline; font-weight: bold" :href="station.generalInfo.projectUrl" target="_blank">
style="color: salmon; text-decoration: underline; font-weight: bold"
:href="station.generalInfo.projectUrl"
target="_blank"
>
{{ station.generalInfo.project }} {{ station.generalInfo.project }}
</a> </a>
</span> </span>
</div> </div>
<scenery-info-routes :station="station" /> <SceneryInfoRoutes :station="station" />
<div class="scenery-authors" v-if="station.generalInfo.authors && station.generalInfo.authors.length > 0"> <div class="scenery-authors" v-if="station.generalInfo.authors && station.generalInfo.authors.length > 0">
<b> <b> {{ $t('scenery.authors-title', { authors: station.generalInfo.authors.length }, station.generalInfo.authors.length) }}: </b>
{{
$t(
'scenery.authors-title',
{ authors: station.generalInfo.authors.length },
station.generalInfo.authors.length
)
}}:
</b>
{{ station.generalInfo.authors.join(', ') }} {{ station.generalInfo.authors.join(', ') }}
</div> </div>
</div> </div>
@@ -55,14 +43,14 @@
<div style="margin: 2em 0; height: 2px; background-color: white"></div> <div style="margin: 2em 0; height: 2px; background-color: white"></div>
<!-- info dispatcher --> <!-- info dispatcher -->
<scenery-info-dispatcher :station="station" :onlineFrom="onlineFrom" /> <SceneryInfoDispatcher :station="station" :onlineFrom="onlineFrom" />
<div class="info-lists"> <div class="info-lists">
<!-- user list --> <!-- user list -->
<scenery-info-user-list :station="station" /> <SceneryInfoUserList :station="station" />
<!-- spawn list --> <!-- spawn list -->
<scenery-info-spawn-list :station="station" /> <SceneryInfoSpawnList :station="station" />
</div> </div>
</section> </section>
</div> </div>
+33 -41
View File
@@ -14,19 +14,11 @@
</span> </span>
<span class="header_links"> <span class="header_links">
<a <a :href="`https://pragotron-td2.web.app/board?name=${station.name}`" target="_blank" :title="$t('scenery.pragotron-link')">
:href="`https://pragotron-td2.web.app/board?name=${station.name}`"
target="_blank"
:title="$t('scenery.pragotron-link')"
>
<img :src="getIcon('pragotron')" alt="icon-pragotron" /> <img :src="getIcon('pragotron')" alt="icon-pragotron" />
</a> </a>
<a <a :href="tabliceZbiorczeHref" target="_blank" :title="$t('scenery.tablice-link')">
:href="`https://tablice-td2.web.app/?station=${station.name}`"
target="_blank"
:title="$t('scenery.tablice-link')"
>
<img :src="getIcon('tablice', 'ico')" alt="icon-tablice" /> <img :src="getIcon('tablice', 'ico')" alt="icon-tablice" />
</a> </a>
</span> </span>
@@ -39,8 +31,8 @@
<button <button
:key="cp.checkpointName" :key="cp.checkpointName"
class="checkpoint_item" class="checkpoint_item"
:class="{ current: selectedCheckpoint === cp.checkpointName }" :class="{ current: chosenCheckpoint === cp.checkpointName }"
@click="selectCheckpoint(cp)" @click="setCheckpoint(cp)"
> >
{{ cp.checkpointName }} {{ cp.checkpointName }}
</button> </button>
@@ -106,15 +98,12 @@
</div> </div>
<div v-else> <div v-else>
<div> <div>
<s style="margin-right: 0.2em" class="text--grayed">{{ <s style="margin-right: 0.2em" class="text--grayed">{{ timestampToString(scheduledTrain.stopInfo.arrivalTimestamp) }}</s>
timestampToString(scheduledTrain.stopInfo.arrivalTimestamp)
}}</s>
</div> </div>
<span> <span>
{{ timestampToString(scheduledTrain.stopInfo.arrivalRealTimestamp) }} {{ timestampToString(scheduledTrain.stopInfo.arrivalRealTimestamp) }}
({{ scheduledTrain.stopInfo.arrivalDelay > 0 ? '+' : '' ({{ scheduledTrain.stopInfo.arrivalDelay > 0 ? '+' : '' }}{{ scheduledTrain.stopInfo.arrivalDelay }})
}}{{ scheduledTrain.stopInfo.arrivalDelay }})
</span> </span>
</div> </div>
</span> </span>
@@ -146,15 +135,12 @@
</div> </div>
<div v-else> <div v-else>
<div> <div>
<s style="margin-right: 0.2em" class="text--grayed">{{ <s style="margin-right: 0.2em" class="text--grayed">{{ timestampToString(scheduledTrain.stopInfo.departureTimestamp) }}</s>
timestampToString(scheduledTrain.stopInfo.departureTimestamp)
}}</s>
</div> </div>
<span> <span>
{{ timestampToString(scheduledTrain.stopInfo.departureRealTimestamp) }} {{ timestampToString(scheduledTrain.stopInfo.departureRealTimestamp) }}
({{ scheduledTrain.stopInfo.departureDelay > 0 ? '+' : '' ({{ scheduledTrain.stopInfo.departureDelay > 0 ? '+' : '' }}{{ scheduledTrain.stopInfo.departureDelay }})
}}{{ scheduledTrain.stopInfo.departureDelay }})
</span> </span>
</div> </div>
</span> </span>
@@ -203,16 +189,22 @@ export default defineComponent({
listOpen: false, listOpen: false,
}), }),
mounted() {
this.loadSelectedOption();
},
activated() {
this.loadSelectedOption();
},
setup(props) { setup(props) {
const route = useRoute(); const route = useRoute();
const currentURL = computed(() => `${location.origin}${route.fullPath}`); const currentURL = computed(() => `${location.origin}${route.fullPath}`);
const store = useStore(); const store = useStore();
const selectedCheckpoint = ref( const chosenCheckpoint = ref(
props.station?.generalInfo?.checkpoints?.length == 0 props.station?.generalInfo?.checkpoints?.length == 0 ? '' : props.station?.generalInfo?.checkpoints[0].checkpointName || null
? ''
: props.station?.generalInfo?.checkpoints[0].checkpointName || ''
); );
const computedScheduledTrains = computed(() => { const computedScheduledTrains = computed(() => {
@@ -221,8 +213,7 @@ export default defineComponent({
const station = props.station as Station; const station = props.station as Station;
let scheduledTrains = let scheduledTrains =
station.generalInfo?.checkpoints.find((cp) => cp.checkpointName === selectedCheckpoint.value) station.generalInfo?.checkpoints.find((cp) => cp.checkpointName === chosenCheckpoint.value)?.scheduledTrains ||
?.scheduledTrains ||
station.onlineInfo?.scheduledTrains || station.onlineInfo?.scheduledTrains ||
[]; [];
@@ -243,12 +234,21 @@ export default defineComponent({
return { return {
currentURL, currentURL,
selectedCheckpoint, chosenCheckpoint,
computedScheduledTrains, computedScheduledTrains,
store, store,
}; };
}, },
computed: {
tabliceZbiorczeHref() {
let url = `https://tablice-td2.web.app/?station=${this.station.name}`;
if (this.chosenCheckpoint) url += `&checkpoint=${this.chosenCheckpoint}`;
return url;
},
},
methods: { methods: {
loadSelectedOption() { loadSelectedOption() {
if (!this.station) return; if (!this.station) return;
@@ -256,27 +256,19 @@ export default defineComponent({
if (!this.station.generalInfo.checkpoints) return; if (!this.station.generalInfo.checkpoints) return;
if (this.station.generalInfo.checkpoints.length == 0) return; if (this.station.generalInfo.checkpoints.length == 0) return;
if (this.selectedCheckpoint != '') return; if (this.chosenCheckpoint != '') return;
this.selectedCheckpoint = this.station.generalInfo.checkpoints[0].checkpointName; this.chosenCheckpoint = this.station.generalInfo.checkpoints[0].checkpointName;
}, },
selectCheckpoint(cp: { checkpointName: string }) { setCheckpoint(cp: { checkpointName: string }) {
this.selectedCheckpoint = cp.checkpointName; this.chosenCheckpoint = cp.checkpointName;
}, },
showTimetableOnlyView() { showTimetableOnlyView() {
this.$router.push(`${this.$route.fullPath}&timetableOnly=1`); this.$router.push(`${this.$route.fullPath}&timetableOnly=1`);
}, },
}, },
mounted() {
this.loadSelectedOption();
},
activated() {
this.loadSelectedOption();
},
}); });
</script> </script>
+8 -4
View File
@@ -107,7 +107,14 @@ export default defineComponent({
}); });
</script> </script>
<!-- Global style for TrainThumbnail -->
<style lang="scss"> <style lang="scss">
.train-stats .train-thumbnail {
max-width: 100%;
}
</style>
<style lang="scss" scoped>
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
@import '../../styles/badge.scss'; @import '../../styles/badge.scss';
@@ -120,15 +127,12 @@ export default defineComponent({
.train-stats { .train-stats {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
gap: 0.25em; gap: 0.25em;
img {
max-width: 100%;
}
} }
.train-info { .train-info {
+7 -34
View File
@@ -2,35 +2,9 @@
<div class="train-schedule" @click="toggleShowState"> <div class="train-schedule" @click="toggleShowState">
<div class="train-stock"> <div class="train-stock">
<ul class="stock-list"> <ul class="stock-list">
<!-- <li>
<img class="train-image" :src="train.locoURL" alt="loco" @error="onImageError" />
<div>{{ train.locoType }}</div>
</li> -->
<!-- <li v-if="train.locoType.startsWith('EN')">
<img :src="train.locoURL.replace('rb', 's')" @error="onImageError" alt="" />
<div>{{ train.locoType }}S</div>
</li>
<li v-if="train.locoType.startsWith('EN71')">
<img :src="train.locoURL.replace('rb', 's')" @error="onImageError" alt="" />
<div>{{ train.locoType }}S</div>
</li>
<li v-if="train.locoType.startsWith('EN')">
<img :src="train.locoURL.replace('rb', 'ra')" @error="onImageError" alt="" />
<div>{{ train.locoType }}RA</div>
</li> -->
<li v-for="(stockName, i) in train.stockList" :key="i"> <li v-for="(stockName, i) in train.stockList" :key="i">
<!-- <img
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${car.split(':')[0]}.png`"
@error="onImageError"
alt="car"
/> -->
<TrainThumbnail :name="stockName" /> <TrainThumbnail :name="stockName" />
<div>{{ stockName.replace(/_/g, ' ').split(':')[0] }}</div> <p>{{ stockName.split(':')[0].split('_').splice(0, 2).join(' ') }} {{ stockName.split(':')[1] }}</p>
</li> </li>
</ul> </ul>
</div> </div>
@@ -61,9 +35,7 @@
<b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span> <b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span>
</div> </div>
<span <span v-if="stop.departureLine == train.timetableData!.followingStops[i + 1].arrivalLine && !/sbl/gi.test(stop.departureLine!)">
v-if="stop.departureLine == train.timetableData!.followingStops[i + 1].arrivalLine && !/sbl/gi.test(stop.departureLine!)"
>
{{ stop.departureLine }} {{ stop.departureLine }}
</span> </span>
@@ -147,8 +119,7 @@ export default defineComponent({
end: stop.terminatesHere, end: stop.terminatesHere,
delayed: stop.departureDelay > 0, delayed: stop.departureDelay > 0,
sbl: /sbl/gi.test(stop.stopName), sbl: /sbl/gi.test(stop.stopName),
[stop.stopType.replaceAll(', ', '-')]: [stop.stopType.replaceAll(', ', '-')]: stop.stopType.match(new RegExp('ph|pm|pt')) && !stop.confirmed && !stop.beginsHere,
stop.stopType.match(new RegExp('ph|pm|pt')) && !stop.confirmed && !stop.beginsHere,
'minor-stop-active': this.activeMinorStops.includes(index), 'minor-stop-active': this.activeMinorStops.includes(index),
'last-confirmed': index == this.lastConfirmed && !stop.terminatesHere, 'last-confirmed': index == this.lastConfirmed && !stop.terminatesHere,
}; };
@@ -194,16 +165,18 @@ ul.stock-list {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
overflow: auto; overflow: auto;
padding-bottom: 1em; padding-bottom: 1em;
li > div { li > p {
text-align: center; text-align: center;
color: #aaa; color: #aaa;
font-size: 0.9em; font-size: 0.9em;
margin-top: 0.5em;
} }
img { img {
max-height: 60px; height: 60px;
} }
} }
File diff suppressed because it is too large Load Diff
+1
View File
@@ -45,6 +45,7 @@ import { computed, defineComponent, PropType } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import routerMixin from '../mixins/routerMixin'; import routerMixin from '../mixins/routerMixin';
import { useStore } from '../store/store'; import { useStore } from '../store/store';
import SceneryInfo from '../components/SceneryView/SceneryInfo.vue'; import SceneryInfo from '../components/SceneryView/SceneryInfo.vue';
import SceneryHeader from '../components/SceneryView/SceneryHeader.vue'; import SceneryHeader from '../components/SceneryView/SceneryHeader.vue';
import SceneryTimetable from '../components/SceneryView/SceneryTimetable.vue'; import SceneryTimetable from '../components/SceneryView/SceneryTimetable.vue';