mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
feature: lvl maszynisty przy dzienniku i pociągach
This commit is contained in:
@@ -17,6 +17,13 @@
|
||||
<b>{{ timetable.trainNo }}</b>
|
||||
| <span>{{ timetable.driverName }}</span> |
|
||||
<span class="text--grayed">#{{ timetable.id }}</span>
|
||||
|
||||
<span v-if="timetable.driverLevel">
|
||||
|
|
||||
<b :style="calculateTextExpStyle(timetable.driverLevel)">
|
||||
{{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel} lvl` }}
|
||||
</b>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
@@ -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() {
|
||||
|
||||
@@ -14,8 +14,12 @@
|
||||
</strong>
|
||||
<strong class="train-number"> {{ train.trainNo }}</strong>
|
||||
|
|
||||
<span class="train-driver" :class="{ supporter: train.isSupporter }">{{ train.driverName }}</span>
|
||||
|
||||
<!-- <span class="train-driver" :class="{ supporter: train.isSupporter }">{{ train.driverName }}</span> -->
|
||||
{{ train.driverName }} |
|
||||
<b :style="calculateTextExpStyle(train.driverLevel)">
|
||||
{{ train.driverLevel < 2 ? 'L' : `${train.driverLevel} lvl` }}
|
||||
</b>
|
||||
|
||||
<b class="warning-timeout" v-if="train.isTimeout" :title="$t('trains.timeout')">?</b>
|
||||
</span>
|
||||
</div>
|
||||
@@ -94,6 +98,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import imageMixin from '../../mixins/imageMixin';
|
||||
import styleMixin from '../../mixins/styleMixin';
|
||||
import trainInfoMixin from '../../mixins/trainInfoMixin';
|
||||
import Train from '../../scripts/interfaces/Train';
|
||||
|
||||
@@ -110,7 +115,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
|
||||
mixins: [trainInfoMixin, imageMixin],
|
||||
mixins: [trainInfoMixin, imageMixin, styleMixin],
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ export default interface Train {
|
||||
driverId: number;
|
||||
trainNo: number;
|
||||
driverName: string;
|
||||
driverLevel: number;
|
||||
currentStationName: string;
|
||||
currentStationHash: string;
|
||||
locoURL: string;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,6 +13,7 @@ export default interface TrainAPIData {
|
||||
driverName: string;
|
||||
driverId: number;
|
||||
driverIsSupporter: boolean;
|
||||
driverLevel?: number;
|
||||
|
||||
currentStationName: string;
|
||||
currentStationHash: string;
|
||||
|
||||
@@ -101,6 +101,7 @@ export const useStore = defineStore('store', {
|
||||
isTimeout: train.isTimeout,
|
||||
|
||||
isSupporter: train.driverIsSupporter,
|
||||
driverLevel: train.driverLevel,
|
||||
|
||||
timetableData: timetable
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user