Aktualizacja scenerii; poprawki

This commit is contained in:
2021-11-17 08:14:02 +01:00
parent 94901bf99b
commit fa64e3e15b
3 changed files with 44 additions and 85 deletions
+40 -81
View File
@@ -4,11 +4,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th <th v-for="(id, i) in headIds" :key="id" @click="() => changeSorter(i)">
v-for="(id, i) in headIds"
:key="id"
@click="() => changeSorter(i)"
>
<span class="header_wrapper"> <span class="header_wrapper">
<div v-html="$t(`sceneries.${id}`)"></div> <div v-html="$t(`sceneries.${id}`)"></div>
@@ -21,17 +17,9 @@
</span> </span>
</th> </th>
<th <th v-for="(id, i) in headIconsIds" :key="id" @click="() => changeSorter(i + 7)">
v-for="(id, i) in headIconsIds"
:key="id"
@click="() => changeSorter(i + 7)"
>
<span class="header_wrapper"> <span class="header_wrapper">
<img <img :src="require(`@/assets/icon-${id}.svg`)" :alt="id" :title="$t(`sceneries.${id}s`)" />
:src="require(`@/assets/icon-${id}.svg`)"
:alt="id"
:title="$t(`sceneries.${id}s`)"
/>
<img <img
class="sort-icon" class="sort-icon"
@@ -63,16 +51,13 @@
</td> </td>
<td class="station_level"> <td class="station_level">
<span <span v-if="station.reqLevel" :style="calculateExpStyle(station.reqLevel, station.supportersOnly)">
v-if="station.reqLevel"
:style="calculateExpStyle(station.reqLevel)"
>
{{ {{
station.reqLevel && Number(station.reqLevel) > -1 station.reqLevel && Number(station.reqLevel) > -1
? Number(station.reqLevel) >= 2 ? Number(station.reqLevel) >= 2
? station.reqLevel ? station.reqLevel
: "L" : 'L'
: "?" : '?'
}} }}
</span> </span>
@@ -82,22 +67,20 @@
<td class="station_status"> <td class="station_status">
<span class="status-badge" :class="station.statusID"> <span class="status-badge" :class="station.statusID">
{{ $t(`status.${station.statusID}`) }} {{ $t(`status.${station.statusID}`) }}
{{ {{ station.statusID == 'online' ? station.statusTimeString : '' }}
station.statusID == "online" ? station.statusTimeString : ""
}}
</span> </span>
</td> </td>
<td class="station_dispatcher-name"> <td class="station_dispatcher-name">
{{ station.online ? station.dispatcherName : "" }} {{ station.online ? station.dispatcherName : '' }}
</td> </td>
<td class="station_dispatcher-exp"> <td class="station_dispatcher-exp">
<span <span
v-if="station.online" v-if="station.online"
:style="calculateExpStyle(station.dispatcherExp)" :style="calculateExpStyle(station.dispatcherExp, station.dispatcherIsSupporter)"
> >
{{ 2 > station.dispatcherExp ? "L" : station.dispatcherExp }} {{ 2 > station.dispatcherExp ? 'L' : station.dispatcherExp }}
</span> </span>
</td> </td>
@@ -143,10 +126,7 @@
v-if="station.controlType" v-if="station.controlType"
:src="require(`@/assets/icon-${station.controlType}.svg`)" :src="require(`@/assets/icon-${station.controlType}.svg`)"
:alt="station.controlType" :alt="station.controlType"
:title=" :title="$t('desc.control-type') + $t(`controls.${station.controlType}`)"
$t('desc.control-type') +
$t(`controls.${station.controlType}`)
"
/> />
<img <img
@@ -154,9 +134,7 @@
v-if="station.signalType" v-if="station.signalType"
:src="require(`@/assets/icon-${station.signalType}.svg`)" :src="require(`@/assets/icon-${station.signalType}.svg`)"
:alt="station.signalType" :alt="station.signalType"
:title=" :title="$t('desc.signals-type') + $t(`signals.${station.signalType}`)"
$t('desc.signals-type') + $t(`signals.${station.signalType}`)
"
/> />
<img <img
@@ -193,21 +171,14 @@
<span class="highlight">{{ station.spawns.length }}</span> <span class="highlight">{{ station.spawns.length }}</span>
</td> </td>
<td <td class="station_schedules" :class="{ inactive: !station.online }">
class="station_schedules"
:class="{ inactive: !station.online }"
>
<span> <span>
<span class="highlight"> <span class="highlight">
{{ station.scheduledTrains.length }} {{ station.scheduledTrains.length }}
</span> </span>
/ /
<span style="color: #bbb"> <span style="color: #bbb">
{{ {{ station.scheduledTrains.filter((train) => train.stopInfo.confirmed).length }}
station.scheduledTrains.filter(
(train) => train.stopInfo.confirmed
).length
}}
</span> </span>
</span> </span>
</td> </td>
@@ -217,23 +188,23 @@
</div> </div>
<div class="no-stations" v-if="isDataLoaded && stations.length == 0"> <div class="no-stations" v-if="isDataLoaded && stations.length == 0">
{{ $t("sceneries.no-stations") }} {{ $t('sceneries.no-stations') }}
</div> </div>
<div class="no-stations" v-if="!isDataLoaded && stations.length == 0"> <div class="no-stations" v-if="!isDataLoaded && stations.length == 0">
{{ $t("app.loading") }} {{ $t('app.loading') }}
</div> </div>
</section> </section>
</template> </template>
<script lang="ts"> <script lang="ts">
import styleMixin from "@/mixins/styleMixin"; import styleMixin from '@/mixins/styleMixin';
import { DataStatus } from "@/scripts/enums/DataStatus"; import { DataStatus } from '@/scripts/enums/DataStatus';
import { computed, ComputedRef, defineComponent } from "@vue/runtime-core"; import { computed, ComputedRef, defineComponent } from '@vue/runtime-core';
import { useStore } from "@/store"; import { useStore } from '@/store';
import { GETTERS } from "@/constants/storeConstants"; import { GETTERS } from '@/constants/storeConstants';
import Station from "@/scripts/interfaces/Station"; import Station from '@/scripts/interfaces/Station';
export default defineComponent({ export default defineComponent({
props: { props: {
@@ -254,37 +225,27 @@ export default defineComponent({
mixins: [styleMixin], mixins: [styleMixin],
data: () => ({ data: () => ({
likeIcon: require("@/assets/icon-like.svg"), likeIcon: require('@/assets/icon-like.svg'),
spawnIcon: require("@/assets/icon-spawn.svg"), spawnIcon: require('@/assets/icon-spawn.svg'),
timetableIcon: require("@/assets/icon-timetable.svg"), timetableIcon: require('@/assets/icon-timetable.svg'),
userIcon: require("@/assets/icon-user.svg"), userIcon: require('@/assets/icon-user.svg'),
trainIcon: require("@/assets/icon-train.svg"), trainIcon: require('@/assets/icon-train.svg'),
SBLIcon: require("@/assets/icon-SBL.svg"), SBLIcon: require('@/assets/icon-SBL.svg'),
lockIcon: require("@/assets/icon-lock.svg"), lockIcon: require('@/assets/icon-lock.svg'),
unavailableIcon: require("@/assets/icon-unavailable.svg"), unavailableIcon: require('@/assets/icon-unavailable.svg'),
ascIcon: require("@/assets/icon-arrow-asc.svg"), ascIcon: require('@/assets/icon-arrow-asc.svg'),
descIcon: require("@/assets/icon-arrow-desc.svg"), descIcon: require('@/assets/icon-arrow-desc.svg'),
headIds: [ headIds: ['station', 'min-lvl', 'status', 'dispatcher', 'dispatcher-lvl', 'routes', 'general'],
"station",
"min-lvl",
"status",
"dispatcher",
"dispatcher-lvl",
"routes",
"general",
],
headIconsIds: ["user", "spawn", "timetable"], headIconsIds: ['user', 'spawn', 'timetable'],
}), }),
setup() { setup() {
const store = useStore(); const store = useStore();
const dataConnectionStatus: ComputedRef<DataStatus> = computed( const dataConnectionStatus: ComputedRef<DataStatus> = computed(() => store.getters[GETTERS.dataStatus]);
() => store.getters[GETTERS.dataStatus]
);
const isDataLoaded = computed(() => { const isDataLoaded = computed(() => {
return dataConnectionStatus.value == DataStatus.Loaded; return dataConnectionStatus.value == DataStatus.Loaded;
@@ -297,15 +258,13 @@ export default defineComponent({
methods: { methods: {
setScenery(name: string) { setScenery(name: string) {
const station = this.stations.find( const station = this.stations.find((station) => station.stationName === name);
(station) => station.stationName === name
);
if (!station) return; if (!station) return;
this.$router.push({ this.$router.push({
name: "SceneryView", name: 'SceneryView',
query: { station: station.stationName.replaceAll(" ", "_") }, query: { station: station.stationName.replaceAll(' ', '_') },
}); });
}, },
}, },
@@ -313,8 +272,8 @@ export default defineComponent({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../styles/responsive.scss"; @import '../../styles/responsive.scss';
@import "../../styles/variables.scss"; @import '../../styles/variables.scss';
$rowCol: #4b4b4b; $rowCol: #4b4b4b;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -62,12 +62,12 @@ const filterStations = (station: Station, filters: Filter) => {
if (station.online && station.statusID == 'ending' && filters['ending']) return returnMode; if (station.online && station.statusID == 'ending' && filters['ending']) return returnMode;
if (station.online if (station.online
&& station.statusTimestamp != 0 && station.statusTimestamp > 0
&& filters['onlineFromHours'] < 8 && filters['onlineFromHours'] < 8
&& station.statusTimestamp <= Date.now() + filters['onlineFromHours'] * 3600000) && station.statusTimestamp <= Date.now() + filters['onlineFromHours'] * 3600000)
return returnMode; return returnMode;
if (filters['onlineFromHours'] > 0 && station.statusTimestamp == 0) return returnMode; if (filters['onlineFromHours'] > 0 && station.statusTimestamp <= 0) return returnMode;
if (filters['onlineFromHours'] == 8 && station.statusID != 'no-limit') return returnMode; if (filters['onlineFromHours'] == 8 && station.statusID != 'no-limit') return returnMode;
if (station.statusID == 'ending' && filters['endingStatus']) return returnMode; if (station.statusID == 'ending' && filters['endingStatus']) return returnMode;