From c7162dbd148ea7c03edc28bf2f5f15d1b746f4e4 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Fri, 22 Mar 2024 23:41:43 +0100
Subject: [PATCH] =?UTF-8?q?dodano=20dymki=20kontekstowe=20oraz=20podgl?=
=?UTF-8?q?=C4=85d=20pojazdu?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.vue | 11 ++-
src/components/Global/StockList.vue | 20 ++++-
src/components/PopUp/DonatorPopUp.vue | 39 +++++++++
src/components/PopUp/PopUp.vue | 54 +++++++++++++
src/components/PopUp/TrainCommentsPopUp.vue | 38 +++++++++
src/components/PopUp/VehiclePreviewPopUp.vue | 85 ++++++++++++++++++++
src/components/StationsView/StationTable.vue | 16 +++-
src/components/TrainsView/TrainInfo.vue | 32 +++++---
src/locales/en.json | 4 +
src/locales/pl.json | 4 +
src/store/popupStore.ts | 34 ++++++++
src/store/typings.ts | 6 --
12 files changed, 319 insertions(+), 24 deletions(-)
create mode 100644 src/components/PopUp/DonatorPopUp.vue
create mode 100644 src/components/PopUp/PopUp.vue
create mode 100644 src/components/PopUp/TrainCommentsPopUp.vue
create mode 100644 src/components/PopUp/VehiclePreviewPopUp.vue
create mode 100644 src/store/popupStore.ts
diff --git a/src/App.vue b/src/App.vue
index e038a36..69d85ca 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,7 @@
+
+
@@ -36,15 +38,14 @@ 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';
@@ -55,7 +56,8 @@ export default defineComponent({
Clock,
StatusIndicator,
AppHeader,
- TrainModal
+ TrainModal,
+ PopUp
},
data: () => ({
@@ -217,6 +219,7 @@ export default defineComponent({
grid-template-columns: 100%;
min-height: 100vh;
+ position: relative;
}
.app_main {
diff --git a/src/components/Global/StockList.vue b/src/components/Global/StockList.vue
index 23b8e1a..6fc56f1 100644
--- a/src/components/Global/StockList.vue
+++ b/src/components/Global/StockList.vue
@@ -7,11 +7,12 @@
@@ -23,7 +24,13 @@
{{ stockName.split(':')[1] }}
-
+
import { PropType, defineComponent } from 'vue';
import { useApiStore } from '../../store/apiStore';
+import { usePopupStore } from '../../store/popupStore';
export default defineComponent({
props: {
@@ -84,7 +92,8 @@ export default defineComponent({
data() {
return {
- apiStore: useApiStore()
+ apiStore: useApiStore(),
+ popupStore: usePopupStore()
};
},
@@ -139,6 +148,7 @@ export default defineComponent({
ul > li > span {
display: flex;
align-items: flex-end;
+ cursor: crosshair;
}
img {
@@ -147,6 +157,10 @@ img {
height: auto;
}
+img.traction-only {
+ max-width: 100%;
+}
+
p {
text-align: center;
color: #aaa;
diff --git a/src/components/PopUp/DonatorPopUp.vue b/src/components/PopUp/DonatorPopUp.vue
new file mode 100644
index 0000000..67c7f71
--- /dev/null
+++ b/src/components/PopUp/DonatorPopUp.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
diff --git a/src/components/PopUp/PopUp.vue b/src/components/PopUp/PopUp.vue
new file mode 100644
index 0000000..3023551
--- /dev/null
+++ b/src/components/PopUp/PopUp.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
diff --git a/src/components/PopUp/TrainCommentsPopUp.vue b/src/components/PopUp/TrainCommentsPopUp.vue
new file mode 100644
index 0000000..9e5ed2f
--- /dev/null
+++ b/src/components/PopUp/TrainCommentsPopUp.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
diff --git a/src/components/PopUp/VehiclePreviewPopUp.vue b/src/components/PopUp/VehiclePreviewPopUp.vue
new file mode 100644
index 0000000..4ceda97
--- /dev/null
+++ b/src/components/PopUp/VehiclePreviewPopUp.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue
index 727cec4..833a95a 100644
--- a/src/components/StationsView/StationTable.vue
+++ b/src/components/StationsView/StationTable.vue
@@ -119,8 +119,16 @@
{{ station.onlineInfo.dispatcherName }}
@@ -311,6 +319,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 +348,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
};
},
diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue
index 0e90e00..7841fdf 100644
--- a/src/components/TrainsView/TrainInfo.vue
+++ b/src/components/TrainsView/TrainInfo.vue
@@ -36,7 +36,11 @@
{{ train.driverName }}
@@ -47,14 +51,22 @@
@@ -125,6 +137,7 @@ 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';
export default defineComponent({
mixins: [trainInfoMixin, styleMixin],
@@ -144,7 +157,8 @@ export default defineComponent({
data() {
return {
store: useMainStore(),
- apiStore: useApiStore()
+ apiStore: useApiStore(),
+ popupStore: usePopupStore()
};
}
});
diff --git a/src/locales/en.json b/src/locales/en.json
index 6c62edf..661cd60 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -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": "S1 signal
The app is working in offline mode!",
"S1a-connection": "S1a signal
Cannot connect with Stacjownik API service!",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index be0b2c6..5b7b3c7 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -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": "Sygnał S1
Aplikacja działa w trybie offline!",
"S1a-connection": "Sygnał S1a
Błąd podczas próby połączenia się z API Stacjownika!",
diff --git a/src/store/popupStore.ts b/src/store/popupStore.ts
new file mode 100644
index 0000000..b58b826
--- /dev/null
+++ b/src/store/popupStore.ts
@@ -0,0 +1,34 @@
+import { defineStore } from 'pinia';
+
+export const usePopupStore = defineStore('popupStore', {
+ state: () => ({
+ popupPosition: { x: 0, y: 0 },
+ currentPopupComponent: null as
+ | null
+ | 'DonatorPopUp'
+ | 'TrainCommentsPopUp'
+ | 'VehiclePreviewPopUp',
+ currentPopupContent: '',
+ donatorPopupVisible: false
+ }),
+
+ actions: {
+ onPopUpShow(e: MouseEvent, componentKey: typeof this.currentPopupComponent, value?: string) {
+ 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 = '';
+ }
+ }
+});
diff --git a/src/store/typings.ts b/src/store/typings.ts
index e1aeb73..d9ed6d1 100644
--- a/src/store/typings.ts
+++ b/src/store/typings.ts
@@ -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;
}