Zmiany w wyglądzie aplikacji (1.6.0)

This commit is contained in:
2022-04-24 01:01:55 +02:00
parent aefa6627b4
commit 7817cbec71
9 changed files with 77 additions and 63 deletions
+1 -1
View File
@@ -164,7 +164,7 @@
left: 0; left: 0;
right: auto; right: auto;
bottom: 0; bottom: 0.5em;
top: auto; top: auto;
+25 -19
View File
@@ -49,7 +49,7 @@
<script lang="ts"> <script lang="ts">
import { URLs } from '@/scripts/utils/apiURLs'; import { URLs } from '@/scripts/utils/apiURLs';
import axios from 'axios'; import axios from 'axios';
import { defineComponent } from 'vue'; import { defineComponent, inject } from 'vue';
interface DispatcherTimeline { interface DispatcherTimeline {
date: string; date: string;
@@ -99,34 +99,41 @@ export default defineComponent({
}, },
}, },
async mounted() { setup() {
return {
savedSceneryHistory: inject('savedSceneryHistory'),
};
},
async mounted() {
try { try {
const apiResult: HistoryResultAPI = (await axios.get(`${API_URL}?name=${this.name}&historyCount=100`)).data; const apiResult: HistoryResultAPI = (await axios.get(`${API_URL}?name=${this.name}&historyCount=100`)).data;
if (!apiResult || !apiResult.response) return; if (!apiResult || !apiResult.response) return;
this.isLoaded = true; this.isLoaded = true;
if (!apiResult.errorMessage) { if (apiResult.errorMessage) return;
this.dispatcherHistory = apiResult.response.dispatcherHistory;
this.dispatcherTimeline = this.dispatcherHistory this.dispatcherHistory = apiResult.response.dispatcherHistory;
.reduce((acc, dispatcher) => { this.savedSceneryHistory = this.dispatcherHistory;
const dateStr = new Date(dispatcher.dispatcherFrom).toLocaleDateString('pl-PL').replace(/\./g, '/');
const timelineDay = acc.find((timeline) => timeline.date == dateStr) || { this.dispatcherTimeline = this.dispatcherHistory
date: dateStr, .reduce((acc, dispatcher) => {
dispatchers: [], const dateStr = new Date(dispatcher.dispatcherFrom).toLocaleDateString('pl-PL').replace(/\./g, '/');
showTimeline: false,
};
timelineDay.dispatchers.unshift(dispatcher); const timelineDay = acc.find((timeline) => timeline.date == dateStr) || {
date: dateStr,
dispatchers: [],
showTimeline: false,
};
if (!acc.find((timeline) => timeline.date == dateStr)) acc.push(timelineDay); timelineDay.dispatchers.unshift(dispatcher);
return acc; if (!acc.find((timeline) => timeline.date == dateStr)) acc.push(timelineDay);
}, [] as DispatcherTimeline[])
.reverse(); return acc;
} }, [] as DispatcherTimeline[])
.reverse();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@@ -216,7 +223,6 @@ export default defineComponent({
} }
} }
ul { ul {
height: 600px; height: 600px;
overflow-y: scroll; overflow-y: scroll;
+2 -2
View File
@@ -81,8 +81,8 @@ h3.section-header {
.info-lists { .info-lists {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 550px)); grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
justify-content: center; justify-content: space-around;
} }
.badge { .badge {
@@ -3,7 +3,7 @@
<h3 class="user-header section-header"> <h3 class="user-header section-header">
<img :src="icons.user" alt="icon-user" /> <img :src="icons.user" alt="icon-user" />
&nbsp;{{ $t('scenery.users') }} &nbsp; &nbsp;{{ $t('scenery.users') }} &nbsp;
<span class="text--primary">{{ station.onlineInfo?.currentUsers || '0' }}/{{ station.onlineInfo?.maxUsers || '0' }}</span> <span class="text--primary">{{ station.onlineInfo?.currentUsers || '0' }}</span>&nbsp;/&nbsp;<span class="text--primary">{{ station.onlineInfo?.maxUsers || '0' }}</span>
</h3> </h3>
<div <div
@@ -80,7 +80,7 @@ $no-timetable: #aaa;
$departed: springgreen; $departed: springgreen;
$stopped: #ffa600; $stopped: #ffa600;
$online: gold; $online: gold;
$terminated: red; $terminated: salmon;
$disconnected: slategray; $disconnected: slategray;
.info-user-list { .info-user-list {
+27 -20
View File
@@ -62,19 +62,21 @@
<span style="color: white"> <span style="color: white">
{{ scheduledTrain.driverName }} {{ scheduledTrain.driverName }}
</span> </span>
|
<span class="general-status">
<span :class="scheduledTrain.stopStatus">
{{ $t(`timetables.${scheduledTrain.stopStatus}`) }}
<span v-if="scheduledTrain.stopStatus == 'arriving'"> {{ scheduledTrain.prevStationName }}</span>
<span v-if="scheduledTrain.stopStatus.startsWith('departed')">{{
scheduledTrain.nextStationName
}}</span>
</span>
</span>
<div class="info-route"> <div class="info-route">
<strong>{{ scheduledTrain.beginsAt }} - {{ scheduledTrain.terminatesAt }}</strong> <strong>{{ scheduledTrain.beginsAt }} - {{ scheduledTrain.terminatesAt }}</strong>
</div> </div>
</span> </span>
<span class="general-status">
<span :class="scheduledTrain.stopStatus">
{{ $t(`timetables.${scheduledTrain.stopStatus}`) }}
<span v-if="scheduledTrain.stopStatus == 'arriving'">z: {{ scheduledTrain.prevStationName }}</span>
<span v-if="scheduledTrain.stopStatus.startsWith('departed')">do: {{ scheduledTrain.nextStationName }}</span>
</span>
</span>
</span> </span>
<span class="timetable-schedule"> <span class="timetable-schedule">
@@ -255,15 +257,24 @@ export default defineComponent({
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
@import '../../styles/variables.scss'; @import '../../styles/variables.scss';
h3 { h3.timetable-header {
margin: 0.5em 0; margin: 0.5em 0;
padding: 0.3em; padding: 0.3em;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-wrap: wrap;
font-size: 1.5em; font-size: 1.5em;
a {
display: flex;
}
img {
width: 1.2em;
}
} }
.timetable-only { .timetable-only {
@@ -294,18 +305,13 @@ h3 {
} }
.timetable { .timetable {
&-header {
a {
display: flex;
}
}
&-count { &-count {
margin-left: 0.5em; margin-left: 0.5em;
} }
&-item { &-item {
margin: 1em auto; margin: 1em auto;
max-width: 1100px;
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
@@ -433,11 +439,10 @@ h3 {
} }
.general-status { .general-status {
margin-left: 1em;
text-align: right; text-align: right;
span.arriving { span.arriving {
color: #aaa; color: #ccc;
} }
span.departed { span.departed {
@@ -446,7 +451,7 @@ h3 {
&-away { &-away {
font-weight: bold; font-weight: bold;
color: rgb(0, 155, 0); color: #5ecc5e;
} }
} }
@@ -460,7 +465,7 @@ h3 {
} }
span.terminated { span.terminated {
color: #e00000; color: salmon;
font-weight: bold; font-weight: bold;
} }
} }
@@ -477,12 +482,14 @@ h3 {
} }
&-stop { &-stop {
position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.stop-time { .stop-time {
font-size: 0.85em; font-size: 0.85em;
margin: 0.5em 0; // position: absolute;
transform: translateY(-0.25em);
} }
} }
} }
+10 -11
View File
@@ -3,17 +3,17 @@
<section> <section>
<span> <span>
<div> <div>
<span class="timetable_warnings"> <span>
<span class="warning twr" v-if="train.timetableData?.TWR">TWR</span> <span class="timetable_warnings">
<span class="warning twr" v-if="train.timetableData?.TWR">TWR</span>
<span class="warning skr" v-if="train.timetableData?.SKR">SKR</span> <span class="warning skr" v-if="train.timetableData?.SKR">SKR</span>
</span>
<strong v-if="train.timetableData">{{ train.timetableData.category }}&nbsp;</strong>
<strong>{{ train.trainNo }}</strong>
<span>&nbsp;| {{ train.driverName }}</span>
</span> </span>
<strong v-if="train.timetableData">{{ train.timetableData.category }}&nbsp;</strong> <img class="image-offline" style="height: 1em" v-if="!train.currentStationHash" :src="icons.offline" alt="offline"
<strong>{{ train.trainNo }}</strong>
<span>&nbsp;| {{ train.driverName }}</span>
<img class="image-offline" v-if="!train.currentStationHash" :src="icons.offline" alt="offline"
:title="$t('trains.offline')" :title="$t('trains.offline')"
> >
</div> </div>
@@ -117,10 +117,9 @@ export default defineComponent({
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
.image-warning, .image-offline { .image-warning, .image-offline {
width: 1em;
height: 1em; height: 1em;
margin-left: 0.25em; margin-left: 0.5em;
} }
.train-image { .train-image {
+3 -3
View File
@@ -208,9 +208,9 @@
"timetables": { "timetables": {
"timetable-only": "Switch to timetable-only view", "timetable-only": "Switch to timetable-only view",
"online": "At station", "online": "At station",
"departed": "Dispatched", "departed": "Dispatched to:",
"departed-away": "Departed", "departed-away": "Departed to:",
"arriving": "En route", "arriving": "Arriving from:",
"stopped": "Stopped", "stopped": "Stopped",
"terminated": "Terminated", "terminated": "Terminated",
"begins": "BEGINS HERE", "begins": "BEGINS HERE",
+3 -3
View File
@@ -210,9 +210,9 @@
"timetables": { "timetables": {
"timetable-only": "Wyodrębnij rozkłady jazdy", "timetable-only": "Wyodrębnij rozkłady jazdy",
"online": "Na stacji", "online": "Na stacji",
"departed": "Odprawiony", "departed": "Odprawiony do:",
"departed-away": "Odjechał", "departed-away": "Odjechał do:",
"arriving": "W drodze", "arriving": "W drodze z:",
"stopped": "Postój", "stopped": "Postój",
"terminated": "Skończył bieg", "terminated": "Skończył bieg",
"begins": "ROZPOCZYNA\nBIEG", "begins": "ROZPOCZYNA\nBIEG",
+4 -2
View File
@@ -47,7 +47,6 @@
<script lang="ts"> <script lang="ts">
import { StoreData } from '@/scripts/interfaces/StoreData'; import { StoreData } from '@/scripts/interfaces/StoreData';
import { DataStatus } from '@/scripts/enums/DataStatus';
import SceneryInfo from '@/components/SceneryView/SceneryInfo.vue'; import SceneryInfo from '@/components/SceneryView/SceneryInfo.vue';
import SceneryTimetable from '@/components/SceneryView/SceneryTimetable.vue'; import SceneryTimetable from '@/components/SceneryView/SceneryTimetable.vue';
@@ -56,7 +55,7 @@ import SceneryHeader from '@/components/SceneryView/SceneryHeader.vue';
import ActionButton from '@/components/Global/ActionButton.vue'; import ActionButton from '@/components/Global/ActionButton.vue';
import { computed, ComputedRef, defineComponent, onMounted } from '@vue/runtime-core'; import { computed, ComputedRef, defineComponent, provide, reactive } from '@vue/runtime-core';
import { useStore } from '@/store'; import { useStore } from '@/store';
import { GETTERS } from '@/constants/storeConstants'; import { GETTERS } from '@/constants/storeConstants';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@@ -85,6 +84,7 @@ export default defineComponent({
const route = useRoute(); const route = useRoute();
const store = useStore(); const store = useStore();
const savedSceneryHistory = reactive({});
const data: ComputedRef<StoreData> = computed(() => store.getters[GETTERS.allData]); const data: ComputedRef<StoreData> = computed(() => store.getters[GETTERS.allData]);
const timetableOnly = computed(() => (route.query['timetable_only'] == '1' ? true : false)); const timetableOnly = computed(() => (route.query['timetable_only'] == '1' ? true : false));
@@ -97,6 +97,8 @@ export default defineComponent({
); );
}); });
provide('savedSceneryHistory', savedSceneryHistory);
// const onlineFrom = computed(async () => { // const onlineFrom = computed(async () => {
// return await (await axios.get(`${URLs.stacjownikAPI}?name=${route.query.station}&historyCount=0`)).data; // return await (await axios.get(`${URLs.stacjownikAPI}?name=${route.query.station}&historyCount=0`)).data;
// }); // });