mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Bug fix
This commit is contained in:
@@ -22,8 +22,6 @@
|
|||||||
:key="i"
|
:key="i"
|
||||||
:ref="
|
:ref="
|
||||||
(el) => {
|
(el) => {
|
||||||
observer.observe(el);
|
|
||||||
|
|
||||||
if (!train.timetableData) return;
|
if (!train.timetableData) return;
|
||||||
elList[train.timetableData.timetableId] = el;
|
elList[train.timetableData.timetableId] = el;
|
||||||
}
|
}
|
||||||
@@ -163,18 +161,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<transition
|
||||||
class="train_extended-info"
|
name="unfold"
|
||||||
v-if="
|
@enter="enter"
|
||||||
train.timetableData &&
|
@afterEnter="afterEnter"
|
||||||
showedSchedule == train.timetableData.timetableId
|
@leave="leave"
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<TrainSchedule
|
<TrainSchedule
|
||||||
|
v-if="showedSchedule === train.timetableData?.timetableId"
|
||||||
:followingStops="train.timetableData.followingStops"
|
:followingStops="train.timetableData.followingStops"
|
||||||
@click="changeScheduleShowState(train.timetableData?.timetableId)"
|
@click="changeScheduleShowState(train.timetableData?.timetableId)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</transition>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -264,29 +262,28 @@ export default defineComponent({
|
|||||||
const store = useStore();
|
const store = useStore();
|
||||||
const elList: Ref<(HTMLElement | null)[]> = ref([]);
|
const elList: Ref<(HTMLElement | null)[]> = ref([]);
|
||||||
|
|
||||||
onBeforeUpdate(() => {
|
// onBeforeUpdate(() => {
|
||||||
elList.value.length = 0;
|
// elList.value.length = 0;
|
||||||
observer.disconnect();
|
// observer.disconnect();
|
||||||
});
|
// });
|
||||||
|
|
||||||
const timetableDataStatus: ComputedRef<DataStatus> = computed(
|
const timetableDataStatus: ComputedRef<DataStatus> = computed(
|
||||||
() => store.getters[GETTERS.timetableDataStatus]
|
() => store.getters[GETTERS.timetableDataStatus]
|
||||||
);
|
);
|
||||||
|
|
||||||
const observer = new IntersectionObserver((entries) => {
|
// const observer = new IntersectionObserver((entries) => {
|
||||||
entries.forEach((entry) => {
|
// entries.forEach((entry) => {
|
||||||
if (entry.isIntersecting) {
|
// if (entry.isIntersecting) {
|
||||||
(entry.target as HTMLElement).classList.add("visible");
|
// (entry.target as HTMLElement).classList.add("visible");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
(entry.target as HTMLElement).classList.remove("visible");
|
// (entry.target as HTMLElement).classList.remove("visible");
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
elList,
|
elList,
|
||||||
observer,
|
|
||||||
timetableLoaded: computed(
|
timetableLoaded: computed(
|
||||||
() => timetableDataStatus.value === DataStatus.Loaded
|
() => timetableDataStatus.value === DataStatus.Loaded
|
||||||
),
|
),
|
||||||
@@ -304,6 +301,29 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
enter(el: HTMLElement) {
|
||||||
|
const maxHeight = getComputedStyle(el).height;
|
||||||
|
|
||||||
|
el.style.height = "0px";
|
||||||
|
|
||||||
|
getComputedStyle(el);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
el.style.height = maxHeight;
|
||||||
|
}, 10);
|
||||||
|
},
|
||||||
|
|
||||||
|
afterEnter(el: HTMLElement) {
|
||||||
|
el.style.height = "auto";
|
||||||
|
},
|
||||||
|
|
||||||
|
leave(el: HTMLElement) {
|
||||||
|
el.style.height = getComputedStyle(el).height;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
el.style.height = "0px";
|
||||||
|
}, 10);
|
||||||
|
},
|
||||||
focusOnTrain(trainNoStr: string) {
|
focusOnTrain(trainNoStr: string) {
|
||||||
const timetableId = this.computedTrains.find(
|
const timetableId = this.computedTrains.find(
|
||||||
(train) => train.trainNo == Number(trainNoStr)
|
(train) => train.trainNo == Number(trainNoStr)
|
||||||
@@ -319,14 +339,15 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.showedSchedule =
|
this.showedSchedule =
|
||||||
this.showedSchedule == timetableId ? 0 : timetableId;
|
this.showedSchedule == timetableId ? 0 : timetableId;
|
||||||
this.$nextTick(() => {
|
|
||||||
|
setTimeout(() => {
|
||||||
const currentEl = this.elList[timetableId];
|
const currentEl = this.elList[timetableId];
|
||||||
|
|
||||||
currentEl?.scrollIntoView({
|
currentEl?.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "nearest",
|
block: this.showedSchedule == 0 ? "nearest" : "center",
|
||||||
});
|
});
|
||||||
});
|
}, 175);
|
||||||
},
|
},
|
||||||
|
|
||||||
onImageError(e: Event) {
|
onImageError(e: Event) {
|
||||||
@@ -382,6 +403,14 @@ export default defineComponent({
|
|||||||
@import "../../styles/responsive.scss";
|
@import "../../styles/responsive.scss";
|
||||||
@import "../../styles/user_badge.scss";
|
@import "../../styles/user_badge.scss";
|
||||||
|
|
||||||
|
.unfold {
|
||||||
|
&-leave-active,
|
||||||
|
&-enter-active {
|
||||||
|
transition: all 150ms ease-out;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.no-trains {
|
.no-trains {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@
|
|||||||
"no-stations": "No stations to show here!"
|
"no-stations": "No stations to show here!"
|
||||||
},
|
},
|
||||||
"trains": {
|
"trains": {
|
||||||
"no-trains": "Oops! No trains online!",
|
"no-trains": "No trains to show here!",
|
||||||
"loading": "Loading train data...",
|
"loading": "Loading train data...",
|
||||||
"stats": "TRAFFIC STATISTICS",
|
"stats": "TRAFFIC STATISTICS",
|
||||||
"stats-speed": "TRAINS SPEED (MIN, AVG, MAX) [km/h]",
|
"stats-speed": "TRAINS SPEED (MIN, AVG, MAX) [km/h]",
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@
|
|||||||
"no-stations": "Brak stacji do wyświetlenia!"
|
"no-stations": "Brak stacji do wyświetlenia!"
|
||||||
},
|
},
|
||||||
"trains": {
|
"trains": {
|
||||||
"no-trains": "Brak pociągów online!",
|
"no-trains": "Brak pociągów do wyświetlenia!",
|
||||||
"loading": "Pobieranie danych o pociągach...",
|
"loading": "Pobieranie danych o pociągach...",
|
||||||
"stats": "STATYSTYKI RUCHU",
|
"stats": "STATYSTYKI RUCHU",
|
||||||
"stats-speed": "PRĘDKOŚCI POCIĄGÓW (MIN, ŚR, MAX) [km/h]",
|
"stats-speed": "PRĘDKOŚCI POCIĄGÓW (MIN, ŚR, MAX) [km/h]",
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const i18n = createI18n({
|
|||||||
|
|
||||||
const clickOutsideDirective: Directive = {
|
const clickOutsideDirective: Directive = {
|
||||||
beforeMount(el, binding) {
|
beforeMount(el, binding) {
|
||||||
console.log("before mount");
|
|
||||||
|
|
||||||
el.clickOutsideEvent = (event: Event) => {
|
el.clickOutsideEvent = (event: Event) => {
|
||||||
if (!(el == event.target || el.contains(event.target))) {
|
if (!(el == event.target || el.contains(event.target))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user