design: badge poziomów

This commit is contained in:
2023-02-12 12:58:23 +01:00
parent e14d328ed9
commit 59bd3fa2ef
7 changed files with 145 additions and 96 deletions
+1 -1
View File
@@ -46,7 +46,7 @@
font-size: 1rem; font-size: 1rem;
@include smallScreen() { @include smallScreen() {
font-size: calc(0.65rem + 1.1vw); font-size: calc(0.5rem + 1.1vw);
} }
@include screenLandscape() { @include screenLandscape() {
@@ -17,10 +17,10 @@
@keydown.enter="navigateToScenery(item.stationName, item.isOnline)" @keydown.enter="navigateToScenery(item.stationName, item.isOnline)"
tabindex="0" tabindex="0"
> >
<span> <span class="item-general">
<b <b
v-if="item.dispatcherLevel !== null" v-if="item.dispatcherLevel !== null"
class="dispatcher-level" class="level-badge dispatcher"
:style="calculateExpStyle(item.dispatcherLevel, item.dispatcherIsSupporter)" :style="calculateExpStyle(item.dispatcherLevel, item.dispatcherIsSupporter)"
> >
{{ item.dispatcherLevel >= 2 ? item.dispatcherLevel : 'L' }} {{ item.dispatcherLevel >= 2 ? item.dispatcherLevel : 'L' }}
@@ -31,7 +31,7 @@
<span class="region-badge" :class="item.region">PL1</span> <span class="region-badge" :class="item.region">PL1</span>
</span> </span>
<span> <span class="item-time">
<span :data-status="item.isOnline"> {{ item.isOnline ? $t('journal.online-since') : 'OFFLINE' }}&nbsp; </span> <span :data-status="item.isOnline"> {{ item.isOnline ? $t('journal.online-since') : 'OFFLINE' }}&nbsp; </span>
<span> <span>
{{ new Date(item.timestampFrom).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }} {{ new Date(item.timestampFrom).toLocaleTimeString('pl-PL', { timeStyle: 'short' }) }}
@@ -99,18 +99,9 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../styles/animations.scss'; @import '../../styles/animations.scss';
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
@import '../../styles/badge.scss';
@import '../../styles/JournalSection.scss'; @import '../../styles/JournalSection.scss';
.region-badge {
padding: 0.1em 0.5em;
border-radius: 0.5em;
font-weight: bold;
&.eu {
background-color: forestgreen;
}
}
li.sticky { li.sticky {
position: sticky; position: sticky;
top: 0; top: 0;
@@ -141,6 +132,16 @@ li.sticky {
} }
} }
.item-general {
display: flex;
align-items: center;
gap: 0.25em;
.level-badge {
margin-right: 0.25em;
}
}
.journal_day { .journal_day {
margin-bottom: 1em; margin-bottom: 1em;
padding: 0.5em; padding: 0.5em;
@@ -157,16 +158,4 @@ li.sticky {
font-weight: bold; font-weight: bold;
} }
} }
.dispatcher-level {
display: inline-block;
text-align: center;
line-height: 1.45em;
width: 1.45em;
height: 1.45em;
margin-right: 0.45em;
border-radius: 0.25em;
}
</style> </style>
@@ -6,25 +6,35 @@
:key="timetable.id" :key="timetable.id"
> >
<div class="journal_item-info"> <div class="journal_item-info">
<div class="info-top"> <div class="info-general">
<span <span
class="general-train"
tabindex="0" tabindex="0"
@click="showTimetable(timetable)" @click="showTimetable(timetable)"
@keydown.enter="showTimetable(timetable)" @keydown.enter="showTimetable(timetable)"
style="cursor: pointer" style="cursor: pointer"
> >
<b class="text--primary">{{ timetable.trainCategoryCode }}&nbsp;</b>
<b>{{ timetable.trainNo }}</b>
| <span>{{ timetable.driverName }}</span> |
<span class="text--grayed">#{{ timetable.id }}</span> <span class="text--grayed">#{{ timetable.id }}</span>
<span v-if="timetable.driverLevel !== null"> &bull;
| <span>
<b :style="calculateTextExpStyle(timetable.driverLevel, timetable.driverIsSupporter)"> <strong class="text--primary">
{{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel} lvl` }} {{ timetable.trainCategoryCode }}
</b> </strong>
<strong>&nbsp;{{ timetable.trainNo }}</strong>
</span> </span>
&bull;
<strong
v-if="timetable.driverLevel !== null"
class="level-badge driver"
:style="calculateExpStyle(timetable.driverLevel, timetable.driverIsSupporter)"
>
{{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel}` }}
</strong>
<strong>{{ timetable.driverName }}</strong>
</span> </span>
<span>
<span class="general-time">
<b class="info-date">{{ localeDay(timetable.beginDate, $i18n.locale) }}</b> <b class="info-date">{{ localeDay(timetable.beginDate, $i18n.locale) }}</b>
<b <b
class="info-status" class="info-status"
@@ -189,6 +199,7 @@ export default defineComponent({
}, },
showTimetable(timetable: TimetableHistory) { showTimetable(timetable: TimetableHistory) {
if (!timetable) return;
if (timetable.terminated) return; if (timetable.terminated) return;
this.selectModalTrain(timetable.driverName + timetable.trainNo.toString()); this.selectModalTrain(timetable.driverName + timetable.trainNo.toString());
@@ -209,7 +220,6 @@ export default defineComponent({
@import '../../styles/badge.scss'; @import '../../styles/badge.scss';
@import '../../styles/JournalSection.scss'; @import '../../styles/JournalSection.scss';
hr { hr {
margin: 0.25em 0; margin: 0.25em 0;
} }
@@ -236,10 +246,14 @@ hr {
} }
} }
&-top { &-general {
display: flex; display: flex;
flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 0.25em;
margin-bottom: 0.5em;
} }
&-route { &-route {
@@ -251,6 +265,12 @@ hr {
} }
} }
.general-train {
display: flex;
align-items: center;
gap: 0.25em;
}
ul.stock-list { ul.stock-list {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
@@ -291,14 +311,9 @@ ul.stock-list {
} }
@include smallScreen { @include smallScreen {
.info-top { .info-general {
flex-direction: column; flex-direction: column;
span {
margin: 0.1em auto;
}
} }
.info-extended { .info-extended {
text-align: center; text-align: center;
} }
@@ -5,25 +5,31 @@
<div class="list-warning" v-else-if="dispatcherHistoryList.length == 0">{{ $t('scenery.history-list-empty') }}</div> <div class="list-warning" v-else-if="dispatcherHistoryList.length == 0">{{ $t('scenery.history-list-empty') }}</div>
<ul class="history-list" v-else> <ul class="history-list" v-else>
<li class="list-item" v-for="historyItem in dispatcherHistoryList"> <li class="list-item" v-for="item in dispatcherHistoryList">
<div> <router-link class="item-general" :to="`/journal/dispatchers?dispatcherName=${item.dispatcherName}`">
<router-link :to="`/journal/dispatchers?dispatcherName=${historyItem.dispatcherName}`"> <span class="text--grayed">#{{ item.stationHash }}&nbsp;</span>
<span class="text--grayed">#{{ historyItem.stationHash }}&nbsp;</span> <b
<b>{{ historyItem.dispatcherName }}</b> v-if="item.dispatcherLevel !== null"
</router-link> class="level-badge dispatcher"
</div> :style="calculateExpStyle(item.dispatcherLevel, item.dispatcherIsSupporter)"
>
{{ item.dispatcherLevel >= 2 ? item.dispatcherLevel : 'L' }}
</b>
<div v-if="historyItem.timestampTo"> <b>{{ item.dispatcherName }}</b>
<b>{{ $d(historyItem.timestampFrom) }}</b> </router-link>
{{ timestampToString(historyItem.timestampFrom) }} <div v-if="item.timestampTo">
- {{ timestampToString(historyItem.timestampTo) }} ({{ calculateDuration(historyItem.currentDuration) }}) <b>{{ $d(item.timestampFrom) }}</b>
{{ timestampToString(item.timestampFrom) }}
- {{ timestampToString(item.timestampTo) }} ({{ calculateDuration(item.currentDuration) }})
</div> </div>
<div class="dispatcher-online" v-else> <div class="dispatcher-online" v-else>
{{ $t('journal.online-since') }} {{ $t('journal.online-since') }}
<b>{{ timestampToString(historyItem.timestampFrom) }}</b> <b>{{ timestampToString(item.timestampFrom) }}</b>
({{ calculateDuration(historyItem.currentDuration) }}) ({{ calculateDuration(item.currentDuration) }})
</div> </div>
</li> </li>
</ul> </ul>
@@ -39,10 +45,11 @@ import { DispatcherHistory } from '../../scripts/interfaces/api/DispatchersAPIDa
import Station from '../../scripts/interfaces/Station'; import Station from '../../scripts/interfaces/Station';
import { URLs } from '../../scripts/utils/apiURLs'; import { URLs } from '../../scripts/utils/apiURLs';
import Loading from '../Global/Loading.vue'; import Loading from '../Global/Loading.vue';
import styleMixin from '../../mixins/styleMixin';
export default defineComponent({ export default defineComponent({
name: 'SceneryDispatchersHistory', name: 'SceneryDispatchersHistory',
mixins: [dateMixin], mixins: [dateMixin, styleMixin],
props: { props: {
station: { station: {
type: Object as PropType<Station>, type: Object as PropType<Station>,
@@ -96,6 +103,12 @@ export default defineComponent({
line-height: 1.5em; line-height: 1.5em;
} }
.item-general {
display: flex;
align-items: center;
gap: 0.25em;
}
.dispatcher-online { .dispatcher-online {
color: springgreen; color: springgreen;
} }
+4 -4
View File
@@ -1,10 +1,10 @@
<template> <template>
<div class="scenery-info"> <div class="scenery-info">
<section v-if="!timetableOnly"> <section v-if="!timetableOnly">
<div class="info-general" v-if="station.generalInfo"> <div class="scenery-info-general" v-if="station.generalInfo">
<scenery-info-icons :station="station" /> <scenery-info-icons :station="station" />
<div class="general-list"> <div class="scenery-general-list">
<span> <span>
<b>{{ $t('availability.title') }}:</b> {{ $t(`availability.${station.generalInfo.availability}`) }} <b>{{ $t('availability.title') }}:</b> {{ $t(`availability.${station.generalInfo.availability}`) }}
@@ -130,11 +130,11 @@ h3.section-header {
margin-top: 1em; margin-top: 1em;
} }
.info-general { .scenery-info-general {
margin-top: 1em; margin-top: 1em;
} }
.general-list { .scenery-general-list {
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
+7 -5
View File
@@ -14,12 +14,11 @@
<span v-if="train.timetableData">{{ train.timetableData.category }}&nbsp;</span> <span v-if="train.timetableData">{{ train.timetableData.category }}&nbsp;</span>
<span class="train-number">{{ train.trainNo }}</span> <span class="train-number">{{ train.trainNo }}</span>
</strong> </strong>
<span>|</span> <span>&bull;</span>
<span>{{ train.driverName }}</span> <b class="level-badge driver" :style="calculateExpStyle(train.driverLevel, train.isSupporter)">
<span>|</span> {{ train.driverLevel < 2 ? 'L' : `${train.driverLevel}` }}
<b :style="calculateTextExpStyle(train.driverLevel, train.isSupporter)">
{{ train.driverLevel < 2 ? 'L' : `${train.driverLevel} lvl` }}
</b> </b>
<span>{{ train.driverName }}</span>
</div> </div>
<div class="timetable_route" v-if="train.timetableData"> <div class="timetable_route" v-if="train.timetableData">
@@ -117,6 +116,8 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../styles/responsive.scss'; @import '../../styles/responsive.scss';
@import '../../styles/badge.scss';
.image-warning { .image-warning {
height: 1em; height: 1em;
@@ -172,6 +173,7 @@ export default defineComponent({
flex-wrap: wrap; flex-wrap: wrap;
gap: 0.25em; gap: 0.25em;
margin-right: 1.5em;
} }
.train-status-badges { .train-status-badges {
display: flex; display: flex;
+30
View File
@@ -26,3 +26,33 @@
} }
} }
} }
.level-badge {
display: flex;
justify-content: center;
align-items: center;
font-size: 0.9em;
&.driver {
border-radius: 50%;
width: 1.7em;
height: 1.7em;
}
&.dispatcher {
border-radius: 0.25em;
width: 1.6em;
height: 1.6em;
}
}
.region-badge {
padding: 0 0.5em;
border-radius: 0.5em;
font-weight: bold;
&.eu {
background-color: forestgreen;
}
}