mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 22:08:12 +00:00
Nowe filtry scenerii
This commit is contained in:
@@ -31,6 +31,7 @@ node_modules
|
|||||||
.firebaserc
|
.firebaserc
|
||||||
firebase.json
|
firebase.json
|
||||||
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
|
|
||||||
.fake
|
.fake
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stacjownik",
|
"name": "stacjownik",
|
||||||
"version": "1.4.93",
|
"version": "1.4.95",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
|
|||||||
@@ -37,15 +37,21 @@
|
|||||||
<section class="card_options">
|
<section class="card_options">
|
||||||
<filter-option v-for="(option, i) in inputs.options" :option="option" :key="i" @optionChange="handleChange" />
|
<filter-option v-for="(option, i) in inputs.options" :option="option" :key="i" @optionChange="handleChange" />
|
||||||
</section>
|
</section>
|
||||||
<!--
|
|
||||||
<section class="card_timestamp" style="text-align: center">
|
<section class="card_timestamp" style="text-align: center">
|
||||||
<div>POKAZUJ SCENERIE DOSTĘPNE MINIMUM DO GODZINY:</div>
|
<div>{{ $t('filters.minimum-hours-title') }}</div>
|
||||||
<span class="clock">
|
<span class="clock">
|
||||||
<button @click="subHour">-</button>
|
<button @click="subHour">-</button>
|
||||||
<span>{{ minimumTimeString }}</span>
|
<span>{{
|
||||||
|
minimumHours == 0
|
||||||
|
? $t('filters.now')
|
||||||
|
: minimumHours < 8
|
||||||
|
? minimumHours + $t('filters.hour')
|
||||||
|
: $t('filters.no-limit')
|
||||||
|
}}</span>
|
||||||
<button @click="addHour">+</button>
|
<button @click="addHour">+</button>
|
||||||
</span>
|
</span>
|
||||||
</section> -->
|
</section>
|
||||||
|
|
||||||
<section class="card_sliders">
|
<section class="card_sliders">
|
||||||
<div class="slider" v-for="(slider, i) in inputs.sliders" :key="i">
|
<div class="slider" v-for="(slider, i) in inputs.sliders" :key="i">
|
||||||
@@ -102,46 +108,6 @@ import StorageManager from '@/scripts/managers/storageManager';
|
|||||||
import ActionButton from '../Global/ActionButton.vue';
|
import ActionButton from '../Global/ActionButton.vue';
|
||||||
import FilterOption from './FilterOption.vue';
|
import FilterOption from './FilterOption.vue';
|
||||||
|
|
||||||
/*
|
|
||||||
Do JSONa
|
|
||||||
{
|
|
||||||
"id": "endingStatus",
|
|
||||||
"name": "endingStatus",
|
|
||||||
"iconName": "",
|
|
||||||
|
|
||||||
"section": "status",
|
|
||||||
"value": true,
|
|
||||||
"defaultValue": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "afkStatus",
|
|
||||||
"name": "afkStatus",
|
|
||||||
"iconName": "",
|
|
||||||
|
|
||||||
"section": "status",
|
|
||||||
"value": true,
|
|
||||||
"defaultValue": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "noSpaceStatus",
|
|
||||||
"name": "noSpaceStatus",
|
|
||||||
"iconName": "",
|
|
||||||
|
|
||||||
"section": "status",
|
|
||||||
"value": true,
|
|
||||||
"defaultValue": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "unavailableStatus",
|
|
||||||
"name": "unavailableStatus",
|
|
||||||
"iconName": "",
|
|
||||||
|
|
||||||
"section": "status",
|
|
||||||
"value": true,
|
|
||||||
"defaultValue": true
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { ActionButton, FilterOption },
|
components: { ActionButton, FilterOption },
|
||||||
emits: ['changeFilterValue', 'invertFilters', 'resetFilters'],
|
emits: ['changeFilterValue', 'invertFilters', 'resetFilters'],
|
||||||
@@ -153,6 +119,8 @@ export default defineComponent({
|
|||||||
saveOptions: false,
|
saveOptions: false,
|
||||||
STORAGE_KEY: 'options_saved',
|
STORAGE_KEY: 'options_saved',
|
||||||
|
|
||||||
|
minimumHours: 0,
|
||||||
|
|
||||||
currentRegion: { id: '', value: '' },
|
currentRegion: { id: '', value: '' },
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -161,14 +129,18 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
isVisible,
|
isVisible,
|
||||||
|
|
||||||
minimumTimeString: ref('BEZ LIMITU'),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.saveOptions = StorageManager.isRegistered(this.STORAGE_KEY);
|
this.saveOptions = StorageManager.isRegistered(this.STORAGE_KEY);
|
||||||
|
|
||||||
|
if (StorageManager.isRegistered('onlineFromHours') && this.saveOptions) {
|
||||||
|
this.minimumHours = StorageManager.getNumericValue('onlineFromHours');
|
||||||
|
|
||||||
|
this.changeNumericFilterValue('onlineFromHours', this.minimumHours);
|
||||||
|
}
|
||||||
|
|
||||||
this.currentRegion = this.$store.getters[GETTERS.currentRegion];
|
this.currentRegion = this.$store.getters[GETTERS.currentRegion];
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -200,64 +172,25 @@ export default defineComponent({
|
|||||||
this.closeCard();
|
this.closeCard();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeNumericFilterValue(name: string, value: number, saveToStorage = false) {
|
||||||
|
this.$emit('changeFilterValue', {
|
||||||
|
name,
|
||||||
|
value,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.saveOptions && saveToStorage) StorageManager.setNumericValue(name, value);
|
||||||
|
},
|
||||||
|
|
||||||
subHour() {
|
subHour() {
|
||||||
if (this.minimumTimeString == 'BEZ LIMITU') {
|
this.minimumHours = this.minimumHours < 1 ? 8 : this.minimumHours - 1;
|
||||||
const prevHour = new Date().getHours() + 7;
|
|
||||||
|
|
||||||
this.minimumTimeString = `${prevHour < 10 ? '0' : ''}${prevHour}:00`;
|
this.changeNumericFilterValue('onlineFromHours', this.minimumHours, true);
|
||||||
|
|
||||||
const prevDate = new Date();
|
|
||||||
prevDate.setHours(prevHour, 0, 0);
|
|
||||||
|
|
||||||
this.$emit('changeFilterValue', {
|
|
||||||
name: 'onlineToTimestamp',
|
|
||||||
value: prevDate.getTime(),
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const prevHour = Number(this.minimumTimeString.split(':')[0]) - 1;
|
|
||||||
|
|
||||||
if (prevHour < new Date().getHours() + 1) return;
|
|
||||||
|
|
||||||
this.minimumTimeString = `${prevHour < 10 ? '0' : ''}${prevHour}:00`;
|
|
||||||
|
|
||||||
const prevDate = new Date();
|
|
||||||
prevDate.setHours(prevHour, 0, 0);
|
|
||||||
|
|
||||||
console.log(prevDate);
|
|
||||||
|
|
||||||
this.$emit('changeFilterValue', {
|
|
||||||
name: 'onlineToTimestamp',
|
|
||||||
value: prevDate.getTime(),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addHour() {
|
addHour() {
|
||||||
if (this.minimumTimeString == 'BEZ LIMITU') return;
|
this.minimumHours = this.minimumHours > 7 ? 0 : this.minimumHours + 1;
|
||||||
|
|
||||||
const nextHour = Number(this.minimumTimeString.split(':')[0]) + 1;
|
this.changeNumericFilterValue('onlineFromHours', this.minimumHours, true);
|
||||||
|
|
||||||
if (nextHour > new Date().getHours() + 7) {
|
|
||||||
this.minimumTimeString = 'BEZ LIMITU';
|
|
||||||
|
|
||||||
this.$emit('changeFilterValue', {
|
|
||||||
name: 'onlineToTimestamp',
|
|
||||||
value: -1,
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.minimumTimeString = `${nextHour < 10 ? '0' : ''}${nextHour}:00`;
|
|
||||||
|
|
||||||
const nextDate = new Date();
|
|
||||||
nextDate.setHours(nextHour, 0, 0);
|
|
||||||
|
|
||||||
this.$emit('changeFilterValue', {
|
|
||||||
name: 'onlineToTimestamp',
|
|
||||||
value: nextDate.getTime(),
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
invertFilters() {
|
invertFilters() {
|
||||||
@@ -295,6 +228,8 @@ export default defineComponent({
|
|||||||
StorageManager.setNumericValue(slider.name, slider.value);
|
StorageManager.setNumericValue(slider.name, slider.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.minimumHours = 0;
|
||||||
|
|
||||||
this.$emit('resetFilters');
|
this.$emit('resetFilters');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,14 @@
|
|||||||
"value": true,
|
"value": true,
|
||||||
"defaultValue": true
|
"defaultValue": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "non-public",
|
||||||
|
"name": "nonPublic",
|
||||||
|
"iconName": "user",
|
||||||
|
"section": "access",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "unavailable",
|
"id": "unavailable",
|
||||||
"name": "unavailable",
|
"name": "unavailable",
|
||||||
@@ -135,6 +143,42 @@
|
|||||||
"name": "occupied",
|
"name": "occupied",
|
||||||
"iconName": "",
|
"iconName": "",
|
||||||
|
|
||||||
|
"section": "status",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "endingStatus",
|
||||||
|
"name": "endingStatus",
|
||||||
|
"iconName": "",
|
||||||
|
|
||||||
|
"section": "status",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "afkStatus",
|
||||||
|
"name": "afkStatus",
|
||||||
|
"iconName": "",
|
||||||
|
|
||||||
|
"section": "status",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "noSpaceStatus",
|
||||||
|
"name": "noSpaceStatus",
|
||||||
|
"iconName": "",
|
||||||
|
|
||||||
|
"section": "status",
|
||||||
|
"value": true,
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "unavailableStatus",
|
||||||
|
"name": "unavailableStatus",
|
||||||
|
"iconName": "",
|
||||||
|
|
||||||
"section": "status",
|
"section": "status",
|
||||||
"value": true,
|
"value": true,
|
||||||
"defaultValue": true
|
"defaultValue": true
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -61,6 +61,7 @@
|
|||||||
"real": "REAL",
|
"real": "REAL",
|
||||||
"fictional": "FICTIONAL",
|
"fictional": "FICTIONAL",
|
||||||
"unavailable": "UNSUPPORTED",
|
"unavailable": "UNSUPPORTED",
|
||||||
|
"non-public": "NON-PUBLIC",
|
||||||
|
|
||||||
"SPK": "SPK",
|
"SPK": "SPK",
|
||||||
"SCS": "SCS",
|
"SCS": "SCS",
|
||||||
@@ -82,6 +83,10 @@
|
|||||||
"routes-2t-cat": "MIN. CATENARY DOUBLE TRACK ROUTES",
|
"routes-2t-cat": "MIN. CATENARY DOUBLE TRACK ROUTES",
|
||||||
"routes-2t-other": "MIN. OTHER DOUBLE TRACK ROUTES"
|
"routes-2t-other": "MIN. OTHER DOUBLE TRACK ROUTES"
|
||||||
},
|
},
|
||||||
|
"minimum-hours-title": "SHOW ONLY SCENERIES UNTIL:",
|
||||||
|
"now": "NOW",
|
||||||
|
"hour": "h",
|
||||||
|
"no-limit": "NO LIMIT",
|
||||||
"include-selected": "INCLUDE SELECTED",
|
"include-selected": "INCLUDE SELECTED",
|
||||||
"save": "SAVE FILTERS",
|
"save": "SAVE FILTERS",
|
||||||
"reset": "RESET FILTERS",
|
"reset": "RESET FILTERS",
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
"real": "REALNA",
|
"real": "REALNA",
|
||||||
"fictional": "FIKCYJNA",
|
"fictional": "FIKCYJNA",
|
||||||
"unavailable": "NIEDOSTĘPNA",
|
"unavailable": "NIEDOSTĘPNA",
|
||||||
|
"non-public": "NIEPUBLICZNA",
|
||||||
|
|
||||||
"SPK": "SPK",
|
"SPK": "SPK",
|
||||||
"SCS": "SCS",
|
"SCS": "SCS",
|
||||||
"SPE": "SPE",
|
"SPE": "SPE",
|
||||||
@@ -81,6 +83,10 @@
|
|||||||
"routes-2t-cat": "SZLAKI DWUTOROWE ZELEKTR. (MINIMUM)",
|
"routes-2t-cat": "SZLAKI DWUTOROWE ZELEKTR. (MINIMUM)",
|
||||||
"routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)"
|
"routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)"
|
||||||
},
|
},
|
||||||
|
"minimum-hours-title": "POKAŻ TYLKO SCENERIE DOSTĘPNE MINIMUM DO:",
|
||||||
|
"now": "TERAZ",
|
||||||
|
"hour": " godz.",
|
||||||
|
"no-limit": "BEZ LIMITU",
|
||||||
"include-selected": "POKAŻ ZAZNACZONE",
|
"include-selected": "POKAŻ ZAZNACZONE",
|
||||||
"save": "ZAPISZ FILTRY",
|
"save": "ZAPISZ FILTRY",
|
||||||
"reset": "RESETUJ FILTRY",
|
"reset": "RESETUJ FILTRY",
|
||||||
|
|||||||
@@ -34,5 +34,5 @@ export default interface Filter {
|
|||||||
unavailableStatus: boolean;
|
unavailableStatus: boolean;
|
||||||
unsignedStatus: boolean;
|
unsignedStatus: boolean;
|
||||||
|
|
||||||
onlineToTimestamp: number;
|
onlineFromHours: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Station from '@/scripts/interfaces/Station';
|
import Station from '@/scripts/interfaces/Station';
|
||||||
import Filter from '@/scripts/interfaces/Filter';
|
import Filter from '@/scripts/interfaces/Filter';
|
||||||
|
import StorageManager from './storageManager';
|
||||||
|
|
||||||
const sortStations = (a: Station, b: Station, sorter: { index: number; dir: number }) => {
|
const sortStations = (a: Station, b: Station, sorter: { index: number; dir: number }) => {
|
||||||
switch (sorter.index) {
|
switch (sorter.index) {
|
||||||
@@ -60,7 +61,14 @@ const filterStations = (station: Station, filters: Filter) => {
|
|||||||
|
|
||||||
if (station.online && station.statusID == 'ending' && filters['ending']) return returnMode;
|
if (station.online && station.statusID == 'ending' && filters['ending']) return returnMode;
|
||||||
|
|
||||||
if (filters['onlineToTimestamp'] != -1 && station.online && station.statusTimestamp <= filters['onlineToTimestamp']) return returnMode;
|
if (station.online
|
||||||
|
&& station.statusTimestamp != 0
|
||||||
|
&& filters['onlineFromHours'] < 8
|
||||||
|
&& station.statusTimestamp <= Date.now() + filters['onlineFromHours'] * 3600000)
|
||||||
|
return returnMode;
|
||||||
|
|
||||||
|
if (filters['onlineFromHours'] > 0 && station.statusTimestamp == 0) return returnMode;
|
||||||
|
if (filters['onlineFromHours'] == 8 && station.statusID != 'no-limit') return returnMode;
|
||||||
|
|
||||||
if (station.statusID == 'ending' && filters['endingStatus']) return returnMode;
|
if (station.statusID == 'ending' && filters['endingStatus']) return returnMode;
|
||||||
if ((station.statusID == 'not-signed' || station.statusID == 'unavailable') && filters['unavailableStatus']) return returnMode;
|
if ((station.statusID == 'not-signed' || station.statusID == 'unavailable') && filters['unavailableStatus']) return returnMode;
|
||||||
@@ -105,7 +113,6 @@ const filterStations = (station: Station, filters: Filter) => {
|
|||||||
|
|
||||||
if (filters['SBL'] && station.SBL) return returnMode;
|
if (filters['SBL'] && station.SBL) return returnMode;
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,13 +152,29 @@ export default class StationFilterManager {
|
|||||||
unavailableStatus: false,
|
unavailableStatus: false,
|
||||||
unsignedStatus: false,
|
unsignedStatus: false,
|
||||||
|
|
||||||
onlineToTimestamp: -1
|
onlineFromHours: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
private filters: Filter = { ...this.filterInitStates };
|
private filters: Filter = { ...this.filterInitStates };
|
||||||
|
|
||||||
private sorter: { index: number; dir: number } = { index: 0, dir: 1 };
|
private sorter: { index: number; dir: number } = { index: 0, dir: 1 };
|
||||||
|
|
||||||
|
checkFilters() {
|
||||||
|
if (!StorageManager.isRegistered("options_saved")) return;
|
||||||
|
|
||||||
|
Object.keys(this.filterInitStates).forEach(filterKey => {
|
||||||
|
if (StorageManager.isRegistered(filterKey)) return;
|
||||||
|
|
||||||
|
const filterType = typeof this.filterInitStates[filterKey];
|
||||||
|
|
||||||
|
if (filterType === "boolean")
|
||||||
|
StorageManager.setBooleanValue(filterKey, !this.filterInitStates[filterKey] as boolean);
|
||||||
|
|
||||||
|
if (filterType === "number")
|
||||||
|
StorageManager.setNumericValue(filterKey, this.filterInitStates[filterKey] as number);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getFilteredStationList(stationList: Station[]): Station[] {
|
getFilteredStationList(stationList: Station[]): Station[] {
|
||||||
return stationList
|
return stationList
|
||||||
.filter(station => filterStations(station, this.filters))
|
.filter(station => filterStations(station, this.filters))
|
||||||
|
|||||||
+38
-42
@@ -35,22 +35,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Station from "@/scripts/interfaces/Station";
|
import Station from '@/scripts/interfaces/Station';
|
||||||
|
|
||||||
import StorageManager from "@/scripts/managers/storageManager";
|
import StorageManager from '@/scripts/managers/storageManager';
|
||||||
import StationFilterManager from "@/scripts/managers/stationFilterManager";
|
import StationFilterManager from '@/scripts/managers/stationFilterManager';
|
||||||
|
|
||||||
import inputData from "@/data/options.json";
|
import inputData from '@/data/options.json';
|
||||||
|
|
||||||
import StationTable from "@/components/StationsView/StationTable.vue";
|
import StationTable from '@/components/StationsView/StationTable.vue';
|
||||||
import FilterCard from "@/components/StationsView/StationFilterCard.vue";
|
import FilterCard from '@/components/StationsView/StationFilterCard.vue';
|
||||||
import SelectBox from "@/components/Global/SelectBox.vue";
|
import SelectBox from '@/components/Global/SelectBox.vue';
|
||||||
|
|
||||||
import { StoreData } from "@/scripts/interfaces/StoreData";
|
import { StoreData } from '@/scripts/interfaces/StoreData';
|
||||||
import { DataStatus } from "@/scripts/enums/DataStatus";
|
import { DataStatus } from '@/scripts/enums/DataStatus';
|
||||||
import { computed, ComputedRef, defineComponent, reactive } from "vue";
|
import { computed, ComputedRef, defineComponent, reactive } from 'vue';
|
||||||
import { useStore } from "@/store";
|
import { useStore } from '@/store';
|
||||||
import { GETTERS } from "@/constants/storeConstants";
|
import { GETTERS } from '@/constants/storeConstants';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@@ -59,22 +59,22 @@ export default defineComponent({
|
|||||||
SelectBox,
|
SelectBox,
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
trainIcon: require("@/assets/icon-train.svg"),
|
trainIcon: require('@/assets/icon-train.svg'),
|
||||||
timetableIcon: require("@/assets/icon-timetable.svg"),
|
timetableIcon: require('@/assets/icon-timetable.svg'),
|
||||||
dolarIcon: require("@/assets/icon-dolar.svg"),
|
dolarIcon: require('@/assets/icon-dolar.svg'),
|
||||||
filterCardOpen: false,
|
filterCardOpen: false,
|
||||||
modalHidden: true,
|
modalHidden: true,
|
||||||
STORAGE_KEY: "options_saved",
|
STORAGE_KEY: 'options_saved',
|
||||||
inputs: inputData,
|
inputs: inputData,
|
||||||
|
|
||||||
regions: [
|
regions: [
|
||||||
{
|
{
|
||||||
id: "eu",
|
id: 'eu',
|
||||||
value: "PL1",
|
value: 'PL1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "ru",
|
id: 'ru',
|
||||||
value: "ENG",
|
value: 'ENG',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@@ -82,36 +82,28 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const filterManager = reactive(new StationFilterManager());
|
const filterManager = reactive(new StationFilterManager());
|
||||||
const focusedStationName = "";
|
const focusedStationName = '';
|
||||||
|
|
||||||
const data: ComputedRef<StoreData> = computed(
|
const data: ComputedRef<StoreData> = computed(() => store.getters[GETTERS.allData]);
|
||||||
() => store.getters[GETTERS.allData]
|
|
||||||
);
|
|
||||||
|
|
||||||
const computedStations: ComputedRef<Station[]> = computed(() => {
|
const computedStations: ComputedRef<Station[]> = computed(() => {
|
||||||
return filterManager.getFilteredStationList(
|
return filterManager.getFilteredStationList(store.getters[GETTERS.stationList]);
|
||||||
store.getters[GETTERS.stationList]
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getStatusClass = computed(() => {
|
const getStatusClass = computed(() => {
|
||||||
if (data.value.dataConnectionStatus == DataStatus.Loading)
|
if (data.value.dataConnectionStatus == DataStatus.Loading) return 'loading';
|
||||||
return "loading";
|
if (data.value.dataConnectionStatus == DataStatus.Error) return 'error';
|
||||||
if (data.value.dataConnectionStatus == DataStatus.Error) return "error";
|
return 'success';
|
||||||
return "success";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const timetableDataStatusClass = computed(() => {
|
const timetableDataStatusClass = computed(() => {
|
||||||
if (data.value.timetableDataStatus == DataStatus.Loading)
|
if (data.value.timetableDataStatus == DataStatus.Loading) return 'loading';
|
||||||
return "loading";
|
if (data.value.timetableDataStatus == DataStatus.Error) return 'error';
|
||||||
if (data.value.timetableDataStatus == DataStatus.Error) return "error";
|
return 'success';
|
||||||
return "success";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const focusedStationInfo = computed(() =>
|
const focusedStationInfo = computed(() =>
|
||||||
computedStations.value.find(
|
computedStations.value.find((station) => station.stationName === focusedStationName)
|
||||||
(station) => station.stationName === focusedStationName
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -126,11 +118,15 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!StorageManager.isRegistered(this.STORAGE_KEY)) return;
|
if (!StorageManager.isRegistered(this.STORAGE_KEY)) return;
|
||||||
|
|
||||||
|
this.filterManager.checkFilters();
|
||||||
|
|
||||||
this.inputs.options.forEach((option) => {
|
this.inputs.options.forEach((option) => {
|
||||||
const value = StorageManager.getBooleanValue(option.name);
|
const value = StorageManager.getBooleanValue(option.name);
|
||||||
this.changeFilterValue({ name: option.name, value: value ? 0 : 1 });
|
this.changeFilterValue({ name: option.name, value: value ? 0 : 1 });
|
||||||
option.value = value;
|
option.value = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.inputs.sliders.forEach((slider) => {
|
this.inputs.sliders.forEach((slider) => {
|
||||||
const value = StorageManager.getNumericValue(slider.name);
|
const value = StorageManager.getNumericValue(slider.name);
|
||||||
this.changeFilterValue({ name: slider.name, value });
|
this.changeFilterValue({ name: slider.name, value });
|
||||||
@@ -139,7 +135,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleCardsState(name: string): void {
|
toggleCardsState(name: string): void {
|
||||||
if (name == "filter") {
|
if (name == 'filter') {
|
||||||
this.filterCardOpen = !this.filterCardOpen;
|
this.filterCardOpen = !this.filterCardOpen;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -159,15 +155,15 @@ export default defineComponent({
|
|||||||
this.filterCardOpen = false;
|
this.filterCardOpen = false;
|
||||||
},
|
},
|
||||||
setFocusedStation(name: string) {
|
setFocusedStation(name: string) {
|
||||||
this.focusedStationName = this.focusedStationName == name ? "" : name;
|
this.focusedStationName = this.focusedStationName == name ? '' : name;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "../styles/variables.scss";
|
@import '../styles/variables.scss';
|
||||||
@import "../styles/responsive.scss";
|
@import '../styles/responsive.scss';
|
||||||
|
|
||||||
@keyframes blinkAnim {
|
@keyframes blinkAnim {
|
||||||
0%,
|
0%,
|
||||||
|
|||||||
Reference in New Issue
Block a user