Add current stop highlight
This commit is contained in:
parent
9e4a7c2d57
commit
0fc075663a
@ -1,5 +1,5 @@
|
|||||||
<div class="trip">
|
<div class="trip">
|
||||||
<ol class="trip__stops" v-dragscroll.x>
|
<ol class="trip__stops" v-dragscroll.x ref="stops">
|
||||||
<li v-for="stop in stops" class="trip__stop" :class="[ stop.current && 'trip__stop--current', stop.visited && 'trip__stop--visited' ]">
|
<li v-for="stop in stops" class="trip__stop" :class="[ stop.current && 'trip__stop--current', stop.visited && 'trip__stop--visited' ]">
|
||||||
<div class="trip__marker"/>
|
<div class="trip__marker"/>
|
||||||
<div class="trip__description">
|
<div class="trip__description">
|
||||||
|
@ -76,6 +76,10 @@ $trip-visited: rgba($dark, .3);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.trip__stop--current .trip__marker {
|
||||||
|
box-shadow: 0 0 .5rem $dark;
|
||||||
|
}
|
||||||
|
|
||||||
@each $type, $color in $line-types {
|
@each $type, $color in $line-types {
|
||||||
.trip--#{$type} {
|
.trip--#{$type} {
|
||||||
.trip__marker {
|
.trip__marker {
|
||||||
@ -85,6 +89,10 @@ $trip-visited: rgba($dark, .3);
|
|||||||
background: $color;
|
background: $color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.trip__stop--current .trip__marker {
|
||||||
|
box-shadow: 0 0 .5rem $color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +109,7 @@ $trip-visited: rgba($dark, .3);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.trip__stop--current .trip__marker {
|
.trip__stop--visited + .trip__stop:not(.trip__stop--visited) .trip__marker {
|
||||||
&::before {
|
&::before {
|
||||||
background: $trip-visited;
|
background: $trip-visited;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import Component from "vue-class-component";
|
|||||||
import { Prop } from "vue-property-decorator";
|
import { Prop } from "vue-property-decorator";
|
||||||
import { ScheduledStop } from "../model/trip";
|
import { ScheduledStop } from "../model/trip";
|
||||||
import { Stop } from "../model";
|
import { Stop } from "../model";
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
type ScheduledStopInfo = ScheduledStop & { visited: boolean, current: boolean };
|
type ScheduledStopInfo = ScheduledStop & { visited: boolean, current: boolean };
|
||||||
|
|
||||||
@ -12,14 +13,21 @@ export class TripComponent extends Vue {
|
|||||||
@Prop(Object) public current: Stop;
|
@Prop(Object) public current: Stop;
|
||||||
|
|
||||||
get stops(): ScheduledStopInfo[] {
|
get stops(): ScheduledStopInfo[] {
|
||||||
let visited = true;
|
|
||||||
|
|
||||||
return this.schedule.map(stop => ({
|
return this.schedule.map(stop => ({
|
||||||
...stop,
|
...stop,
|
||||||
current: stop.stop.id == this.current.id ? !(visited = false) : false,
|
current: stop.stop.id == this.current.id,
|
||||||
visited: visited,
|
visited: moment().isAfter(stop.departure),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const list = this.$refs['stops'] as HTMLUListElement;
|
||||||
|
const current = list.querySelector('.trip__stop--current') as HTMLLIElement;
|
||||||
|
|
||||||
|
if (!current) return;
|
||||||
|
|
||||||
|
list.scrollLeft = current.offsetLeft - (list.clientWidth + current.clientWidth) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.component('Trip', TripComponent);
|
Vue.component('Trip', TripComponent);
|
||||||
|
@ -45,10 +45,10 @@ export const messages: Module<MessagesState, RootState> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messages = await response.json() as Jsonified<Message>[];
|
const messages = await response.json() as Jsonified<Message>[];
|
||||||
commit('update', messages.map(m => ({
|
commit('update', messages.map(message => ({
|
||||||
...m,
|
...message,
|
||||||
validFrom: moment(m.validFrom),
|
validFrom: moment(message.validFrom),
|
||||||
validTo: moment(m.validTo),
|
validTo: moment(message.validTo),
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,9 @@ class ZtmGdanskDataUpdateSubscriber implements EventSubscriberInterface
|
|||||||
$this->logger->debug(sprintf("Saving %d stops tracks from ZTM Gdańsk.", count($stops)));
|
$this->logger->debug(sprintf("Saving %d stops tracks from ZTM Gdańsk.", count($stops)));
|
||||||
return collect($stops)
|
return collect($stops)
|
||||||
->filter(function ($stop) {
|
->filter(function ($stop) {
|
||||||
return $stop['nonpassenger'] !== null && $stop['nonpassenger'] !== 1;
|
return $stop['nonpassenger'] !== 1
|
||||||
|
&& $stop['virtual'] !== 1
|
||||||
|
&& $stop['depot'] !== 1;
|
||||||
})
|
})
|
||||||
->map(function ($stop) use ($provider) {
|
->map(function ($stop) use ($provider) {
|
||||||
return StopEntity::createFromArray([
|
return StopEntity::createFromArray([
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
<fa :icon="['fal', 'star']" fixed-width class="mr-1"></fa>
|
<fa :icon="['fal', 'star']" fixed-width class="mr-1"></fa>
|
||||||
Zapisane
|
Zapisane
|
||||||
</h2>
|
</h2>
|
||||||
<button class="btn btn-action" @click="visibility.picker = 'sech'">
|
<button class="btn btn-action" @click="visibility.picker = 'search'">
|
||||||
<fa :icon="['fal', 'search']" fixed-witdth></fa>
|
<fa :icon="['fal', 'search']" fixed-witdth></fa>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user