Skip to content

Commit

Permalink
feat: add line-through for non departure train
Browse files Browse the repository at this point in the history
  • Loading branch information
ludchieng committed May 21, 2023
1 parent f4a3d9d commit 3a52915
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 21 deletions.
9 changes: 7 additions & 2 deletions src/components/Stop/StopSchedulesDetailsTimes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
:sublabel="visit.arrivalStatus !== 'onTime' ? visit.arrivalStatus : null"
/>
<div>
<div v-if="visit.platform" class="way-label">
<div
v-if="visit.platform"
class="way-label"
>
Voie
</div>
<div class="way-value">{{ visit.platform }}</div>
<div class="way-value">
{{ visit.platform }}
</div>
</div>
<UiSchedulesDetailsTimeWrapped
v-if="visit.departureTime"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
/>
</div>
<div>
<div v-if="visit.platform" class="way-label">
<div
v-if="visit.platform"
class="way-label"
>
Voie
</div>
<div class="way-value">{{ visit.platform }}</div>
<div class="way-value">
{{ visit.platform }}
</div>
</div>
</div>
</template>
Expand Down
38 changes: 35 additions & 3 deletions src/components/Stop/StopSchedulesVisit.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<details
class="row"
:class="`row row-${variant}`"
>
<summary class="visit-summary">
<div class="visit-code">
Expand All @@ -9,6 +9,7 @@
<StopSchedulesVisitTime
:key="updateCounter"
:visit="visit"
:variant="variant"
/>
<div class="visit-destination">
{{ visit.destination }}
Expand Down Expand Up @@ -75,6 +76,8 @@ import StopSchedulesDetailsTimes from '@/components/Stop/StopSchedulesDetailsTim
import StopSchedulesDetailsTimesNonStopPassage from '@/components/Stop/StopSchedulesDetailsTimesNonStopPassage.vue'
import StopSchedulesVisitTime from '@/components/Stop/StopSchedulesVisitTime.vue'
import UiSchedulesDetailsRow from '@/components/ui/Schedules/UiSchedulesDetailsRow.vue'
import { PropType } from 'vue'
import { VisitType } from '@/utils/fetcher'
export default {
name: 'StopSchedulesVisit',
Expand All @@ -85,8 +88,26 @@ export default {
UiSchedulesDetailsRow,
},
props: {
updateCounter: {},
visit: {},
updateCounter: Number,
visit: {
type: Object as PropType<VisitType>,
required: true,
},
},
computed: {
variant () {
if (!this.visit) {
return 'normal'
}
if (this.visit.departureStatus === 'cancelled' || this.visit.arrivalStatus === 'cancelled') {
return 'alert'
}
if (this.visit.nonStopPassage || !this.visit.departureTime) {
return 'shaded'
} else {
return 'normal'
}
},
},
}
</script>
Expand All @@ -97,6 +118,17 @@ export default {
border-bottom: 1px solid #E6E6E6;
}
.row-alert .visit-destination,
.row-shaded .visit-destination {
text-decoration: line-through;
color: #AAAAAA;
}
.row-alert .visit-code,
.row-shaded .visit-code {
color: #AAAAAA;
}
.visit-summary {
display: flex;
margin-bottom: 0.25rem;
Expand Down
16 changes: 2 additions & 14 deletions src/components/Stop/StopSchedulesVisitTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script lang="ts">
import Vue, { PropType } from 'vue'
import { VisitType } from '@/utils/fetcher'
import UiSchedulesTime from '@/components/ui/Schedules/UiSchedulesTime.vue'
import UiSchedulesTime, { UiSchedulesTimeVariant } from '@/components/ui/Schedules/UiSchedulesTime.vue'
export default Vue.extend({
name: 'StopSchedulesVisitTime',
Expand All @@ -17,6 +17,7 @@ export default Vue.extend({
type: Object as PropType<VisitType>,
required: true,
},
variant: String as PropType<UiSchedulesTimeVariant>,
},
computed: {
time () {
Expand All @@ -25,19 +26,6 @@ export default Vue.extend({
: this.visit?.time
return ((visitTime - Date.now()) / 1000 / 60).toFixed(0)
},
variant () {
if (!this.visit) {
return 'normal'
}
if (this.visit.departureStatus === 'cancelled' || this.visit.arrivalStatus === 'cancelled') {
return 'alert'
}
if (this.visit.nonStopPassage || !this.visit.departureTime) {
return 'shaded'
} else {
return 'normal'
}
},
},
})
</script>

0 comments on commit 3a52915

Please sign in to comment.