From 405aab96bde75eac36dad387d62e8911708d3f33 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sun, 5 May 2024 13:34:43 +0200 Subject: [PATCH] feature: stations stats --- src/components/App/AppHeader.vue | 11 -- .../SceneryView/SceneryTimetable.vue | 7 - src/components/StationsView/StationTable.vue | 2 +- src/components/StationsView/StationsStats.vue | 150 ++++++++++++++++++ src/store/mainStore.ts | 5 +- src/store/typings.ts | 2 - src/styles/global.scss | 20 +++ src/views/StationsView.vue | 75 +-------- 8 files changed, 178 insertions(+), 94 deletions(-) create mode 100644 src/components/StationsView/StationsStats.vue diff --git a/src/components/App/AppHeader.vue b/src/components/App/AppHeader.vue index 0bb6d90..7999e16 100644 --- a/src/components/App/AppHeader.vue +++ b/src/components/App/AppHeader.vue @@ -29,11 +29,6 @@ icon dispatcher {{ onlineDispatchersCount }} - - / {{ onlineTrainsCount }} icon train @@ -103,12 +98,6 @@ export default defineComponent({ return this.store.activeSceneryList.filter( (scenery) => scenery.region == this.store.region.id && scenery.dispatcherId != -1 ).length; - }, - - factorU() { - return this.onlineDispatchersCount == 0 - ? '-' - : (this.onlineTrainsCount / this.onlineDispatchersCount).toFixed(2); } }, components: { StatusIndicator, Clock, RegionDropdown } diff --git a/src/components/SceneryView/SceneryTimetable.vue b/src/components/SceneryView/SceneryTimetable.vue index 279775f..a1e451f 100644 --- a/src/components/SceneryView/SceneryTimetable.vue +++ b/src/components/SceneryView/SceneryTimetable.vue @@ -405,13 +405,6 @@ export default defineComponent({ width: 100%; } - .g-tooltip > .content { - z-index: 100; - color: white; - - left: 110%; - } - img { width: 1.1em; } diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index acb5484..f01a7b1 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -390,7 +390,7 @@ export default defineComponent({ $rowCol: #424242; .station_table { - height: 90vh; + height: calc(100vh - 150px); min-height: 550px; overflow: auto; font-weight: 500; diff --git a/src/components/StationsView/StationsStats.vue b/src/components/StationsView/StationsStats.vue new file mode 100644 index 0000000..9d34c2c --- /dev/null +++ b/src/components/StationsView/StationsStats.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts index a8f9408..dbda7fc 100644 --- a/src/store/mainStore.ts +++ b/src/store/mainStore.ts @@ -32,10 +32,7 @@ export const useMainStore = defineStore('mainStore', { modalLastClickedTarget: null, mousePos: { x: 0, y: 0 }, - popUpData: { key: null, content: '' }, - - stations: [] as Station[], - trainsOnline: [] as Train[] + popUpData: { key: null, content: '' } }) as MainStoreState, getters: { diff --git a/src/store/typings.ts b/src/store/typings.ts index b018c02..7860510 100644 --- a/src/store/typings.ts +++ b/src/store/typings.ts @@ -17,8 +17,6 @@ export interface MainStoreState { modalLastClickedTarget: EventTarget | null; mousePos: { x: number; y: number }; popUpData: { key: PopUpType | null; content: string }; - stations: Station[]; - trainsOnline: Train[]; } export interface StationJSONData { diff --git a/src/styles/global.scss b/src/styles/global.scss index 8d1fd59..feab088 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -298,3 +298,23 @@ a.a-button { } } } + +// Basic tooltip +[data-tooltip]:hover::after, +[data-tooltip]:focus::after { + position: absolute; + transform: translate(10px, -50%); + + content: attr(data-tooltip); + color: white; + background-color: #171717; + border-radius: 0.5em; + padding: 0.5em; + margin: 0 0.25em; + max-width: 300px; + z-index: 100; +} + +[data-tooltip] { + cursor: help; +} diff --git a/src/views/StationsView.vue b/src/views/StationsView.vue index 2bfcce0..fb4a830 100644 --- a/src/views/StationsView.vue +++ b/src/views/StationsView.vue @@ -22,13 +22,7 @@ -
-
- Średnia liczba rozkładów jazdy na dyżurnego: {{ avgTimetableCount }} | Dostępne - szlaki 1-torowe: {{ oneWayTracks }} (zelektr.) / {{ 0 }} (spalinowe) | - Dostępne szlaki 2-torowe: {{ 0 }} (zelektr.) / {{ 0 }} (spalinowe) | Otwarte - spawny: {{ 0 }} (PAS.) / {{ 0 }} (TOW.) / {{ 0 }} (LUZ.) -
+ @@ -40,56 +34,28 @@ import StationFilterCard from '../components/StationsView/StationFilterCard.vue' import { useStationFiltersStore } from '../store/stationFiltersStore'; import { useMainStore } from '../store/mainStore'; import Donation from '../components/Global/Donation.vue'; +import StationsStats from '../components/StationsView/StationsStats.vue'; export default defineComponent({ components: { StationTable, StationFilterCard, + StationsStats, Donation }, data: () => ({ filterCardOpen: false, - modalHidden: true, - STORAGE_KEY: 'options_saved', - focusedStationName: '', - filterStore: useStationFiltersStore(), - store: useMainStore(), + isDonationModalOpen: false, - isDonationModalOpen: false + filterStore: useStationFiltersStore(), + store: useMainStore() }), mounted() { this.filterStore.setupFilters(); }, - computed: { - avgTimetableCount() { - const scheduledTrainsTotal = this.store.activeSceneryList.reduce((acc, sc) => { - if (sc.region != 'eu') return acc; - - acc += sc.scheduledTrainCount.all; - - return acc; - }, 0); - - return ( - this.store.activeSceneryList.length != 0 - ? scheduledTrainsTotal / this.store.activeSceneryList.length - : 0 - ).toFixed(2); - }, - - oneWayTracks() { - // return this.computedStationList - // .filter((st) => st.onlineInfo && st.generalInfo?.routes.single) - // .map((st) => st.generalInfo!.routes.single.map((r) => r.routeName)) - // .join(', '); - - return []; - } - }, - methods: { toggleDonationModal(value: boolean) { this.isDonationModalOpen = value; @@ -102,30 +68,6 @@ export default defineComponent({ @import '../styles/variables.scss'; @import '../styles/responsive.scss'; -@keyframes blinkAnim { - 0%, - 100% { - opacity: 1; - } - - 50% { - opacity: 0; - } -} - -.indicator-anim { - &-enter-active, - &-leave-active { - transition: all 0.25s ease-in-out; - } - - &-enter, - &-leave-to { - transform: translateY(100%); - opacity: 0; - } -} - .stations-view { position: relative; display: flex; @@ -148,11 +90,6 @@ export default defineComponent({ margin-bottom: 0.5em; } -.stations-stats { - text-align: center; - color: #ccc; -} - button.btn-donation { $btnColor: #254069;