diff --git a/src/components/JournalView/JournalDispatchers.vue b/src/components/JournalView/JournalDispatchers.vue index 61012e2..a479803 100644 --- a/src/components/JournalView/JournalDispatchers.vue +++ b/src/components/JournalView/JournalDispatchers.vue @@ -100,7 +100,7 @@ import JournalOptions from '@/components/JournalView/JournalOptions.vue'; import { URLs } from '@/scripts/utils/apiURLs'; -const PROD_MODE = process.env.VUE_APP_JORUNAL_DISPATCHERS_DEV != "1" || process.env.NODE_ENV === 'production'; +const PROD_MODE = process.env.VUE_APP_JORUNAL_DISPATCHERS_DEV != '1' || process.env.NODE_ENV === 'production'; const DISPATCHERS_API_URL = (PROD_MODE ? `${URLs.stacjownikAPI}/api` : 'http://localhost:3001/api') + '/getDispatchers'; @@ -132,6 +132,13 @@ export default defineComponent({ components: { SearchBox, ActionButton, JournalOptions }, mixins: [dateMixin], + props: { + searchedSceneryName: { + type: String, + required: false, + }, + }, + data: () => ({ icons: { loading: require('@/assets/icon-loading.svg'), @@ -153,7 +160,10 @@ export default defineComponent({ const sorterActive = ref({ id: 'timestampFrom', dir: -1 }); const journalFilterActive = ref({}); - const searchersValues = reactive([{ id: 'search-dispatcher', value: '' }, { id: 'search-station', value: '' }]) + const searchersValues = reactive([ + { id: 'search-dispatcher', value: '' }, + { id: 'search-station', value: '' }, + ]); const countFromIndex = ref(0); const countLimit = 15; @@ -197,10 +207,15 @@ export default defineComponent({ activated() { window.addEventListener('scroll', this.handleScroll); + + if (this.searchedSceneryName) { + this.searchersValues[1].value = this.searchedSceneryName; + this.search(); + } }, deactivated() { - window.removeEventListener('scroll', this.handleScroll); + window.removeEventListener('scroll', this.handleScroll); }, methods: { @@ -248,7 +263,7 @@ export default defineComponent({ search() { this.fetchHistoryData({ - searchers: this.searchersValues + searchers: this.searchersValues, }); this.scrollNoMoreData = false; @@ -287,7 +302,7 @@ export default defineComponent({ const dispatcher = props.searchers?.find((s) => s.id == 'search-dispatcher')?.value.trim(); const station = props.searchers?.find((s) => s.id == 'search-station')?.value.trim(); - + if (dispatcher) queries.push(`dispatcherName=${dispatcher}`); if (station) queries.push(`stationName=${station}`); @@ -301,7 +316,9 @@ export default defineComponent({ this.currentQuery = queries.join('&'); try { - const responseData: APIResponse | null = await (await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)).data; + const responseData: APIResponse | null = await ( + await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`) + ).data; if (!responseData) { this.historyDataStatus.status = DataStatus.Error; diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 099c4b0..00bb9c3 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -43,13 +43,18 @@
+ + - + -  {{ currentDistance(train.timetableData.followingStops) }} km / +   {{ currentDistance(train.timetableData.followingStops) }} km / {{ train.timetableData.routeDistance }} km | @@ -123,24 +128,6 @@ export default defineComponent({ offline: require('@/assets/icon-offline.svg'), }, }), - - methods: { - generateProgressBar(train: Train) { - if (!train.timetableData) return ''; - - const percentage = Math.floor(Number(this.confirmedPercentage(train.timetableData.followingStops))); - - let progressBarString = ` ${percentage}% `; - - for (let i = 0; i < 5; i++) { - progressBarString += ``; - } - - return progressBarString; - }, - }, }); diff --git a/src/components/TrainsView/TrainSchedule.vue b/src/components/TrainsView/TrainSchedule.vue index ae7eb40..7ca5fdd 100644 --- a/src/components/TrainsView/TrainSchedule.vue +++ b/src/components/TrainsView/TrainSchedule.vue @@ -30,7 +30,7 @@ p alt="car" /> -
{{ car.replace(/_/g, ' ').split(":")[0] }}
+
{{ car.replace(/_/g, ' ').split(':')[0] }}
@@ -203,6 +203,7 @@ ul.stock-list { color: #aaa; font-size: 0.9em; } + } .schedule-wrapper { diff --git a/src/views/JournalView.vue b/src/views/JournalView.vue index ec7e879..d1cdb59 100644 --- a/src/views/JournalView.vue +++ b/src/views/JournalView.vue @@ -21,7 +21,7 @@
- +
@@ -46,6 +46,13 @@ export default defineComponent({ this.journalTypeChosen = type; }, }, + + activated() { + const query = this.$route.query; + console.log(this.$route.query); + + if(query.sceneryName) this.journalTypeChosen = 'dispatchers'; + } }); diff --git a/src/views/SceneryView.vue b/src/views/SceneryView.vue index 98cd389..35eba9d 100644 --- a/src/views/SceneryView.vue +++ b/src/views/SceneryView.vue @@ -18,13 +18,18 @@ Back to scenery - + @@ -106,8 +111,11 @@ export default defineComponent({ this.viewMode = mode; }, - navigateTo(path: string) { - this.$router.push(path); + navigateTo(path: string, query?: {}) { + this.$router.push({ + path, + query, + }); }, },