mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Dodano informacje o ładowaniu historii dyżurnych
This commit is contained in:
@@ -3,6 +3,14 @@
|
||||
<h2>HISTORIA DYŻURÓW</h2>
|
||||
|
||||
<ul>
|
||||
<li v-if="!isLoaded">
|
||||
<h3>Ładowanie historii...</h3>
|
||||
</li>
|
||||
|
||||
<li v-if="isLoaded && dispatcherTimeline.length == 0">
|
||||
<h3>Brak historii dla tej scenerii!</h3>
|
||||
</li>
|
||||
|
||||
<li v-for="(timeline, i) in dispatcherTimeline" :key="i">
|
||||
<h3
|
||||
@click="toggleTimeline(i)"
|
||||
@@ -70,6 +78,8 @@ export default defineComponent({
|
||||
dispatcherHistory: [] as DispatcherHistory[],
|
||||
dispatcherTimeline: [] as DispatcherTimeline[],
|
||||
|
||||
isLoaded: false,
|
||||
|
||||
icons: {
|
||||
ascArrow: require('@/assets/icon-arrow-asc.svg'),
|
||||
descArrow: require('@/assets/icon-arrow-desc.svg'),
|
||||
@@ -88,6 +98,9 @@ export default defineComponent({
|
||||
async mounted() {
|
||||
try {
|
||||
const apiResult: HistoryResultAPI = (await axios.get(`${API_URL}?name=${this.name}`)).data;
|
||||
|
||||
this.isLoaded = true;
|
||||
if(!apiResult || !apiResult.result) return;
|
||||
|
||||
if (!apiResult.errorMessage) {
|
||||
this.dispatcherHistory = apiResult.result.dispatcherHistory;
|
||||
@@ -109,6 +122,7 @@ export default defineComponent({
|
||||
return acc;
|
||||
}, [] as DispatcherTimeline[])
|
||||
.reverse();
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -134,7 +148,7 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scenery-history {
|
||||
max-height: 600px;
|
||||
height: 600px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
</div>
|
||||
|
||||
<div class="scenery-wrapper" v-if="stationInfo" ref="card-wrapper">
|
||||
<!-- <scenery-info-header :station="stationInfo" /> -->
|
||||
<button v-if="!timetableOnly" class="back-btn btn btn--image" title="Powrót do scenerii" @click="navigateTo('/')">
|
||||
<img :src="icons.back" alt="Back to scenery" />
|
||||
</button>
|
||||
@@ -145,6 +144,7 @@ $sceneryBgCol: #333;
|
||||
width: 75%;
|
||||
max-width: 950px;
|
||||
|
||||
|
||||
@include midScreen {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user