From aa7a6b220ef47b1f8b97d4b15d951ed08769b482 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 2 Jan 2023 18:30:09 +0100 Subject: [PATCH 01/10] =?UTF-8?q?feature:=20lvl=20maszynisty=20przy=20dzie?= =?UTF-8?q?nniku=20i=20poci=C4=85gach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JournalView/JournalTimetablesList.vue | 10 +++++++++- src/components/TrainsView/TrainInfo.vue | 11 ++++++++--- src/mixins/styleMixin.ts | 16 +++++++++++----- src/scripts/interfaces/Train.ts | 1 + src/scripts/interfaces/api/TimetablesAPIData.ts | 4 ++++ src/scripts/interfaces/api/TrainAPIData.ts | 1 + src/store/store.ts | 1 + 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/components/JournalView/JournalTimetablesList.vue b/src/components/JournalView/JournalTimetablesList.vue index ee08f29..b798f17 100644 --- a/src/components/JournalView/JournalTimetablesList.vue +++ b/src/components/JournalView/JournalTimetablesList.vue @@ -17,6 +17,13 @@ {{ timetable.trainNo }} | {{ timetable.driverName }} | #{{ timetable.id }} + + + | + + {{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel} lvl` }} + + @@ -140,6 +147,7 @@ import { defineComponent, PropType, ref } from 'vue'; import dateMixin from '../../mixins/dateMixin'; import imageMixin from '../../mixins/imageMixin'; import modalTrainMixin from '../../mixins/modalTrainMixin'; +import styleMixin from '../../mixins/styleMixin'; import { TimetableHistory } from '../../scripts/interfaces/api/TimetablesAPIData'; export default defineComponent({ @@ -150,7 +158,7 @@ export default defineComponent({ }, }, - mixins: [dateMixin, imageMixin, modalTrainMixin], + mixins: [dateMixin, imageMixin, modalTrainMixin, styleMixin], computed: { computedTimetableHistory() { diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 59541d2..97d4585 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -14,8 +14,12 @@  {{ train.trainNo }} | - {{ train.driverName }} - + + {{ train.driverName }} | + + {{ train.driverLevel < 2 ? 'L' : `${train.driverLevel} lvl` }} + + ? @@ -94,6 +98,7 @@ diff --git a/src/mixins/styleMixin.ts b/src/mixins/styleMixin.ts index 396180f..f7d9073 100644 --- a/src/mixins/styleMixin.ts +++ b/src/mixins/styleMixin.ts @@ -4,13 +4,19 @@ export default defineComponent({ methods: { calculateExpStyle(exp: number, isSupporter = false): string { const bgColor = exp > -1 ? (exp < 2 ? '#26B0D9' : `hsl(${-exp * 5 + 100}, 85%, 50%)`) : '#666'; - + const fontColor = exp > 14 || exp == -1 ? 'white' : 'black'; const boxShadow = isSupporter ? `box-shadow: 0 0 10px 2px ${bgColor};` : ''; - + return `background-color: ${bgColor}; color: ${fontColor}; ${boxShadow}`; }, + calculateTextExpStyle(exp: number): string { + const textColor = exp > -1 ? (exp < 2 ? '#26B0D9' : `hsl(${-exp * 5 + 100}, 75%, 50%)`) : '#666'; + + return `color: ${textColor};`; + }, + statusClasses(occupiedTo: string) { let className = ''; @@ -41,6 +47,6 @@ export default defineComponent({ } return className; - } - } -}) + }, + }, +}); diff --git a/src/scripts/interfaces/Train.ts b/src/scripts/interfaces/Train.ts index a57c8d6..b4e4dfb 100644 --- a/src/scripts/interfaces/Train.ts +++ b/src/scripts/interfaces/Train.ts @@ -12,6 +12,7 @@ export default interface Train { driverId: number; trainNo: number; driverName: string; + driverLevel: number; currentStationName: string; currentStationHash: string; locoURL: string; diff --git a/src/scripts/interfaces/api/TimetablesAPIData.ts b/src/scripts/interfaces/api/TimetablesAPIData.ts index c64ebfc..da13061 100644 --- a/src/scripts/interfaces/api/TimetablesAPIData.ts +++ b/src/scripts/interfaces/api/TimetablesAPIData.ts @@ -4,8 +4,12 @@ export interface TimetableHistory { timetableId: number; trainNo: number; trainCategoryCode: string; + driverId: number; driverName: string; + driverLevel: number | null; + driverIsSupporter: boolean; + route: string; twr: number; skr: number; diff --git a/src/scripts/interfaces/api/TrainAPIData.ts b/src/scripts/interfaces/api/TrainAPIData.ts index f417ca4..3147114 100644 --- a/src/scripts/interfaces/api/TrainAPIData.ts +++ b/src/scripts/interfaces/api/TrainAPIData.ts @@ -13,6 +13,7 @@ export default interface TrainAPIData { driverName: string; driverId: number; driverIsSupporter: boolean; + driverLevel?: number; currentStationName: string; currentStationHash: string; diff --git a/src/store/store.ts b/src/store/store.ts index 85d7a1b..b72cdc8 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -101,6 +101,7 @@ export const useStore = defineStore('store', { isTimeout: train.isTimeout, isSupporter: train.driverIsSupporter, + driverLevel: train.driverLevel, timetableData: timetable ? { From 25a248e95e57ec0229c551f9e0e30a44dae822a1 Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 3 Jan 2023 14:51:19 +0100 Subject: [PATCH 02/10] feature: animacje list --- src/App.scss | 6 +++- .../JournalView/JournalDispatchersList.vue | 32 +++++++---------- .../JournalView/JournalTimetablesList.vue | 24 +++---------- .../SceneryView/SceneryTimetable.vue | 34 ++----------------- src/components/TrainsView/TrainTable.vue | 6 ++-- src/mixins/styleMixin.ts | 2 +- src/styles/animations.scss | 15 ++++++++ src/styles/responsive.scss | 27 +++++++++------ src/types/Journal/JournalTimetablesTypes.ts | 2 +- src/views/JournalTimetables.vue | 8 ++--- 10 files changed, 64 insertions(+), 92 deletions(-) create mode 100644 src/styles/animations.scss diff --git a/src/App.scss b/src/App.scss index 5032e35..4fb119d 100644 --- a/src/App.scss +++ b/src/App.scss @@ -46,7 +46,11 @@ font-size: 1rem; @include smallScreen() { - font-size: calc(0.5rem + 1.3vw); + font-size: calc(0.5rem + 1.1vw); + } + + @include screenLandscape() { + font-size: calc(0.45rem + 0.8vw); } } diff --git a/src/components/JournalView/JournalDispatchersList.vue b/src/components/JournalView/JournalDispatchersList.vue index 0f1fb42..6477299 100644 --- a/src/components/JournalView/JournalDispatchersList.vue +++ b/src/components/JournalView/JournalDispatchersList.vue @@ -1,6 +1,5 @@ diff --git a/src/components/JournalView/JournalTimetablesList.vue b/src/components/JournalView/JournalTimetablesList.vue index b798f17..b2954fc 100644 --- a/src/components/JournalView/JournalTimetablesList.vue +++ b/src/components/JournalView/JournalTimetablesList.vue @@ -1,9 +1,9 @@