Compare commits

..

14 Commits

Author SHA1 Message Date
Spythere 20cd393e05 Merge pull request #84 from Spythere/development
Wersja 1.23.0
2024-03-24 01:30:03 +01:00
Spythere 31e65c09d6 hotfix: podgląd pojazdów 2024-03-24 00:05:39 +01:00
Spythere fb2348e774 hotfixy designu 2024-03-23 23:55:18 +01:00
Spythere 1ec75bda70 poprawki do popupów 2024-03-23 16:47:57 +01:00
Spythere 6b6b837dde bump: v1.23.0 2024-03-23 00:01:15 +01:00
Spythere 66a02d76bd dodano odnośnik do dziennika RJ maszynisty 2024-03-23 00:00:52 +01:00
Spythere c7162dbd14 dodano dymki kontekstowe oraz podgląd pojazdu 2024-03-22 23:41:43 +01:00
Spythere 1cfe073bab Merge pull request #83 from Spythere/development
Wersja 1.22.3
2024-03-17 18:38:27 +01:00
Spythere e3b72c81ea bump: 1.22.3 2024-03-17 18:37:58 +01:00
Spythere 5552995564 fix: duplikujące się aktywne RJ scenerii 2024-03-17 18:37:45 +01:00
Spythere 623d5dd2ce fix: RJ scenerii offline 2024-03-17 17:33:19 +01:00
Spythere 6992b998a8 Merge pull request #82 from Spythere/development
Wersja 1.22.2
2024-03-17 16:47:52 +01:00
Spythere 669975c68e hotfixy 2024-03-17 16:42:35 +01:00
Spythere 084823de44 fix pobierania danych 2024-03-16 22:13:38 +01:00
24 changed files with 429 additions and 56 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "stacjownik",
"version": "1.22.1",
"version": "1.23.0",
"private": true,
"scripts": {
"dev": "vite",
+37 -4
View File
@@ -1,5 +1,7 @@
<template>
<div class="app_container" v-cloak>
<PopUp />
<transition name="modal-anim">
<keep-alive>
<TrainModal v-if="store.chosenModalTrainId" />
@@ -36,17 +38,17 @@ import { defineComponent, watch } from 'vue';
import axios from 'axios';
import { version } from '.././package.json';
import Clock from './components/App/Clock.vue';
import { useMainStore } from './store/mainStore';
import Clock from './components/App/Clock.vue';
import StatusIndicator from './components/App/StatusIndicator.vue';
import AppHeader from './components/App/AppHeader.vue';
import TrainModal from './components/TrainsView/TrainModal.vue';
import StorageManager from './managers/storageManager';
import PopUp from './components/PopUp/PopUp.vue';
import { useApiStore } from './store/apiStore';
import { Status } from './typings/common';
import { usePopupStore } from './store/popupStore';
const STORAGE_VERSION_KEY = 'app_version';
@@ -55,13 +57,15 @@ export default defineComponent({
Clock,
StatusIndicator,
AppHeader,
TrainModal
TrainModal,
PopUp
},
data: () => ({
VERSION: version,
store: useMainStore(),
apiStore: useApiStore(),
popupStore: usePopupStore(),
currentLang: 'pl',
releaseURL: '',
@@ -73,6 +77,34 @@ export default defineComponent({
},
async mounted() {
window.addEventListener('focus', () => {
if (Date.now() - this.apiStore.lastFetchData.getTime() < 15000) return;
this.apiStore.fetchActiveData();
});
// popup handling
window.addEventListener('mousemove', (e: MouseEvent) => {
e.stopPropagation();
const targetEl = e
.composedPath()
.find((p) => p instanceof HTMLElement && p.getAttribute('data-popup-key'));
if (!targetEl || !(targetEl instanceof HTMLElement)) {
if (this.popupStore.currentPopupComponent != null) this.popupStore.onPopUpHide();
return;
}
const popupComponentKey = targetEl.getAttribute('data-popup-key');
const popupContent = targetEl.getAttribute('data-popup-content');
if (popupComponentKey && popupContent)
this.popupStore.onPopUpShow(e, popupComponentKey, popupContent);
else if (this.popupStore.currentPopupComponent != null) this.popupStore.onPopUpHide();
});
watch(
() => this.store.blockScroll,
(value) => {
@@ -211,6 +243,7 @@ export default defineComponent({
grid-template-columns: 100%;
min-height: 100vh;
position: relative;
}
.app_main {
+1 -1
View File
@@ -84,7 +84,7 @@ export default defineComponent({
regionList() {
return regionsJSON.map((region) => {
const regionStationCount = this.store.activeSceneryList.filter(
(scenery) => scenery.region == region.id
(scenery) => scenery.region == region.id && scenery.dispatcherId != -1
).length;
const regionTrainCount =
+23 -3
View File
@@ -7,11 +7,12 @@
</p>
<img
class="traction-only"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${computedStockList[0].split(':')[0]}${
/^EN/.test(computedStockList[0]) ? 'rb' : ''
}.png`"
@error="onImageError($event, computedStockList[0])"
width="400"
width="300"
height="60"
/>
</div>
@@ -25,39 +26,53 @@
<span>
<img
:data-mouseover="stockName"
data-popup-key="VehiclePreviewPopUp"
:data-popup-content="stockName.split(':')[0]"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stockName.split(':')[0]}${
/^EN/.test(stockName) ? 'rb' : ''
}.png`"
@error="onImageError($event, stockName)"
@click.stop="() => {}"
width="400"
height="60"
/>
<!-- /// Manualne dodawanie miniaturek członów dla kibelków /// -->
<img
:data-mouseover="stockName"
data-popup-key="VehiclePreviewPopUp"
:data-popup-content="stockName.split(':')[0]"
v-if="/^(EN|2EN)/.test(stockName)"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stockName.split(':')[0]}s.png`"
@error="
(event) => ((event.target as HTMLImageElement).src = '/images/icon-loco-ezt-s.png')
"
@click.stop="() => {}"
/>
<img
class="train-thumbnail"
:data-mouseover="stockName"
data-popup-key="VehiclePreviewPopUp"
:data-popup-content="stockName.split(':')[0]"
v-if="/^EN71/.test(stockName)"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stockName.split(':')[0]}s.png`"
@error="
(event) => ((event.target as HTMLImageElement).src = '/images/icon-loco-ezt-s.png')
"
@click.stop="() => {}"
/>
<img
class="train-thumbnail"
:data-mouseover="stockName"
data-popup-key="VehiclePreviewPopUp"
:data-popup-content="stockName.split(':')[0]"
v-if="/^(EN|2EN)/.test(stockName)"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stockName.split(':')[0]}ra.png`"
@error="
(event) => ((event.target as HTMLImageElement).src = '/images/icon-loco-ezt-ra.png')
"
@click.stop="() => {}"
/>
<!-- /// -->
</span>
@@ -139,6 +154,7 @@ export default defineComponent({
ul > li > span {
display: flex;
align-items: flex-end;
cursor: crosshair;
}
img {
@@ -147,6 +163,10 @@ img {
height: auto;
}
img.traction-only {
max-width: 100%;
}
p {
text-align: center;
color: #aaa;
@@ -1,11 +1,6 @@
<template>
<div class="item-general">
<span
class="general-train"
tabindex="0"
@click.stop="showTimetable(timetable, $event.currentTarget)"
@keydown.enter="showTimetable(timetable, $event.currentTarget)"
>
<span class="general-train">
<span class="text--grayed">#{{ timetable.id }}</span>
<span class="badges" v-if="timetable.skr || timetable.twr">
@@ -39,6 +34,15 @@
<strong v-else>
{{ timetable.driverName }}
</strong>
<button
v-if="timetable.terminated == false"
class="btn--image btn--action btn-timetable"
@click.stop="showTimetable(timetable, $event.currentTarget)"
>
<img src="/images/icon-train.svg" alt="" />
{{ $t('journal.timetable-online-button') }}
</button>
</span>
<span class="general-time">
@@ -148,6 +152,16 @@ export default defineComponent({
gap: 0.25em;
}
.btn-timetable {
display: inline-block;
padding: 0.1em 0.4em;
margin-left: 0.5em;
img {
vertical-align: top;
}
}
@include smallScreen {
.item-general {
justify-content: center;
@@ -5,7 +5,7 @@
v-for="{ timetable, showExtraInfo } in computedTimetableHistory"
class="journal_item"
:key="timetable.id"
@click="showExtraInfo.value = !showExtraInfo.value"
@click.stop.prevent="showExtraInfo.value = !showExtraInfo.value"
>
<div class="journal_item-info">
<!-- General -->
+39
View File
@@ -0,0 +1,39 @@
<template>
<div class="popup-content">
<img src="/images/icon-diamond.svg" alt="" />
<span>{{ popupStore.currentPopupContent }}</span>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
data() {
return {
popupStore: usePopupStore()
};
}
});
</script>
<style lang="scss" scoped>
.popup-content {
gap: 0.5em;
padding: 0.5em;
border-radius: 0.25em;
width: 100%;
background-color: #333;
box-shadow: 0 0 10px 2px #aaa;
}
img {
vertical-align: middle;
height: 1em;
margin-right: 0.5em;
}
</style>
+55
View File
@@ -0,0 +1,55 @@
<template>
<div class="popup" v-show="popupStore.currentPopupComponent" ref="preview">
<component v-if="popupStore.currentPopupComponent" :is="popupStore.currentPopupComponent" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import DonatorPopUp from './DonatorPopUp.vue';
import TrainCommentsPopUp from './TrainCommentsPopUp.vue';
import VehiclePreviewPopUp from './VehiclePreviewPopUp.vue';
import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
components: { DonatorPopUp, TrainCommentsPopUp, VehiclePreviewPopUp },
data() {
return {
popupStore: usePopupStore()
};
},
watch: {
'popupStore.popupPosition': {
deep: true,
handler(val: typeof this.popupStore.popupPosition) {
const previewEl = this.$refs['preview'] as HTMLElement;
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;
// 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'
}))`;
});
}
}
}
});
</script>
<style lang="scss" scoped>
.popup {
position: absolute;
z-index: 250;
max-width: 400px;
text-align: center;
}
</style>
@@ -0,0 +1,38 @@
<template>
<div class="popup-content">
<span>{{ popupStore.currentPopupContent }}</span>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
data() {
return {
popupStore: usePopupStore()
};
}
});
</script>
<style lang="scss" scoped>
.popup-content {
display: flex;
justify-content: center;
align-items: center;
gap: 0.5em;
padding: 0.25em 0.5em;
border-radius: 0.25em;
width: 100%;
background-color: #333;
box-shadow: 0 0 5px 2px #aaa;
}
img {
height: 1em;
}
</style>
@@ -0,0 +1,86 @@
<template>
<div class="popup-content">
<div v-if="imageState == 'loading'" class="loading-info">
{{ $t('vehicle-preview.loading') }}
</div>
<div v-if="imageState == 'error'">{{ $t('vehicle-preview.error') }}</div>
<img
v-if="popupStore.currentPopupContent"
@load="onImageLoad"
@error="onImageError"
@click="popupStore.onPopUpHide"
width="300"
height="176"
class="rounded-md w-full h-auto"
:src="`https://spythere.github.io/api/td2/images/${popupStore.currentPopupContent}--300px.jpg`"
/>
<div class="vehicle-name" v-if="imageState != 'error'">
{{ popupStore.currentPopupContent.replace(/_/g, ' ') }}
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
data() {
return {
popupStore: usePopupStore(),
imageState: 'loading'
};
},
mounted() {
this.imageState = 'loading';
},
methods: {
onImageLoad() {
this.imageState = 'loaded';
},
onImageError(e: Event) {
this.imageState = 'error';
(e.target as HTMLElement).style.display = 'none';
}
}
});
</script>
<style lang="scss" scoped>
.popup-content {
// min-w-[300px] min-h-[200px] p-2 bg-slate-800 rounded-md
width: 300px;
min-height: 200px;
background-color: #333;
box-shadow: 0 0 10px 2px #aaa;
padding: 0.5em;
border-radius: 0.5em;
}
.loading-info {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
img {
width: 100%;
height: auto;
}
.vehicle-name {
text-align: center;
margin-top: 0.5em;
color: #ccc;
text-wrap: wrap;
}
</style>
@@ -74,7 +74,7 @@
class="timetable-item"
v-else
v-for="scheduledTrain in computedScheduledTrains"
:key="scheduledTrain.trainId"
:key="scheduledTrain.trainId + scheduledTrain.stopInfo.arrivalTimestamp"
tabindex="0"
@click.prevent.stop="selectModalTrain(scheduledTrain.trainId, $event.currentTarget)"
@keydown.enter.prevent="selectModalTrain(scheduledTrain.trainId, $event.currentTarget)"
+8 -2
View File
@@ -119,8 +119,9 @@
<span v-if="station.onlineInfo?.dispatcherName">
<b
v-if="apiStore.donatorsData.includes(station.onlineInfo.dispatcherName)"
:title="$t('donations.dispatcher-message')"
@click.stop="openDonationModal"
data-popup-key="DonatorPopUp"
:data-popup-content="$t('donations.dispatcher-message')"
>
<img src="/images/icon-diamond.svg" alt="" />
{{ station.onlineInfo.dispatcherName }}
@@ -311,6 +312,7 @@ import { HeadIdsTypes, headIconsIds, headIds } from '../../scripts/data/stationH
import StationStatusBadge from '../Global/StationStatusBadge.vue';
import { Status } from '../../typings/common';
import { useApiStore } from '../../store/apiStore';
import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
props: {
@@ -339,13 +341,16 @@ export default defineComponent({
setup() {
const mainStore = useMainStore();
const apiStore = useApiStore();
const popupStore = usePopupStore();
const stationFiltersStore = useStationFiltersStore();
return {
Status: Status.Data,
stationFiltersStore,
mainStore,
apiStore
apiStore,
popupStore
};
},
@@ -368,6 +373,7 @@ export default defineComponent({
openDonationModal(e: Event) {
this.$emit('toggleDonationModal', true);
this.mainStore.modalLastClickedTarget = e.target;
this.popupStore.currentPopupComponent = null;
},
openForumSite(e: Event, url: string | undefined) {
+44 -13
View File
@@ -36,25 +36,37 @@
<div class="train-driver">
<b
v-if="apiStore.donatorsData.includes(train.driverName)"
:title="$t('donations.driver-message')"
data-popup-key="DonatorPopUp"
:data-popup-content="$t('donations.driver-message')"
>
{{ train.driverName }}
<img src="/images/icon-diamond.svg" alt="donator diamond icon" />
</b>
<span v-else>{{ train.driverName }}</span>
<button
class="btn--image btn--action btn-timetable"
@click="navigateToJournal"
v-if="extended"
>
<img src="/images/icon-train.svg" alt="" />
{{ $t('trains.journal-button') }}
</button>
</div>
</div>
<div class="general-timetable" v-if="train.timetableData">
<strong>{{ train.timetableData.route.replace('|', ' - ') }}</strong>
<img
<span
v-if="getSceneriesWithComments(train.timetableData).length > 0"
class="image-warning"
src="/images/icon-warning.svg"
:title="`${$t('trains.timetable-comments')} (${getSceneriesWithComments(
data-popup-key="TrainCommentsPopUp"
:data-popup-content="`${$t('trains.timetable-comments')} (${getSceneriesWithComments(
train.timetableData
)})`"
/>
>
<img class="image-warning" src="/images/icon-warning.svg" />
</span>
</div>
<hr style="margin: 0.25em 0" />
@@ -125,9 +137,11 @@ import ProgressBar from '../Global/ProgressBar.vue';
import { useMainStore } from '../../store/mainStore';
import { useApiStore } from '../../store/apiStore';
import StockList from '../Global/StockList.vue';
import { usePopupStore } from '../../store/popupStore';
import modalTrainMixin from '../../mixins/modalTrainMixin';
export default defineComponent({
mixins: [trainInfoMixin, styleMixin],
mixins: [trainInfoMixin, styleMixin, modalTrainMixin],
components: { ProgressBar, StockList },
props: {
@@ -136,16 +150,29 @@ export default defineComponent({
required: true
},
extended: {
type: Boolean,
default: true
type: Boolean
}
},
data() {
return {
store: useMainStore(),
apiStore: useApiStore()
apiStore: useApiStore(),
popupStore: usePopupStore()
};
},
methods: {
navigateToJournal() {
this.$router.push({
path: '/journal/timetables',
query: {
'search-driver': this.train.driverName
}
});
this.closeModal();
}
}
});
</script>
@@ -156,8 +183,8 @@ export default defineComponent({
.image-warning {
height: 1em;
margin-left: 0.5em;
vertical-align: middle;
}
.train-stats {
@@ -187,6 +214,12 @@ export default defineComponent({
vertical-align: text-bottom;
}
.btn-timetable {
display: inline-block;
padding: 0.25em;
margin-left: 0.5em;
}
.timetable-id {
color: #d2d2d2;
}
@@ -262,8 +295,6 @@ export default defineComponent({
grid-template-columns: 1fr;
gap: 1em 0;
text-align: center;
font-size: 1.15em;
}
.general-info,
+1 -1
View File
@@ -6,7 +6,7 @@
<img src="/images/icon-exit.svg" alt="close card" />
</button>
<TrainInfo :train="chosenTrain" :extended="false" ref="trainInfo" />
<TrainInfo :train="chosenTrain" :extended="true" ref="trainInfo" />
<TrainSchedule :train="chosenTrain" tabindex="0" />
</div>
</div>
+4 -4
View File
@@ -1,13 +1,13 @@
<template>
<transition name="status-anim" mode="out-in" tag="div" class="train-table">
<div :key="apiStore.dataStatuses.connection">
<div class="table-info" key="offline" v-if="store.isOffline">
<div class="table-warning" key="offline" v-if="store.isOffline">
{{ $t('app.offline') }}
</div>
<Loading v-else-if="apiStore.dataStatuses.connection == Status.Loading" key="loading" />
<div class="table-info" key="no-trains" v-else-if="trains.length == 0">
<div class="table-warning" key="no-trains" v-else-if="trains.length == 0">
{{ $t('trains.no-trains') }}
</div>
@@ -20,7 +20,7 @@
@click.stop="selectModalTrain(train.trainId, $event.currentTarget)"
@keydown.enter="selectModalTrain(train.trainId, $event.currentTarget)"
>
<TrainInfo :train="train" />
<TrainInfo :train="train" :extended="false" />
</li>
</transition-group>
</div>
@@ -105,7 +105,7 @@ export default defineComponent({
overflow-x: hidden;
}
.table-info {
.table-warning {
text-align: center;
padding: 1em 0;
+8 -1
View File
@@ -48,6 +48,10 @@
"confirm-button": "UPDATE NOW",
"later-button": "LATER"
},
"vehicle-preview": {
"loading": "Loading preview...",
"error": "Oops! The vehicle preview seems to be missing! :/"
},
"data-status": {
"S1-offline": "<b>S1 signal</b> <br> The app is working in offline mode!",
"S1a-connection": "<b>S1a signal</b> <br> Cannot connect with Stacjownik API service!",
@@ -315,7 +319,9 @@
"last-seen-ago": "since {minutes} minutes",
"scenery-offline": "Offline ride",
"timeout": "An error occured while trying to refresh SWDR timetable data!"
"timeout": "An error occured while trying to refresh SWDR timetable data!",
"journal-button": "DRIVER'S JOURNAL"
},
"train-stats": {
"stats-button": "STATISTICS",
@@ -351,6 +357,7 @@
"timetable-active": "ACTIVE",
"timetable-fulfilled": "FULFILLED",
"timetable-abandoned": "ABANDONED",
"timetable-online-button": "ONLINE TIMETABLE",
"online-since": "ONLINE SINCE",
"duty-lasted": "The duty lasted",
+8 -1
View File
@@ -38,6 +38,10 @@
"footer": {
"discord": "Serwer Discord Stacjownika"
},
"vehicle-preview": {
"loading": "Ładowanie podglądu...",
"error": "Ups! Nie znaleziono podglądu pojazdu! :/"
},
"data-status": {
"S1-offline": "<b>Sygnał S1</b> <br> Aplikacja działa w trybie offline!",
"S1a-connection": "<b>Sygnał S1a</b> <br> Błąd podczas próby połączenia się z API Stacjownika!",
@@ -295,7 +299,9 @@
"scenery-offline": "Przejazd offline",
"timeout": "Wystąpił problem z aktualizacją rozkładów jazdy z SWDR"
"timeout": "Wystąpił problem z aktualizacją rozkładów jazdy z SWDR",
"journal-button": "DZIENNIK MASZYNISTY"
},
"train-stats": {
"stats-button": "STATYSTYKI",
@@ -337,6 +343,7 @@
"timetable-active": "AKTYWNY",
"timetable-fulfilled": "WYPEŁNIONY",
"timetable-abandoned": "PORZUCONY",
"timetable-online-button": "RJ ONLINE",
"stock-info": "DODATKOWE INFORMACJE",
"stock-length": "Długość",
+4 -1
View File
@@ -1,10 +1,12 @@
import { defineComponent } from 'vue';
import { useMainStore } from '../store/mainStore';
import { usePopupStore } from '../store/popupStore';
export default defineComponent({
data() {
return {
store: useMainStore()
store: useMainStore(),
popupStore: usePopupStore()
};
},
@@ -23,6 +25,7 @@ export default defineComponent({
closeModal() {
this.store.chosenModalTrainId = undefined;
this.popupStore.currentPopupComponent = null;
setTimeout(() => {
(this.store.modalLastClickedTarget as any)?.focus();
+7 -6
View File
@@ -24,6 +24,8 @@ export const useApiStore = defineStore('apiStore', {
donatorsData: [] as API.Donators.Response,
sceneryData: [] as StationJSONData[],
lastFetchData: new Date(),
client: undefined as AxiosInstance | undefined,
activeDataScheduler: undefined as number | undefined
@@ -64,20 +66,19 @@ export const useApiStore = defineStore('apiStore', {
async setupActiveDataFetcher() {
if (this.activeDataScheduler) return;
this.dataStatuses.connection = Status.Data.Loading;
this.activeDataScheduler = window.setInterval(() => {
if (UPDATE_SECONDS.includes(new Date().getSeconds())) {
this.fetchActiveData();
}
}, 1000);
this.fetchActiveData();
}, 25000);
},
async fetchActiveData() {
if (!this.activeData) this.dataStatuses.connection = Status.Data.Loading;
try {
const response = await this.client!.get<API.ActiveData.Response>('api/getActiveData');
this.activeData = response.data;
this.lastFetchData = new Date();
this.dataStatuses.connection = Status.Data.Loaded;
console.log('Fetching active data at ' + new Date().toLocaleTimeString('pl-PL'));
+4 -1
View File
@@ -107,7 +107,10 @@ export const useMainStore = defineStore('store', {
if (
acc.findIndex((v) => v.name == name && v.region == train.region) != -1 ||
apiStore.activeData?.activeSceneries?.findIndex(
(sc) => sc.stationName === name && sc.region == train.region
(sc) =>
sc.stationName === name &&
sc.region == train.region &&
Date.now() - sc.lastSeen < 1000 * 60 * 2
) != -1
)
return acc;
+37
View File
@@ -0,0 +1,37 @@
import { defineStore } from 'pinia';
export const popupKeys = ['DonatorPopUp', 'TrainCommentsPopUp', 'VehiclePreviewPopUp'] as const;
export type PopUp = (typeof popupKeys)[number];
const isPopUp = (v: any): v is PopUp => popupKeys.includes(v);
export const usePopupStore = defineStore('popupStore', {
state: () => ({
popupPosition: { x: 0, y: 0 },
currentPopupComponent: null as PopUp | null,
currentPopupContent: '',
donatorPopupVisible: false
}),
actions: {
onPopUpShow(e: MouseEvent, componentKey: string, value?: string) {
if (!isPopUp(componentKey)) return;
this.popupPosition.x = e.pageX;
this.popupPosition.y = e.pageY;
this.currentPopupComponent = componentKey;
this.currentPopupContent = value ?? '';
},
onPopUpMove(e: MouseEvent) {
this.popupPosition.x = e.pageX;
this.popupPosition.y = e.pageY;
},
onPopUpHide() {
this.currentPopupComponent = null;
this.currentPopupContent = '';
}
}
});
-6
View File
@@ -11,20 +11,14 @@ export interface RegionCounters {
export interface StoreState {
region: { id: string; value: string };
isOffline: boolean;
isNewUpdate: boolean;
dispatcherStatsName: string;
dispatcherStatsData?: API.DispatcherStats.Response;
driverStatsName: string;
driverStatsData?: API.DriverStats.Response;
driverStatsStatus: Status.Data;
chosenModalTrainId?: string;
blockScroll: boolean;
modalLastClickedTarget: EventTarget | null;
}
+1 -2
View File
@@ -1,4 +1,4 @@
$animDuration: 150ms;
$animDuration: 95ms;
$animType: ease-in-out;
// List animation
@@ -72,7 +72,6 @@ $animType: ease-in-out;
&-enter-from,
&-leave-to {
transform: translateY(-25%);
opacity: 0;
}
}
+1 -1
View File
@@ -234,7 +234,7 @@ a.a-button {
padding: 0.35em 0.75em;
img {
width: 1.5em;
width: 1.35em;
vertical-align: middle;
}
}