From d5ec9919e21175c58ee8e9a740523c1c0491f286 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Mar 2024 20:34:56 +0100 Subject: [PATCH 01/11] update modal (wip) --- package.json | 2 +- src/components/App/UpdateModal.vue | 101 ++++++++++++++++++++++++++--- src/locales/en.json | 15 +++-- src/locales/pl.json | 7 ++ 4 files changed, 109 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 670190a..de02770 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stacjownik", - "version": "1.23.0", + "version": "1.23.1", "private": true, "scripts": { "dev": "vite", diff --git a/src/components/App/UpdateModal.vue b/src/components/App/UpdateModal.vue index d2562fc..fd5ba25 100644 --- a/src/components/App/UpdateModal.vue +++ b/src/components/App/UpdateModal.vue @@ -1,15 +1,36 @@ @@ -30,6 +51,12 @@ export default defineComponent({ }; }, + computed: { + localeChangesArray() { + return this.$t('update.content').split('\n'); + } + }, + methods: { toggleModal(value: boolean) { this.$emit('toggleModal', value); @@ -40,9 +67,67 @@ export default defineComponent({ diff --git a/src/locales/en.json b/src/locales/en.json index 9e71137..a9470b3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -26,6 +26,13 @@ "TWR": "High risk freight train", "SKR": "Train with exceeded gauge" }, + "update": { + "title": "Stacjownik app update!", + "version": "Version {0}", + "confirm-button": "UPDATE NOW", + "later-button": "LATER", + "content": "context tooltips when hovering over project sponsors and timetable comment warnings\nvehicle image preview when hovering over its thumbnail in the active timetable card view and timetable journal\nlink to the driver's timetable history in the active timetable card view\nlink to the driver's active timetable card view in the timetable journal (available for online trains only)\nnew update card with version changelog" + }, "app": { "sceneries": "SCENERIES", "trains": "TRAINS", @@ -41,13 +48,7 @@ "footer": { "discord": "Stacjownik Discord server" }, - "update": { - "title": "New version of the app is available!", - "paragraph1": "Enjoy the application and may the green signal be with you!", - "release-link": "Click here to browse version changelog (GitHub)", - "confirm-button": "UPDATE NOW", - "later-button": "LATER" - }, + "vehicle-preview": { "loading": "Loading preview...", "error": "Oops! The vehicle preview seems to be missing! :/" diff --git a/src/locales/pl.json b/src/locales/pl.json index f0e0aff..018ff74 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -26,6 +26,13 @@ "TWR": "Towar niebezpieczny wysokiego ryzyka", "SKR": "Przekroczona skrajnia" }, + "update": { + "title": "Aktualizacja Stacjownika!", + "version": "Wersja {0}", + "confirm-button": "UPDATE NOW", + "later-button": "LATER", + "content": "dymki kontekstowe po najechaniu kursorem na m.in. sponsorów projektu i uwagi eksploatacyjne\npodgląd pojazdu po najechaniu kursorem na jego miniaturkę w karcie aktywnego rozkładu jazdy oraz dzienniku RJ\nodnośnik do historii RJ maszynisty w widoku karty aktywnego rozkładu jazdy\nodnośnik do karty aktywnego rozkładu jazdy maszynisty w dzienniku (dostępny tylko dla pociągów online)\nnowa karta ze zmianami w aktualizacji" + }, "app": { "sceneries": "SCENERIE", "trains": "POCIĄGI", From ba650238db4b8bd4d3efae8e27d071212e0d8ed6 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Mar 2024 23:04:08 +0100 Subject: [PATCH 02/11] poprawki rozmieszczenia popupu --- src/App.vue | 1 - src/components/PopUp/PopUp.vue | 26 +++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2b80633..3a5e999 100644 --- a/src/App.vue +++ b/src/App.vue @@ -243,7 +243,6 @@ export default defineComponent({ grid-template-columns: 100%; min-height: 100vh; - position: relative; } .app_main { diff --git a/src/components/PopUp/PopUp.vue b/src/components/PopUp/PopUp.vue index 69beef7..b7b2273 100644 --- a/src/components/PopUp/PopUp.vue +++ b/src/components/PopUp/PopUp.vue @@ -25,19 +25,31 @@ export default defineComponent({ deep: true, handler(val: typeof this.popupStore.popupPosition) { const previewEl = this.$refs['preview'] as HTMLElement; + const clientWidth = document.body.clientWidth; + const boxWidth = previewEl.getBoundingClientRect().width; + + let translateX = '0px', + translateY = '30px'; + + if (val.x <= boxWidth / 2) { + previewEl.style.left = '0'; + translateX = '0px'; + } else if (val.x >= clientWidth - boxWidth / 2) { + previewEl.style.left = '100%'; + translateX = '-100%'; + } else { + previewEl.style.left = `${val.x}px`; + translateX = '-50%'; + } previewEl.style.top = `${val.y}px`; - previewEl.style.left = `${val.x}px`; - previewEl.style.transform = 'translateY(1.5rem)'; this.$nextTick(() => { const isOutside = - val.y + previewEl.getBoundingClientRect().height > window.innerHeight + window.scrollY; + val.y + previewEl.getBoundingClientRect().height >= window.innerHeight + window.scrollY; - // previewEl.style.transform = `translate(-${~~((val.x / window.innerWidth) * 100)}%, calc(${isOutside ? '-100% - 1.5rem' : '1.5rem'}))`; - previewEl.style.transform = `translate(-${~~((val.x / window.innerWidth) * 100)}%, calc(${ - isOutside ? '-100% - 1.5rem' : '1.5rem' - }))`; + if (isOutside) translateY = 'calc(-100% - 30px)'; + previewEl.style.transform = `translate(${translateX}, ${translateY})`; }); } } From c12a6cbacd463ac8c4f44f5193cfde5d0b17f066 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Mar 2024 23:21:15 +0100 Subject: [PATCH 03/11] =?UTF-8?q?zmiana=20roz=C5=82o=C5=BCenia=20element?= =?UTF-8?q?=C3=B3w=20w=20modalu=20aktywnego=20poci=C4=85gu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TrainsView/TrainInfo.vue | 147 ++++++++++++++--------- src/components/TrainsView/TrainModal.vue | 21 ---- 2 files changed, 92 insertions(+), 76 deletions(-) diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 3bf240f..39a019e 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -1,57 +1,71 @@ From 7805d1350c50c429ed39600ca92cc4e4f1ad5e9c Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Mar 2024 23:35:56 +0100 Subject: [PATCH 05/11] =?UTF-8?q?responsywno=C5=9B=C4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JournalTimetables/TimetableGeneral.vue | 6 +++-- src/components/TrainsView/TrainInfo.vue | 26 +++++-------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/components/JournalView/JournalTimetables/TimetableGeneral.vue b/src/components/JournalView/JournalTimetables/TimetableGeneral.vue index ae73738..8b2e2bd 100644 --- a/src/components/JournalView/JournalTimetables/TimetableGeneral.vue +++ b/src/components/JournalView/JournalTimetables/TimetableGeneral.vue @@ -144,12 +144,14 @@ export default defineComponent({ } .general-train { - cursor: pointer; display: flex; - flex-wrap: wrap; justify-content: center; align-items: center; + flex-wrap: wrap; gap: 0.25em; + + cursor: pointer; + line-height: 2; } .btn-timetable { diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 39a019e..aa6f986 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -57,14 +57,14 @@
- -
@@ -270,6 +270,8 @@ export default defineComponent({ .general-top-bar { display: flex; justify-content: space-between; + flex-wrap: wrap; + gap: 0.5em; & > div { display: flex; @@ -331,26 +333,10 @@ export default defineComponent({ .train-info { grid-template-columns: 1fr; gap: 1em 0; - text-align: center; } - .general-info, - .general-status, - .general-timetable { - justify-content: center; - } - - .timetable-progress { - justify-content: center; - } - - .comments { - flex-direction: column; - justify-content: center; - - img { - margin: 0 0 0.5em 0; - } + .btn-timetable > span { + display: none; } } From b44f88ebcd58f2b4315e892de20197bd84570d98 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Mar 2024 23:37:26 +0100 Subject: [PATCH 06/11] src miniaturek --- src/components/PopUp/VehiclePreviewPopUp.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PopUp/VehiclePreviewPopUp.vue b/src/components/PopUp/VehiclePreviewPopUp.vue index 323fcd9..96becc2 100644 --- a/src/components/PopUp/VehiclePreviewPopUp.vue +++ b/src/components/PopUp/VehiclePreviewPopUp.vue @@ -14,7 +14,7 @@ width="300" height="176" class="rounded-md w-full h-auto" - :src="`https://spythere.github.io/api/td2/images/${popupStore.currentPopupContent}--300px.jpg`" + :src="`https://static.spythere.eu/images/${popupStore.currentPopupContent}--300px.jpg`" />
From c8f53c2f06cfca55e43415528caa8767189f77a9 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 30 Mar 2024 00:18:54 +0100 Subject: [PATCH 07/11] hotfixy designu --- src/App.vue | 3 +-- .../JournalView/JournalTimetables/TimetableHistoryList.vue | 2 +- src/components/PopUp/PopUp.vue | 5 ++++- src/components/PopUp/VehiclePreviewPopUp.vue | 1 - src/components/TrainsView/TrainInfo.vue | 2 +- src/styles/JournalSection.scss | 1 + 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3a5e999..39d7955 100644 --- a/src/App.vue +++ b/src/App.vue @@ -85,8 +85,6 @@ export default defineComponent({ // popup handling window.addEventListener('mousemove', (e: MouseEvent) => { - e.stopPropagation(); - const targetEl = e .composedPath() .find((p) => p instanceof HTMLElement && p.getAttribute('data-popup-key')); @@ -243,6 +241,7 @@ export default defineComponent({ grid-template-columns: 100%; min-height: 100vh; + position: relative; } .app_main { diff --git a/src/components/JournalView/JournalTimetables/TimetableHistoryList.vue b/src/components/JournalView/JournalTimetables/TimetableHistoryList.vue index 2671486..01de44a 100644 --- a/src/components/JournalView/JournalTimetables/TimetableHistoryList.vue +++ b/src/components/JournalView/JournalTimetables/TimetableHistoryList.vue @@ -5,7 +5,7 @@ v-for="{ timetable, showExtraInfo } in computedTimetableHistory" class="journal_item" :key="timetable.id" - @click.stop.prevent="showExtraInfo.value = !showExtraInfo.value" + @click="showExtraInfo.value = !showExtraInfo.value" >
diff --git a/src/components/PopUp/PopUp.vue b/src/components/PopUp/PopUp.vue index b7b2273..986fb49 100644 --- a/src/components/PopUp/PopUp.vue +++ b/src/components/PopUp/PopUp.vue @@ -31,7 +31,10 @@ export default defineComponent({ let translateX = '0px', translateY = '30px'; - if (val.x <= boxWidth / 2) { + if (clientWidth < 500) { + previewEl.style.left = '50%'; + translateX = '-50%'; + } else if (val.x <= boxWidth / 2) { previewEl.style.left = '0'; translateX = '0px'; } else if (val.x >= clientWidth - boxWidth / 2) { diff --git a/src/components/PopUp/VehiclePreviewPopUp.vue b/src/components/PopUp/VehiclePreviewPopUp.vue index 96becc2..5f59c1b 100644 --- a/src/components/PopUp/VehiclePreviewPopUp.vue +++ b/src/components/PopUp/VehiclePreviewPopUp.vue @@ -10,7 +10,6 @@ v-if="popupStore.currentPopupContent" @load="onImageLoad" @error="onImageError" - @click="popupStore.onPopUpHide" width="300" height="176" class="rounded-md w-full h-auto" diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index aa6f986..afb3965 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -126,7 +126,7 @@ {{ $t('trains.cars') }}: {{ train.stockList.length - 1 }} | - {{ train.speed }}km/h + {{ train.speed }} km/h
diff --git a/src/styles/JournalSection.scss b/src/styles/JournalSection.scss index 504cf1f..a37fed7 100644 --- a/src/styles/JournalSection.scss +++ b/src/styles/JournalSection.scss @@ -6,6 +6,7 @@ height: 90vh; min-height: 550px; margin-top: 0.5em; + position: relative; padding-right: 0.2em; } From d05579c5ee4beb75d259a1eee2fd8f7354884c07 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 30 Mar 2024 13:24:39 +0100 Subject: [PATCH 08/11] popupy --- src/App.vue | 58 +++++++++---------- src/components/PopUp/DonatorPopUp.vue | 6 +- src/components/PopUp/PopUp.vue | 61 ++++++++++---------- src/components/PopUp/TrainCommentsPopUp.vue | 6 +- src/components/PopUp/VehiclePreviewPopUp.vue | 10 ++-- src/components/StationsView/StationTable.vue | 10 ++-- src/components/TrainsView/TrainInfo.vue | 4 +- src/mixins/modalTrainMixin.ts | 6 +- src/mixins/popupMixin.ts | 27 +++++++++ src/store/mainStore.ts | 6 +- src/store/popupStore.ts | 37 ------------ src/store/typings.ts | 5 +- src/styles/global.scss | 2 + 13 files changed, 113 insertions(+), 125 deletions(-) create mode 100644 src/mixins/popupMixin.ts delete mode 100644 src/store/popupStore.ts diff --git a/src/App.vue b/src/App.vue index 39d7955..56c1315 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,11 +34,12 @@ diff --git a/src/mixins/modalTrainMixin.ts b/src/mixins/modalTrainMixin.ts index d5fa784..0935a76 100644 --- a/src/mixins/modalTrainMixin.ts +++ b/src/mixins/modalTrainMixin.ts @@ -8,12 +8,6 @@ export default defineComponent({ }; }, - computed: { - chosenTrain() { - return this.store.trainList.find((train) => train.trainId == this.store.chosenModalTrainId); - } - }, - methods: { selectModalTrain(trainId: string, target?: EventTarget | null) { this.store.chosenModalTrainId = trainId; diff --git a/src/store/apiStore.ts b/src/store/apiStore.ts index 1fa0166..1749f5e 100644 --- a/src/store/apiStore.ts +++ b/src/store/apiStore.ts @@ -4,9 +4,6 @@ import { Status } from '../typings/common'; import { StationJSONData } from './typings'; import axios, { AxiosInstance } from 'axios'; -// Update seconds cron for active data scheduler -const UPDATE_SECONDS = [3, 23, 43]; - export enum APIMode { PRODUCTION = 0, DEV = 1, From f53993c7174231a4b6a342111615a1344ffc8f6a Mon Sep 17 00:00:00 2001 From: Spythere Date: Sun, 31 Mar 2024 21:55:33 +0200 Subject: [PATCH 11/11] hotfix --- src/store/mainStore.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts index 84f77fa..a6e13c8 100644 --- a/src/store/mainStore.ts +++ b/src/store/mainStore.ts @@ -47,7 +47,8 @@ export const useMainStore = defineStore('store', { const sceneryNames = train.timetable?.sceneries?.map( (sceneryHash) => - this.activeSceneryList.find((st) => st.hash === sceneryHash)?.name ?? + apiStore.activeData?.activeSceneries?.find((st) => st.stationHash === sceneryHash) + ?.stationName ?? apiStore.sceneryData.find((sd) => sd.hash === sceneryHash)?.name ?? sceneryHash ) ?? [];