From ffb08696e2ed38fcc5a757662f445d175751a5a2 Mon Sep 17 00:00:00 2001 From: Spythere Date: Thu, 23 Sep 2021 19:33:24 +0200 Subject: [PATCH] =?UTF-8?q?Poprawki=20do=20zmiany=20serwer=C3=B3w=20TD2,?= =?UTF-8?q?=20og=C3=B3lne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 24 +--------- .../StationsView/StationFilterCard.vue | 44 ++++++++++--------- src/components/StationsView/StationTable.vue | 31 +++++++------ src/constants/storeConstants.ts | 1 + src/store/index.ts | 8 +++- 5 files changed, 49 insertions(+), 59 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7122bce..84fb1d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -89,14 +89,7 @@ import Clock from "@/components/App/Clock.vue"; import StorageManager from "@/scripts/managers/storageManager"; -import { - computed, - ComputedRef, - defineComponent, - inject, - provide, - ref, -} from "vue"; +import { computed, ComputedRef, defineComponent, provide, ref } from "vue"; import { GETTERS } from "./constants/storeConstants"; import { StoreData } from "./scripts/interfaces/StoreData"; import { useStore } from "./store"; @@ -191,21 +184,6 @@ export default defineComponent({ this.changeLang("en"); return; } - - // if (naviLanguage.includes("pl")) { - // this.changeLang("pl"); - // return; - // } - - // switch (window.navigator.language) { - // case "pl-PL": - // this.changeLang("pl"); - // break; - // case "en-EN": - // default: - // this.changeLang("en"); - // break; - // } }, }, }); diff --git a/src/components/StationsView/StationFilterCard.vue b/src/components/StationsView/StationFilterCard.vue index 82ac7ba..a786520 100644 --- a/src/components/StationsView/StationFilterCard.vue +++ b/src/components/StationsView/StationFilterCard.vue @@ -14,26 +14,28 @@
{{ $t("filters.title") }}
- -
@@ -97,7 +99,7 @@ import { ACTIONS, GETTERS, MUTATIONS } from "@/constants/storeConstants"; import inputData from "@/data/options.json"; import StorageManager from "@/scripts/managers/storageManager"; -import { defineComponent, inject, provide, ref } from "@vue/runtime-core"; +import { defineComponent, inject } from "@vue/runtime-core"; import ActionButton from "../Global/ActionButton.vue"; import FilterOption from "./FilterOption.vue"; @@ -155,6 +157,8 @@ export default defineComponent({ handleChangeRegion() { this.$store.commit(MUTATIONS.SET_REGION, this.currentRegion); this.$store.dispatch(ACTIONS.fetchOnlineData); + + this.closeCard(); }, invertFilters() { diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index 2e83ac4..3885083 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -80,8 +80,8 @@ - {{ $t(`status.${station.statusID}`) }} + + {{ $t(`status.${station.statusID}`) }} {{ station.statusID == "online" ? station.statusTimeString : "" }} @@ -96,10 +96,9 @@ {{ - 2 > station.dispatcherExp ? "L" : station.dispatcherExp - }} + {{ 2 > station.dispatcherExp ? "L" : station.dispatcherExp }} + @@ -198,15 +197,19 @@ class="station_schedules" :class="{ inactive: !station.online }" > - - {{ station.scheduledTrains.length }} + + + {{ station.scheduledTrains.length }} + + / + + {{ + station.scheduledTrains.filter( + (train) => train.stopInfo.confirmed + ).length + }} + - / - {{ - station.scheduledTrains.filter( - (train) => train.stopInfo.confirmed - ).length - }} @@ -217,7 +220,7 @@ {{ $t("sceneries.no-stations") }} -
+
{{ $t("app.loading") }}
diff --git a/src/constants/storeConstants.ts b/src/constants/storeConstants.ts index af4fa69..dbe6db2 100644 --- a/src/constants/storeConstants.ts +++ b/src/constants/storeConstants.ts @@ -7,6 +7,7 @@ export const ACTIONS = { export const MUTATIONS = { SET_SCENERY_DATA: "SET_SCENERY_DATA", SET_SCENERY_DATA_STATUS: "SET_SCENERY_DATA_STATUS", + SET_TIMETABLE_DATA_STATUS: "SET_TIMETABLE_DATA_STATUS", SET_DATA_CONNECTION_STATUS: "SET_DATA_CONNECTION_STATUS", SET_REGION: "SET_REGION", UPDATE_STATIONS: "UPDATE_STATIONS", diff --git a/src/store/index.ts b/src/store/index.ts index ab087e2..bc88e19 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -90,7 +90,7 @@ export const store = createStore({ }, async fetchOnlineData({ commit, dispatch }) { - // commit(MUTATIONS.SET_DATA_CONNECTION_STATUS, DataStatus.Loading); + commit(MUTATIONS.SET_DATA_CONNECTION_STATUS, DataStatus.Loading); Promise.all([axios.get(URLs.stations), axios.get(URLs.trains), axios.get(URLs.dispatchers)]) .then(async response => { @@ -297,6 +297,10 @@ export const store = createStore({ state.dataConnectionStatus = status; }, + SET_TIMETABLE_DATA_STATUS(state, status: DataStatus) { + state.timetableDataStatus = status; + }, + SET_REGION(state, region: { id: string; value: string }) { state.region = region; }, @@ -457,7 +461,7 @@ export const store = createStore({ return acc; }, [] as Train[]); - state.timetableDataStatus = DataStatus.Loaded; + state.timetableDataStatus = DataStatus.Loaded; } } })