Zmiany w wyglądzie listy pociągów

This commit is contained in:
2020-11-05 01:15:12 +01:00
parent fe3a15c452
commit 42f84643cc
13 changed files with 258 additions and 157 deletions
+1 -3
View File
@@ -39,9 +39,7 @@
</transition> </transition>
</main> </main>
<footer class="app-footer flex"> <footer class="app-footer flex">&copy; Spythere 2020</footer>
<span>&copy; Spythere 2020</span>
</footer>
<transition name="message-anim" mode="out-in"> <transition name="message-anim" mode="out-in">
<span :key="data.dataConnectionStatus"> <span :key="data.dataConnectionStatus">
+26 -13
View File
@@ -21,7 +21,8 @@
<span <span
class="option-content" class="option-content"
:class="option.section + (option.value ? ' checked' : '')" :class="option.section + (option.value ? ' checked' : '')"
>{{option.content}}</span> >{{ option.content }}</span
>
</label> </label>
</div> </div>
</div> </div>
@@ -39,17 +40,24 @@
@change="handleInput" @change="handleInput"
/> />
<span class="slider-value">{{slider.value}}</span> <span class="slider-value">{{ slider.value }}</span>
<div class="slider-content">{{slider.content}}</div> <div class="slider-content">{{ slider.content }}</div>
</div> </div>
</div> </div>
<div class="card-save"> <div class="card-save">
<div class="option"> <div class="option save">
<label class="option-label"> <label class="option-label">
<input class="option-input" type="checkbox" v-model="saveOptions" @change="saveFilters" /> <input
<span class="option-content save" :class="{'checked': saveOptions}">ZAPISZ FILTRY</span> class="option-input"
type="checkbox"
v-model="saveOptions"
@change="saveFilters"
/>
<span class="option-content save" :class="{ checked: saveOptions }"
>ZAPISZ FILTRY</span
>
</label> </label>
</div> </div>
</div> </div>
@@ -161,7 +169,8 @@ export default class FilterCard extends Vue {
background: #262a2e; background: #262a2e;
font-size: calc(0.75rem + 0.4vw); font-size: calc(0.75rem + 0.45vw);
box-shadow: 0 0 15px 5px #474747; box-shadow: 0 0 15px 5px #474747;
@include smallScreen() { @include smallScreen() {
@@ -175,12 +184,6 @@ export default class FilterCard extends Vue {
} }
.card { .card {
&-exit {
img {
width: 1.2em;
}
}
&-title { &-title {
font-size: 2em; font-size: 2em;
font-weight: 700; font-weight: 700;
@@ -217,6 +220,12 @@ export default class FilterCard extends Vue {
font-size: 0.9em; font-size: 0.9em;
} }
} }
&-exit {
img {
width: 2em;
}
}
} }
.option { .option {
@@ -248,6 +257,10 @@ export default class FilterCard extends Vue {
transition: all 0.2s; transition: all 0.2s;
&.save {
font-size: 0.8em;
}
&:not(.checked) { &:not(.checked) {
background-color: #585858; background-color: #585858;
+4 -60
View File
@@ -137,7 +137,7 @@
<h3 class="users-title title">GRACZE NA STACJI</h3> <h3 class="users-title title">GRACZE NA STACJI</h3>
<div class="users-content"> <div class="users-content">
<div <div
class="user" class="user-badge"
:class="train.stopStatus" :class="train.stopStatus"
v-for="train in computedStationTrains" v-for="train in computedStationTrains"
:key="train.trainNo + train.driverName" :key="train.trainNo + train.driverName"
@@ -168,7 +168,7 @@
<StationTimetable <StationTimetable
:class="{ show: cardMode == 1 }" :class="{ show: cardMode == 1 }"
:scheduledTrains="computedScheduledTrains" :scheduledTrains="this.stationInfo.scheduledTrains"
:stationName="stationInfo.stationName" :stationName="stationInfo.stationName"
/> />
</section> </section>
@@ -202,28 +202,9 @@ export default class StationCard extends styleMixin {
: `${this.stationInfo.dispatcherExp}`; : `${this.stationInfo.dispatcherExp}`;
} }
get computedScheduledTrains() {
return this.stationInfo.scheduledTrains.map(scheduledTrain => {
let stopStatus = "";
let stopLabel = "";
if (scheduledTrain.stopInfo.terminatesHere && scheduledTrain.stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
else if (!scheduledTrain.stopInfo.terminatesHere && scheduledTrain.stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && !scheduledTrain.stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && scheduledTrain.stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
else if (scheduledTrain.currentStationName != this.stationInfo.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
return {
...scheduledTrain,
stopStatus,
stopLabel
}
})
}
get computedStationTrains() { get computedStationTrains() {
return this.stationInfo.stationTrains.map(stationTrain => { return this.stationInfo.stationTrains.map(stationTrain => {
const scheduledData = this.computedScheduledTrains.find(scheduledTrain => scheduledTrain.trainNo === stationTrain.trainNo); const scheduledData = this.stationInfo.scheduledTrains.find(scheduledTrain => scheduledTrain.trainNo === stationTrain.trainNo);
return { return {
...stationTrain, ...stationTrain,
@@ -237,6 +218,7 @@ export default class StationCard extends styleMixin {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../styles/variables.scss"; @import "../../styles/variables.scss";
@import "../../styles/responsive.scss"; @import "../../styles/responsive.scss";
@import "../../styles/user_badge.scss";
.title { .title {
color: $accentCol; color: $accentCol;
@@ -425,44 +407,6 @@ export default class StationCard extends styleMixin {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
& > .user {
padding: 0.3rem;
margin: 0.3rem;
border: 1px solid white;
border-radius: 0.4em;
&.borderless {
border: none;
margin: 0;
padding: 0;
}
&.no-timetable {
border: 1px solid #aaa;
a {
color: #aaa;
pointer-events: none;
}
}
&.departed {
border: 1px solid lime;
}
&.stopped {
border: 1px solid #ffa600;
}
&.online {
border: 1px solid gold;
}
&.terminated {
border: 1px solid red;
}
}
} }
} }
@@ -25,8 +25,9 @@
<span> <span>
<strong>{{ scheduledTrain.category }}</strong> <strong>{{ scheduledTrain.category }}</strong>
{{ scheduledTrain.trainNo }} {{ scheduledTrain.trainNo }}
</span> </router-link </span>
>| </router-link>
|
<span> <span>
<a <a
:href=" :href="
+4 -4
View File
@@ -5,12 +5,12 @@
<div class="title">Sortuj według</div> <div class="title">Sortuj według</div>
<div class="selected" @click="toggleOptionList"> <div class="selected" @click="toggleOptionList">
<span>{{sorterName}}</span> <span>{{ sorterName }}</span>
<img :src="require('@/assets/icon-select.svg')" alt="icon-select" /> <img :src="require('@/assets/icon-select.svg')" alt="icon-select" />
</div> </div>
<div class="options-container"> <div class="options-container">
<ul class="options-list" :class="{'open': listOpen}"> <ul class="options-list" :class="{ open: listOpen }">
<li <li
class="option" class="option"
v-for="(option, i) in sortOptionList" v-for="(option, i) in sortOptionList"
@@ -18,7 +18,7 @@
@click="() => chooseOption(option)" @click="() => chooseOption(option)"
> >
<input type="radio" name="sort" :id="option.id" /> <input type="radio" name="sort" :id="option.id" />
<label :for="option.id">{{option.content}}</label> <label :for="option.id">{{ option.content }}</label>
</li> </li>
</ul> </ul>
</div> </div>
@@ -137,7 +137,7 @@ export default class TrainSorter extends Vue {
top: 0; top: 0;
left: 0; left: 0;
z-index: 5; z-index: 10;
width: 100%; width: 100%;
background-color: rgba(#222, 0.95); background-color: rgba(#222, 0.95);
+1 -1
View File
@@ -200,7 +200,7 @@ export default class TrainStats extends Vue {
.train-stats { .train-stats {
padding: 0.3em 0; padding: 0.3em 0;
font-size: 1.1em; font-size: 1.1em;
z-index: 2; z-index: 5;
position: relative; position: relative;
} }
+96 -69
View File
@@ -6,47 +6,59 @@
<ul class="train-list"> <ul class="train-list">
<li <li
class="train-item" class="train-row"
v-for="(train, i) in computedTrains" v-for="(train, i) in computedTrains"
:key="i" :key="i"
:id="train.timetableData.timetableId" :id="train.timetableData.timetableId"
@click="
() => {
changeFocusedTrain(train.trainNo);
}
"
> >
<span class="train-info"> <span class="wrapper">
<span class="info"> <span
<div class="info-top"> class="info"
@click="changeScheduleShowState(train.timetableData.timetableId)"
>
<div class="info-main">
<div class="info-category"> <div class="info-category">
<span> <span>
<strong>{{ train.timetableData.category }}</strong> <strong>{{ train.timetableData.category }}</strong>
{{ train.trainNo }} | {{ train.trainNo }} |
<span style="color: gold" <span style="color: gold">
>{{ train.timetableData.routeDistance }} km</span {{ train.timetableData.routeDistance }} km
> </span>
</span> </span>
<span> <span>
<span class="warning twr" v-if="train.timetableData.TWR" <span class="warning twr" v-if="train.timetableData.TWR">
>TWR</span TWR
> </span>
<span class="warning skr" v-if="train.timetableData.SKR" <span class="warning skr" v-if="train.timetableData.SKR">
>SKR</span SKR
> </span>
</span> </span>
</div> </div>
<div class="info-route"> <div class="info-route">
<strong> <span class="info-route-text">
{{ train.timetableData.route.replace("|", " - ") }} <strong>
</strong> {{ train.timetableData.route.replace("|", " - ") }}
</strong>
</span>
<span class="info-route-arrow">
<img
:src="
showedSchedule === train.timetableData.timetableId
? ascSVG
: descSVG
"
alt="asc-arrow"
/>
</span>
</div> </div>
<div class="info-stations"> <div class="info-stops">
<span v-if="train.timetableData.followingStops.length > 2"> <span v-if="train.timetableData.followingStops.length > 2">
Przez: Przez:
<span <span
v-html=" v-html="
generateStopList(train.timetableData.followingStops) generateStopList(train.timetableData.followingStops)
@@ -57,18 +69,16 @@
</div> </div>
<div class="info-bottom"> <div class="info-bottom">
<span class="info-online" :class="{ online: train.online }">{{ <span
train.online ? "ONLINE" : "OFFLINE" class="info-label user-badge tooltip"
}}</span> :class="train.stopStatus"
:style="!train.online ? 'color: gray' : ''"
<button v-if="train.stopStatus"
class="button"
@click="
changeScheduleShowState(train.timetableData.timetableId)
"
> >
ROZKŁAD JAZDY {{ train.stopLabel }}
</button>
<span class="content" v-if="!train.online">Pociąg offline</span>
</span>
</div> </div>
</span> </span>
@@ -77,55 +87,58 @@
<a <a
:href="'https://td2.info.pl/profile/?u=' + train.driverId" :href="'https://td2.info.pl/profile/?u=' + train.driverId"
target="_blank" target="_blank"
>{{ train.driverName }}</a
> >
<span style="color: #bbb; margin-left: 1em"> {{ train.driverName }}
{{ train.locoType }} </a>
</span>
</span> </span>
<span class="driver-type">
{{ train.locoType }}
</span>
<span class="driver-loco"> <span class="driver-loco">
<img :src="train.locoURL" @error="onImageError" /> <img :src="train.locoURL" @error="onImageError" />
</span> </span>
</span> </span>
<span class="stats"> <span class="stats">
<div class="stats-general"> <div class="stats-main">
<span class="stat mass"> <span class="mass">
<img :src="massIcon" alt="icon-mass" /> <img :src="massIcon" alt="icon-mass" />
{{ train.mass / 1000 }}t {{ train.mass / 1000 }}t
</span> </span>
<span class="stat speed"> <span class="speed">
<img :src="speedIcon" alt="icon-speed" /> <img :src="speedIcon" alt="icon-speed" />
{{ train.speed }} km/h {{ train.speed }} km/h
</span> </span>
<span class="stat length"> <span class="length">
<img :src="lengthIcon" alt="icon-length" /> <img :src="lengthIcon" alt="icon-length" />
{{ train.length }}m {{ train.length }}m
</span> </span>
</div> </div>
<div class="stats-position"> <div class="stats-position">
<span class="stat station"> <span class="station">
<div class="stat-icon"> <div class="stat-icon">
<img :src="sceneryIcon" alt="icon-scenery" /> <img :src="sceneryIcon" alt="icon-scenery" />
</div> </div>
{{ train.currentStationName || "---" }} {{ train.currentStationName || "---" }}
</span> </span>
<span class="stat track"> <span class="track">
<div class="stat-icon"> <div class="stat-icon">
<img :src="routeIcon" alt="icon-scenery" /> <img :src="routeIcon" alt="icon-scenery" />
</div> </div>
{{ train.connectedTrack || "---" }} {{ train.connectedTrack || "---" }}
</span> </span>
<span class="stat signal"> <span class="signal">
<div class="stat-icon"> <div class="stat-icon">
<img :src="signalIcon" alt="icon-scenery" /> <img :src="signalIcon" alt="icon-scenery" />
</div> </div>
{{ train.signal || "---" }} {{ train.signal || "---" }}
</span> </span>
<span class="stat distance"> <span class="distance">
<div class="stat-icon"> <div class="stat-icon">
<img :src="distanceIcon" alt="icon-scenery" /> <img :src="distanceIcon" alt="icon-scenery" />
</div> </div>
@@ -151,6 +164,9 @@ import { Vue, Component, Prop, Watch } from "vue-property-decorator";
const unknownTrainImage = require("@/assets/unknown.png"); const unknownTrainImage = require("@/assets/unknown.png");
const ascSVG = require("@/assets/icon-arrow-asc.svg");
const descSVG = require("@/assets/icon-arrow-desc.svg");
import Train from "@/scripts/interfaces/Train"; import Train from "@/scripts/interfaces/Train";
import Station from "@/scripts/interfaces/Station"; import Station from "@/scripts/interfaces/Station";
@@ -164,6 +180,9 @@ export default class TrainTable extends Vue {
showedSchedule = 0; showedSchedule = 0;
ascSVG = ascSVG;
descSVG = descSVG;
speedIcon: string = require("@/assets/icon-speed.svg"); speedIcon: string = require("@/assets/icon-speed.svg");
massIcon: string = require("@/assets/icon-mass.svg"); massIcon: string = require("@/assets/icon-mass.svg");
lengthIcon: string = require("@/assets/icon-length.svg"); lengthIcon: string = require("@/assets/icon-length.svg");
@@ -192,15 +211,14 @@ export default class TrainTable extends Vue {
}, []).join(" * "); }, []).join(" * ");
} }
changeFocusedTrain(trainNo: number) {
// this.$emit('changeFocusedTrain', trainNo.toString());
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../styles/responsive.scss"; @import "../../styles/responsive.scss";
@import "../../styles/variables.scss"; @import "../../styles/variables.scss";
@import "../../styles/user_badge.scss";
.no-trains { .no-trains {
text-align: center; text-align: center;
@@ -214,38 +232,36 @@ export default class TrainTable extends Vue {
.train { .train {
&-list { &-list {
overflow: auto;
@include smallScreen() { @include smallScreen() {
width: 100%; width: 100%;
} }
} }
&-item { &-row {
padding: 1rem; padding: 1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
background-color: $primaryCol; background-color: $primaryCol;
cursor: pointer; cursor: pointer;
}
}
.train-info { & > .wrapper {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
font-size: calc(0.4rem + 0.5vw); font-size: calc(0.4rem + 0.5vw);
@include smallScreen() { @include smallScreen() {
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: repeat(3, minmax(100px, 1fr)); grid-template-rows: repeat(3, minmax(100px, 1fr));
font-size: 0.8rem; font-size: 0.8rem;
gap: 0.4em 0; gap: 0.4em 0;
} }
@include bigScreen() { @include bigScreen() {
font-size: 1.1rem; font-size: 1.1rem;
}
}
} }
} }
@@ -265,9 +281,14 @@ export default class TrainTable extends Vue {
&-route { &-route {
width: 100%; width: 100%;
font-size: 1.2em; font-size: 1.2em;
&-arrow img {
border: 2px solid white;
vertical-align: middle;
}
} }
&-stations { &-stops {
margin-top: 0.35em; margin-top: 0.35em;
margin-bottom: 1rem; margin-bottom: 1rem;
@@ -319,6 +340,12 @@ export default class TrainTable extends Vue {
&-name { &-name {
margin: 0 0.3em; margin: 0 0.3em;
font-weight: bold;
}
&-type {
color: #bbb;
margin-left: 1em;
} }
&-loco { &-loco {
@@ -333,11 +360,11 @@ export default class TrainTable extends Vue {
} }
.stats { .stats {
&-general { &-main {
display: flex; display: flex;
margin-bottom: 1.5em; margin-bottom: 1.5em;
& > .stat { & > span {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -363,7 +390,7 @@ export default class TrainTable extends Vue {
color: #00cff3; color: #00cff3;
} }
& > .stat { & > span {
width: 100%; width: 100%;
img { img {
+3
View File
@@ -35,5 +35,8 @@ export default interface Station {
currentStationName: string; currentStationName: string;
category: string; category: string;
stopInfo: TrainStop; stopInfo: TrainStop;
stopLabel: string;
stopStatus: string;
}[]; }[];
} }
+3
View File
@@ -24,4 +24,7 @@ export default interface Train {
SKR: boolean; SKR: boolean;
routeDistance: number; routeDistance: number;
}; };
stopStatus: string;
stopLabel: string;
} }
+21 -4
View File
@@ -370,7 +370,7 @@ export default class Store extends VuexModule {
@Mutation @Mutation
private updateTimetableData(timetableList: any[]) { private updateTimetableData(timetableList: any[]) {
this.stationList = this.stationList.map(station => { this.stationList = this.stationList.map(station => {
const scheduledTrains = timetableList.reduce((acc, timetableData: any) => { const scheduledTrains: Station['scheduledTrains'] = timetableList.reduce((acc: Station['scheduledTrains'], timetableData: any) => {
const scheduledIndex = timetableData const scheduledIndex = timetableData
? timetableData.followingStops.findIndex((stop: any) => { ? timetableData.followingStops.findIndex((stop: any) => {
const stationName = station.stationName.toLowerCase(); const stationName = station.stationName.toLowerCase();
@@ -385,7 +385,16 @@ export default class Store extends VuexModule {
: -1; : -1;
if (scheduledIndex >= 0) { if (scheduledIndex >= 0) {
const scheduledData = timetableData.followingStops[scheduledIndex]; const stopInfo = timetableData.followingStops[scheduledIndex];
let stopStatus = "";
let stopLabel = "";
if (stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
else if (!stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
else if (timetableData.currentStationName == station.stationName && !stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
else if (timetableData.currentStationName == station.stationName && stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
else if (timetableData.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
acc.push({ acc.push({
trainNo: timetableData.trainNo, trainNo: timetableData.trainNo,
@@ -393,7 +402,9 @@ export default class Store extends VuexModule {
driverId: timetableData.driverId, driverId: timetableData.driverId,
currentStationName: timetableData.currentStationName, currentStationName: timetableData.currentStationName,
category: timetableData.category, category: timetableData.category,
stopInfo: scheduledData, stopInfo,
stopLabel,
stopStatus
}); });
} }
@@ -406,7 +417,13 @@ export default class Store extends VuexModule {
this.trainList = this.trainList.reduce((acc, train) => { this.trainList = this.trainList.reduce((acc, train) => {
const timetableData = timetableList.find(data => data && data.trainNo === train.trainNo); const timetableData = timetableList.find(data => data && data.trainNo === train.trainNo);
if (timetableData) acc.push({ ...train, timetableData }); if (timetableData) {
const trainData = this.stationList
.find(station => station.stationName === train.currentStationName)?.scheduledTrains
.find(stationTrain => stationTrain.trainNo === train.trainNo);
acc.push({ ...train, timetableData, stopStatus: trainData?.stopStatus || "", stopLabel: trainData?.stopLabel || "" });
}
return acc; return acc;
}, [] as Train[]); }, [] as Train[]);
+44
View File
@@ -16,6 +16,50 @@
} }
} }
.tooltip {
position: relative;
display: inline-block;
z-index: 5;
& > .content {
visibility: hidden;
width: 120px;
background-color: #830000;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
font-size: 1rem;
position: absolute;
bottom: 155%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
&::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #aa0000 transparent transparent transparent;
}
}
&:hover > .content {
visibility: visible;
opacity: 1;
}
}
html { html {
scroll-behavior: smooth; scroll-behavior: smooth;
} }
+48
View File
@@ -0,0 +1,48 @@
$no-timetable: #aaa;
$departed: lime;
$stopped: #ffa600;
$online: gold;
$terminated: red;
.user-badge {
border: 1px solid white;
z-index: 4;
margin-top: 0.3rem;
margin-right: 0.3rem;
border-radius: 0.7em;
padding: 0.2em 0.5em;
font-size: 0.95em;
&.borderless {
border: none;
margin: 0;
padding: 0;
}
&.no-timetable {
border: 1px solid $no-timetable;
a {
color: $no-timetable;
pointer-events: none;
}
}
&.departed {
border: 1px solid $departed;
}
&.stopped {
border: 1px solid $stopped;
}
&.online {
border: 1px solid $online;
}
&.terminated {
border: 1px solid $terminated;
}
}
+4 -1
View File
@@ -12,7 +12,10 @@
</div> </div>
<TrainStats :trains="trains" /> <TrainStats :trains="trains" />
<TrainTable :computedTrains="computedTrains" @changeFocusedTrain="changeFocusedTrain" /> <TrainTable
:computedTrains="computedTrains"
@changeFocusedTrain="changeFocusedTrain"
/>
</div> </div>
</section> </section>
</template> </template>