Hotfixy; dodano przyciski powrotu do dla wszystkich widoków

This commit is contained in:
2022-05-28 01:03:51 +02:00
parent 9345697d07
commit 0b5b0f5178
7 changed files with 54 additions and 9 deletions
+2 -2
View File
@@ -69,8 +69,8 @@
</main> </main>
<footer class="app_footer"> <footer class="app_footer">
&copy;&nbsp; &copy;
<a href="https://td2.info.pl/profile/?u=20777" target="_blank">Spythere</a>&nbsp; <a href="https://td2.info.pl/profile/?u=20777" target="_blank">Spythere</a>
{{ new Date().getUTCFullYear() }} | v{{ VERSION }} {{ new Date().getUTCFullYear() }} | v{{ VERSION }}
</footer> </footer>
</div> </div>
@@ -258,13 +258,15 @@ export default defineComponent({
handleScroll() { handleScroll() {
this.showReturnButton = window.scrollY > window.innerHeight; this.showReturnButton = window.scrollY > window.innerHeight;
console.log(window.scrollY > window.innerHeight);
const element = this.$refs.scrollElement as HTMLElement; const element = this.$refs.scrollElement as HTMLElement;
if ( if (
element.getBoundingClientRect().bottom * 0.85 < window.innerHeight && element.getBoundingClientRect().bottom * 0.85 < window.innerHeight &&
this.scrollDataLoaded && this.scrollDataLoaded &&
!this.scrollNoMoreData && !this.scrollNoMoreData &&
window.scrollY > window.innerHeight this.historyDataStatus.status == DataStatus.Loaded
) )
this.addHistoryData(); this.addHistoryData();
}, },
@@ -297,7 +297,7 @@ export default defineComponent({
element.getBoundingClientRect().bottom * 0.85 < window.innerHeight && element.getBoundingClientRect().bottom * 0.85 < window.innerHeight &&
this.scrollDataLoaded && this.scrollDataLoaded &&
!this.scrollNoMoreData && !this.scrollNoMoreData &&
window.scrollY > window.innerHeight this.historyDataStatus.status == DataStatus.Loaded
) )
this.addHistoryData(); this.addHistoryData();
}, },
+6 -1
View File
@@ -1,5 +1,9 @@
<template> <template>
<section class="station_table"> <section class="station_table">
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
<img :src="icons.arrow" alt="return arrow" />
</button>
<div class="table_wrapper"> <div class="table_wrapper">
<table> <table>
<thead> <thead>
@@ -231,6 +235,7 @@
import styleMixin from '@/mixins/styleMixin'; import styleMixin from '@/mixins/styleMixin';
import dateMixin from '@/mixins/dateMixin'; import dateMixin from '@/mixins/dateMixin';
import stationInfoMixin from '@/mixins/stationInfoMixin'; import stationInfoMixin from '@/mixins/stationInfoMixin';
import returnBtnMixin from '@/mixins/returnBtnMixin';
import { DataStatus } from '@/scripts/enums/DataStatus'; import { DataStatus } from '@/scripts/enums/DataStatus';
import { computed, ComputedRef, defineComponent } from '@vue/runtime-core'; import { computed, ComputedRef, defineComponent } from '@vue/runtime-core';
@@ -255,7 +260,7 @@ export default defineComponent({
changeSorter: { type: Function, required: true }, changeSorter: { type: Function, required: true },
}, },
mixins: [styleMixin, dateMixin, stationInfoMixin], mixins: [styleMixin, dateMixin, stationInfoMixin, returnBtnMixin],
data: () => ({ data: () => ({
likeIcon: require('@/assets/icon-like.svg'), likeIcon: require('@/assets/icon-like.svg'),
+10 -3
View File
@@ -1,5 +1,9 @@
<template> <template>
<div class="train-table" @keydown.esc="closeTimetable" v-click-outside="closeTimetable"> <div class="train-table" @keydown.esc="closeTimetable" v-click-outside="closeTimetable">
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
<img :src="icons.arrowAsc" alt="return arrow" />
</button>
<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.">
@@ -45,6 +49,7 @@ import TrainInfo from '@/components/TrainsView/TrainInfo.vue';
import { DataStatus } from '@/scripts/enums/DataStatus'; import { DataStatus } from '@/scripts/enums/DataStatus';
import { GETTERS } from '@/constants/storeConstants'; import { GETTERS } from '@/constants/storeConstants';
import returnBtnMixin from '@/mixins/returnBtnMixin';
export default defineComponent({ export default defineComponent({
components: { components: {
@@ -52,6 +57,8 @@ export default defineComponent({
TrainInfo, TrainInfo,
}, },
mixins: [returnBtnMixin],
props: { props: {
trains: { trains: {
type: Array as () => Train[], type: Array as () => Train[],
@@ -107,9 +114,9 @@ export default defineComponent({
this.searchedDriver = query.driverName.toString(); this.searchedDriver = query.driverName.toString();
this.searchedTrain = query.trainNo.toString(); this.searchedTrain = query.trainNo.toString();
setTimeout(() => { setTimeout(() => {
this.chosenTrainId = query.driverName + <string>query.trainNo; this.chosenTrainId = query.driverName + <string>query.trainNo;
}, 20); }, 20);
} }
}, },
+31
View File
@@ -0,0 +1,31 @@
import { defineComponent, h } from "vue";
export default defineComponent({
data() {
return {
icons: {
arrow: require('@/assets/icon-arrow-asc.svg'),
},
showReturnButton: false
}
},
methods: {
scrollToTop() {
window.scrollTo({ top: 0 });
},
handleScroll() {
this.showReturnButton = window.scrollY > window.innerHeight;
}
},
activated() {
window.addEventListener('scroll', this.handleScroll);
},
deactivated() {
window.removeEventListener('scroll', this.handleScroll);
},
})
+1 -1
View File
@@ -259,7 +259,7 @@ ul {
bottom: 0; bottom: 0;
z-index: 100; z-index: 100;
margin: 0 1em 1em 0; margin: 0 1em 1em 0;
width: 2em; width: 2em;