mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
refactor: types & performance
This commit is contained in:
@@ -20,7 +20,15 @@
|
||||
</div>
|
||||
|
||||
<Donation :isModalOpen="isDonationModalOpen" @toggleModal="toggleDonationModal" />
|
||||
<StationTable :stations="computedStationList" @toggleDonationModal="toggleDonationModal" />
|
||||
<StationTable @toggleDonationModal="toggleDonationModal" />
|
||||
|
||||
<div class="stations-stats">
|
||||
<hr style="margin: 0.5em 0" />
|
||||
Średnia liczba rozkładów jazdy na dyżurnego: <b>{{ avgTimetableCount }}</b> | Dostępne
|
||||
szlaki 1-torowe: <b>{{ oneWayTracks }}</b> (zelektr.) / <b>{{ 0 }}</b> (spalinowe) |
|
||||
Dostępne szlaki 2-torowe: <b>{{ 0 }}</b> (zelektr.) / <b>{{ 0 }}</b> (spalinowe) | Otwarte
|
||||
spawny: <b>{{ 0 }}</b> (PAS.) / <b>{{ 0 }}</b> (TOW.) / <b>{{ 0 }}</b> (LUZ.)
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -56,8 +64,29 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
computed: {
|
||||
computedStationList() {
|
||||
return this.filterStore.filteredStationList;
|
||||
avgTimetableCount() {
|
||||
const scheduledTrainsTotal = this.store.activeSceneryList.reduce<number>((acc, sc) => {
|
||||
if (sc.region != 'eu') return acc;
|
||||
|
||||
acc += sc.scheduledTrainCount.all;
|
||||
|
||||
return acc;
|
||||
}, 0);
|
||||
|
||||
return (
|
||||
this.store.activeSceneryList.length != 0
|
||||
? scheduledTrainsTotal / this.store.activeSceneryList.length
|
||||
: 0
|
||||
).toFixed(2);
|
||||
},
|
||||
|
||||
oneWayTracks() {
|
||||
// return this.computedStationList
|
||||
// .filter((st) => st.onlineInfo && st.generalInfo?.routes.single)
|
||||
// .map((st) => st.generalInfo!.routes.single.map((r) => r.routeName))
|
||||
// .join(', ');
|
||||
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
@@ -119,6 +148,11 @@ export default defineComponent({
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.stations-stats {
|
||||
text-align: center;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
button.btn-donation {
|
||||
$btnColor: #254069;
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ import { computed, ComputedRef, defineComponent, provide, reactive, ref, watch }
|
||||
import TrainOptions from '../components/TrainsView/TrainOptions.vue';
|
||||
import TrainTable from '../components/TrainsView/TrainTable.vue';
|
||||
import modalTrainMixin from '../mixins/modalTrainMixin';
|
||||
import Train from '../scripts/interfaces/Train';
|
||||
import { useMainStore } from '../store/mainStore';
|
||||
import { TrainFilter, trainFilters } from '../components/TrainsView/typings';
|
||||
import { filteredTrainList } from '../managers/trainFilterManager';
|
||||
import TrainStats from '../components/TrainsView/TrainStats.vue';
|
||||
import { Train } from '../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
||||
Reference in New Issue
Block a user