diff --git a/index.html b/index.html index 72b7f45..ad84025 100644 --- a/index.html +++ b/index.html @@ -50,11 +50,6 @@ name="twitter:image" content="https://raw.githubusercontent.com/Spythere/api/main/thumbnails/stacjownik.jpg" /> - -
diff --git a/public/fonts/Quicksand-Bold.woff b/public/fonts/Quicksand-Bold.woff new file mode 100644 index 0000000..5a54b32 Binary files /dev/null and b/public/fonts/Quicksand-Bold.woff differ diff --git a/public/fonts/Quicksand-Bold.woff2 b/public/fonts/Quicksand-Bold.woff2 new file mode 100644 index 0000000..1b79115 Binary files /dev/null and b/public/fonts/Quicksand-Bold.woff2 differ diff --git a/public/fonts/Quicksand-Light.woff b/public/fonts/Quicksand-Light.woff new file mode 100644 index 0000000..1d7ae62 Binary files /dev/null and b/public/fonts/Quicksand-Light.woff differ diff --git a/public/fonts/Quicksand-Light.woff2 b/public/fonts/Quicksand-Light.woff2 new file mode 100644 index 0000000..d1c40d4 Binary files /dev/null and b/public/fonts/Quicksand-Light.woff2 differ diff --git a/public/fonts/Quicksand-Medium.woff b/public/fonts/Quicksand-Medium.woff new file mode 100644 index 0000000..abad4bd Binary files /dev/null and b/public/fonts/Quicksand-Medium.woff differ diff --git a/public/fonts/Quicksand-Medium.woff2 b/public/fonts/Quicksand-Medium.woff2 new file mode 100644 index 0000000..59d67a5 Binary files /dev/null and b/public/fonts/Quicksand-Medium.woff2 differ diff --git a/public/fonts/Quicksand-Regular.woff b/public/fonts/Quicksand-Regular.woff new file mode 100644 index 0000000..dcba3a6 Binary files /dev/null and b/public/fonts/Quicksand-Regular.woff differ diff --git a/public/fonts/Quicksand-Regular.woff2 b/public/fonts/Quicksand-Regular.woff2 new file mode 100644 index 0000000..c6a7188 Binary files /dev/null and b/public/fonts/Quicksand-Regular.woff2 differ diff --git a/public/fonts/Quicksand-SemiBold.woff b/public/fonts/Quicksand-SemiBold.woff new file mode 100644 index 0000000..8316781 Binary files /dev/null and b/public/fonts/Quicksand-SemiBold.woff differ diff --git a/public/fonts/Quicksand-SemiBold.woff2 b/public/fonts/Quicksand-SemiBold.woff2 new file mode 100644 index 0000000..4080c22 Binary files /dev/null and b/public/fonts/Quicksand-SemiBold.woff2 differ diff --git a/src/App.vue b/src/App.vue index e9dab73..cf3a21d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -37,7 +37,6 @@ import { defineComponent, watch } from 'vue'; import Clock from './components/App/Clock.vue'; import packageInfo from '.././package.json'; -import { regions } from './data/options.json'; import { useMainStore } from './store/mainStore'; import StatusIndicator from './components/App/StatusIndicator.vue'; @@ -46,6 +45,7 @@ import AppHeader from './components/App/AppHeader.vue'; import axios from 'axios'; import StorageManager from './managers/storageManager'; import { useApiStore } from './store/apiStore'; +import { Status } from './typings/common'; export default defineComponent({ components: { @@ -66,26 +66,10 @@ export default defineComponent({ }), created() { - this.loadLang(); - this.apiStore.setupAPI(); - - this.store.isOffline = !window.navigator.onLine; - - window.addEventListener('offline', () => { - this.store.isOffline = true; - this.apiStore.activeData = undefined; - - this.apiStore.setDataStatuses(); - }); - - window.addEventListener('online', () => { - this.store.isOffline = false; - }); + this.init(); }, async mounted() { - this.setReleaseURL(); - watch( () => this.store.blockScroll, (value) => { @@ -95,23 +79,39 @@ export default defineComponent({ ); }, - watch: { - '$route.query.region': { - immediate: true, - handler(regionQuery: string) { - if (regionQuery) { - this.store.region.id = - regions.find( - (reg) => - reg.id == regionQuery.toLocaleLowerCase() || - reg.value.toLocaleLowerCase() == regionQuery.toLocaleLowerCase() - )?.id || 'eu'; - } - } - } - }, - methods: { + init() { + this.loadLang(); + this.setReleaseURL(); + this.setupOfflineHandling(); + + this.apiStore.setupAPI(); + }, + + setupOfflineHandling() { + this.store.isOffline = !window.navigator.onLine; + + if (this.store.isOffline) this.handleOfflineMode(); + + window.addEventListener('offline', this.handleOfflineMode); + window.addEventListener('online', this.handleOnlineMode); + }, + + handleOfflineMode() { + this.store.isOffline = true; + + this.apiStore.stopActiveDataScheduler(); + this.apiStore.activeData = undefined; + + this.apiStore.dataStatuses.connection = Status.Data.Offline; + }, + + handleOnlineMode() { + this.store.isOffline = false; + + this.apiStore.setupAPI(); + }, + changeLang(lang: string) { this.$i18n.locale = lang; this.currentLang = lang; diff --git a/src/components/App/StatusIndicator.vue b/src/components/App/StatusIndicator.vue index 53e5f15..aa07cc9 100644 --- a/src/components/App/StatusIndicator.vue +++ b/src/components/App/StatusIndicator.vue @@ -240,9 +240,9 @@ export default defineComponent({ const trainsDataStatus = statuses.trains; const dispatcherDataStatus = statuses.dispatchers; - if (this.store.isOffline) { - this.setSignalStatus(Status.Data.Initialized); - this.indicator.status = Status.Data.Initialized; + if (connectionStatus == Status.Data.Offline) { + this.setSignalStatus(Status.Data.Offline); + this.indicator.status = Status.Data.Offline; this.indicator.message = 'data-status.S1-offline'; return; } @@ -293,7 +293,7 @@ export default defineComponent({ this.orangeLight = false; this.redBottomLight = false; - if (status == Status.Data.Initialized) { + if (status == Status.Data.Initialized || status == Status.Data.Offline) { this.redTopLight = true; } diff --git a/src/components/Global/RegionDropdown.vue b/src/components/Global/RegionDropdown.vue index b31208b..e2348a3 100644 --- a/src/components/Global/RegionDropdown.vue +++ b/src/components/Global/RegionDropdown.vue @@ -59,6 +59,21 @@ export default defineComponent({ 'store.region.id': { handler(regionId) { this.selectedItemIndex = this.regionList.findIndex((reg) => reg.id == regionId); + + console.log('region id', regionId); + } + }, + '$route.query.region': { + immediate: true, + handler(regionQuery: string) { + if (regionQuery) { + this.store.region.id = + regionsJSON.find( + (reg) => + reg.id == regionQuery.toLocaleLowerCase() || + reg.value.toLocaleLowerCase() == regionQuery.toLocaleLowerCase() + )?.id || 'eu'; + } } } }, diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index f83bc38..10a7145 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -279,7 +279,7 @@ -