mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
chore: journal timetables styling improvements
This commit is contained in:
@@ -17,17 +17,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<ul class="journal-list">
|
<transition-group name="list-anim" tag="ul" class="journal-list">
|
||||||
<transition-group name="list-anim">
|
<li v-for="timetable in timetableHistory" class="journal_item" :key="timetable.id">
|
||||||
<li
|
<div class="journal_item-info">
|
||||||
v-for="{ timetable, showExtraInfo } in computedTimetableHistory"
|
<!-- General -->
|
||||||
class="journal_item"
|
<TimetableGeneral :timetable="timetable" />
|
||||||
:key="timetable.id"
|
|
||||||
@click="showExtraInfo.value = !showExtraInfo.value"
|
<div @click="toggleExtraInfo(timetable.id)" style="cursor: pointer">
|
||||||
>
|
|
||||||
<div class="journal_item-info">
|
|
||||||
<!-- General -->
|
|
||||||
<TimetableGeneral :timetable="timetable" />
|
|
||||||
<!-- Route -->
|
<!-- Route -->
|
||||||
<span class="item-route">
|
<span class="item-route">
|
||||||
<b>{{ timetable.route.replace('|', ' - ') }}</b>
|
<b>{{ timetable.route.replace('|', ' - ') }}</b>
|
||||||
@@ -35,16 +31,23 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<!-- Stops -->
|
<!-- Stops -->
|
||||||
<TimetableStops :timetable="timetable" :showExtraInfo="showExtraInfo.value" />
|
<TimetableStops
|
||||||
|
:timetable="timetable"
|
||||||
|
:showExtraInfo="extraInfoIndexes.includes(timetable.id)"
|
||||||
|
/>
|
||||||
<!-- Status -->
|
<!-- Status -->
|
||||||
<TimetableStatus :timetable="timetable" />
|
<TimetableStatus :timetable="timetable" />
|
||||||
|
|
||||||
<!-- Extra -->
|
|
||||||
<TimetableDetails :timetable="timetable" :showExtraInfo="showExtraInfo.value" />
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
|
||||||
</transition-group>
|
<!-- Extra -->
|
||||||
</ul>
|
<TimetableDetails
|
||||||
|
:timetable="timetable"
|
||||||
|
:showExtraInfo="extraInfoIndexes.includes(timetable.id)"
|
||||||
|
@toggle-extra-info="toggleExtraInfo"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</transition-group>
|
||||||
|
|
||||||
<AddDataButton
|
<AddDataButton
|
||||||
:list="timetableHistory"
|
:list="timetableHistory"
|
||||||
@@ -57,6 +60,7 @@
|
|||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<div class="journal_warning" v-if="scrollNoMoreData">{{ $t('journal.no-further-data') }}</div>
|
<div class="journal_warning" v-if="scrollNoMoreData">{{ $t('journal.no-further-data') }}</div>
|
||||||
|
|
||||||
<div class="journal_warning" v-else-if="!scrollDataLoaded">
|
<div class="journal_warning" v-else-if="!scrollDataLoaded">
|
||||||
{{ $t('journal.loading-further-data') }}
|
{{ $t('journal.loading-further-data') }}
|
||||||
</div>
|
</div>
|
||||||
@@ -64,7 +68,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType, ref } from 'vue';
|
import { defineComponent, Prop, PropType, ref } from 'vue';
|
||||||
|
|
||||||
import Loading from '../../Global/Loading.vue';
|
import Loading from '../../Global/Loading.vue';
|
||||||
import AddDataButton from '../../Global/AddDataButton.vue';
|
import AddDataButton from '../../Global/AddDataButton.vue';
|
||||||
@@ -110,16 +114,30 @@ export default defineComponent({
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
Status,
|
Status,
|
||||||
store: useMainStore()
|
store: useMainStore(),
|
||||||
|
extraInfoIndexes: [] as number[]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
watch: {
|
||||||
computedTimetableHistory() {
|
timetableHistory: {
|
||||||
return this.timetableHistory.map((timetable) => ({
|
deep: true,
|
||||||
timetable,
|
handler() {
|
||||||
showExtraInfo: ref(false)
|
console.log(this.$refs['list']);
|
||||||
}));
|
|
||||||
|
// ?.scrollTo({ behavior: 'smooth', top: 0 });
|
||||||
|
|
||||||
|
// (this.$refs['list'] as HTMLUListElement).scrollTo({})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
toggleExtraInfo(id: number) {
|
||||||
|
const existingIdx = this.extraInfoIndexes.indexOf(id);
|
||||||
|
|
||||||
|
if (existingIdx != -1) this.extraInfoIndexes.splice(existingIdx, 1);
|
||||||
|
else this.extraInfoIndexes.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="details-actions">
|
<div class="details-actions">
|
||||||
<button class="btn--action">
|
<button class="btn--action" @click="toggleExtraInfo">
|
||||||
<b>{{ $t('journal.stock-info') }}</b>
|
<b>{{ $t('journal.stock-info') }}</b>
|
||||||
<img :src="`/images/icon-arrow-${showExtraInfo ? 'asc' : 'desc'}.svg`" alt="Arrow icon" />
|
<img :src="`/images/icon-arrow-${showExtraInfo ? 'asc' : 'desc'}.svg`" alt="Arrow icon" />
|
||||||
</button>
|
</button>
|
||||||
@@ -90,9 +90,11 @@ import modalTrainMixin from '../../../mixins/modalTrainMixin';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { StockList },
|
components: { StockList },
|
||||||
|
|
||||||
mixins: [modalTrainMixin],
|
mixins: [modalTrainMixin],
|
||||||
|
|
||||||
|
emits: ['toggleExtraInfo'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
showExtraInfo: {
|
showExtraInfo: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -137,6 +139,10 @@ export default defineComponent({
|
|||||||
if (timetable?.terminated) return;
|
if (timetable?.terminated) return;
|
||||||
|
|
||||||
this.selectModalTrainById(`${timetable.driverName}${timetable.trainNo}`, target);
|
this.selectModalTrainById(`${timetable.driverName}${timetable.trainNo}`, target);
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleExtraInfo() {
|
||||||
|
this.$emit('toggleExtraInfo', this.timetable.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,18 +25,19 @@
|
|||||||
{{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel}` }}
|
{{ timetable.driverLevel < 2 ? 'L' : `${timetable.driverLevel}` }}
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
<strong
|
<router-link
|
||||||
v-if="apiStore.donatorsData.includes(timetable.driverName)"
|
v-if="apiStore.donatorsData.includes(timetable.driverName)"
|
||||||
class="text--donator"
|
class="text--donator"
|
||||||
data-tooltip-type="DonatorTooltip"
|
data-tooltip-type="DonatorTooltip"
|
||||||
:data-tooltip-content="$t('donations.driver-message')"
|
:data-tooltip-content="$t('donations.driver-message')"
|
||||||
|
:to="`/journal/timetables?search-driver=${timetable.driverName}`"
|
||||||
>
|
>
|
||||||
{{ timetable.driverName }}
|
<strong>{{ timetable.driverName }}</strong>
|
||||||
</strong>
|
</router-link>
|
||||||
|
|
||||||
<strong v-else>
|
<router-link v-else :to="`/journal/timetables?search-driver=${timetable.driverName}`">
|
||||||
{{ timetable.driverName }}
|
<strong>{{ timetable.driverName }}</strong>
|
||||||
</strong>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="general-time">
|
<span class="general-time">
|
||||||
|
|||||||
@@ -38,16 +38,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.journal_item {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.journal_item,
|
.journal_item,
|
||||||
.journal_warning {
|
.journal_warning {
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.journal_top-bar {
|
.journal_top-bar {
|
||||||
|
|||||||
Reference in New Issue
Block a user