mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 22:08:12 +00:00
src/components/App
This commit is contained in:
@@ -25,7 +25,6 @@ export default defineComponent({});
|
|||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
outline: none;
|
|
||||||
padding: 0.35em 0.65em;
|
padding: 0.35em 0.65em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="train-info">
|
<div class="train-info">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<train-info-simple :train="train" v-if="simpleView" />
|
<train-info-simple :train="train" />
|
||||||
<train-info-extended :train="train" v-else />
|
|
||||||
|
<!-- <train-info-extended :train="train" v-else /> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -21,11 +22,6 @@ export default defineComponent({
|
|||||||
type: Object as () => Train,
|
type: Object as () => Train,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
simpleView: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -39,6 +35,5 @@ export default defineComponent({
|
|||||||
@include smallScreen() {
|
@include smallScreen() {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="train-image" style="display: flex; justify-content: center; align-items: center;">
|
<section class="train-image" style="display: flex; justify-content: center; align-items: center">
|
||||||
<img :src="train.locoURL" alt="Not Found" @error="onImageError" />
|
<img :src="train.locoURL" alt="Not Found" @error="onImageError" />
|
||||||
|
|
||||||
<div class="text--grayed">
|
<div class="text--grayed">
|
||||||
@@ -93,6 +93,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -126,7 +128,9 @@ export default defineComponent({
|
|||||||
let progressBarString = `<span style="color: white"> ${percentage}% </span> `;
|
let progressBarString = `<span style="color: white"> ${percentage}% </span> `;
|
||||||
|
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
progressBarString += `<span style="color: ${i < Math.round(percentage / 20) ? 'springgreen' : 'gray'}">▉</span>`;
|
progressBarString += `<span style="color: ${
|
||||||
|
i < Math.round(percentage / 20) ? 'springgreen' : 'gray'
|
||||||
|
}">▉</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return progressBarString;
|
return progressBarString;
|
||||||
@@ -163,11 +167,6 @@ export default defineComponent({
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
background-color: #202020;
|
background-color: #202020;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
|
|
||||||
&:hover,
|
|
||||||
&:focus {
|
|
||||||
background: #292929;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.driver_position:first-letter {
|
.driver_position:first-letter {
|
||||||
|
|||||||
@@ -138,12 +138,16 @@ $stopNameClr: #22a8d1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.train-schedule {
|
.train-schedule {
|
||||||
min-height: 400px;
|
max-height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
|
|
||||||
|
background-color: #202020;
|
||||||
|
padding: 0 0.25em;
|
||||||
|
|
||||||
@include smallScreen() {
|
@include smallScreen() {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
@@ -324,7 +328,7 @@ ul.stop_list > li.stop {
|
|||||||
|
|
||||||
margin-left: -1.75rem;
|
margin-left: -1.75rem;
|
||||||
|
|
||||||
font-size: 0.85em;
|
font-size: 0.75em;
|
||||||
color: #d6d6d6;
|
color: #d6d6d6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="train-table" @keydown.esc="closeTimetableCard">
|
<div class="train-table" @keydown.esc="closeTimetable" v-click-outside="closeTimetable">
|
||||||
<transition name="anim" mode="out-in">
|
<transition name="anim" mode="out-in">
|
||||||
<div :key="trainsDataStatus">
|
<div :key="trainsDataStatus">
|
||||||
<!-- <div class="traffic-warning" v-if="data.">
|
<!-- <div class="traffic-warning" v-if="data.">
|
||||||
@@ -19,18 +19,21 @@
|
|||||||
class="train-row"
|
class="train-row"
|
||||||
v-for="train in currentTrains"
|
v-for="train in currentTrains"
|
||||||
:key="train.trainNo + train.driverId"
|
:key="train.trainNo + train.driverId"
|
||||||
@click="showTrainTimetable(train)"
|
@click="toggleTimetable(train)"
|
||||||
@keydown.enter="showTrainTimetable(train)"
|
@keydown.enter="toggleTimetable(train)"
|
||||||
>
|
>
|
||||||
<TrainInfo :train="train" :simpleView="true" />
|
<TrainInfo :train="train" :simpleView="true" />
|
||||||
|
|
||||||
|
<train-schedule
|
||||||
|
v-if="train.timetableData && chosenTrainId == getTrainId(train)"
|
||||||
|
:followingStops="train.timetableData.followingStops"
|
||||||
|
ref="card-inner"
|
||||||
|
tabindex="0"
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<span v-if="chosenTrain">
|
|
||||||
<train-timetable-card :train="chosenTrain" @close="closeTimetableCard" ref="card" />
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -85,24 +88,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
const currentTrains = computed(() => {
|
const currentTrains = computed(() => {
|
||||||
return props.trains;
|
return props.trains;
|
||||||
|
|
||||||
//.slice(currentPage.value * PAGE_CAPACITY, currentPage.value * PAGE_CAPACITY + PAGE_CAPACITY);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const chosenTrainId = ref(null) as Ref<string | null>;
|
const chosenTrainId = ref(null) as Ref<string | null>;
|
||||||
const chosenTrain = computed(() =>
|
const chosenTrain = computed(() =>
|
||||||
props.trains.find((train) => train.trainNo + train.driverName === chosenTrainId.value)
|
props.trains.find((train: Train) => train.trainNo + train.driverName === chosenTrainId.value)
|
||||||
);
|
);
|
||||||
|
|
||||||
// watch([searchedTrain, searchedDriver], () => {
|
|
||||||
// currentPage.value = 0;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// watch(paginatorPageCount, (value) => {
|
|
||||||
// if (currentPage.value >= value)
|
|
||||||
// currentPage.value = paginatorPageCount.value - 1 < 0 ? 0 : paginatorPageCount.value - 1;
|
|
||||||
// });
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
searchedTrain,
|
searchedTrain,
|
||||||
searchedDriver,
|
searchedDriver,
|
||||||
@@ -144,13 +136,21 @@ export default defineComponent({
|
|||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
showTrainTimetable(train: Train) {
|
toggleTimetable(train: Train) {
|
||||||
this.chosenTrainId = train.trainNo + train.driverName;
|
this.chosenTrainId = this.chosenTrainId && this.chosenTrainId == this.getTrainId(train) ? null : this.getTrainId(train);
|
||||||
},
|
},
|
||||||
|
|
||||||
closeTimetableCard() {
|
closeTimetable() {
|
||||||
this.chosenTrainId = null;
|
this.chosenTrainId = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showTrainId(train: Train) {
|
||||||
|
console.log(this.getTrainId(train));
|
||||||
|
},
|
||||||
|
|
||||||
|
getTrainId(train: Train) {
|
||||||
|
return train.driverId.toString() + train.trainNo.toString();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user