mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
@@ -22,7 +22,7 @@
|
|||||||
"TRE", "TRS",
|
"TRE", "TRS",
|
||||||
"TSE", "TSS",
|
"TSE", "TSS",
|
||||||
"THE", "THS",
|
"THE", "THS",
|
||||||
"LPE",
|
"LPE", "LPS",
|
||||||
"LTE", "LTS",
|
"LTE", "LTS",
|
||||||
"LSS",
|
"LSS",
|
||||||
"LZE", "LZS",
|
"LZE", "LZS",
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@
|
|||||||
"categories": {
|
"categories": {
|
||||||
"EI": "domestic express",
|
"EI": "domestic express",
|
||||||
"EC": "international express",
|
"EC": "international express",
|
||||||
"EN": "domestic night express",
|
"EN": "international night express",
|
||||||
"MP": "intervoivodeship bullet",
|
"MP": "intervoivodeship bullet",
|
||||||
"MO": "intervoivodeship regio",
|
"MO": "intervoivodeship regio",
|
||||||
"MM": "international bullet",
|
"MM": "international bullet",
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@
|
|||||||
"categories": {
|
"categories": {
|
||||||
"EI": "ekspres krajowy",
|
"EI": "ekspres krajowy",
|
||||||
"EC": "ekspres międzynarodowy",
|
"EC": "ekspres międzynarodowy",
|
||||||
"EN": "ekspres krajowy nocny",
|
"EN": "ekspres międzynarodowy nocny",
|
||||||
"MP": "międzywojewódzki pospieszny",
|
"MP": "międzywojewódzki pospieszny",
|
||||||
"MO": "międzywojewódzki osobowy",
|
"MO": "międzywojewódzki osobowy",
|
||||||
"MM": "międzynarodowy pospieszny",
|
"MM": "międzynarodowy pospieszny",
|
||||||
|
|||||||
+5
-2
@@ -36,7 +36,10 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
props: (route) => ({
|
props: (route) => ({
|
||||||
region: route.query.region,
|
region: route.query.region,
|
||||||
station: route.query.station
|
station: route.query.station
|
||||||
})
|
}),
|
||||||
|
beforeEnter: (to, from) => {
|
||||||
|
to.meta['prevPath'] = from.fullPath;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/journal',
|
path: '/journal',
|
||||||
@@ -72,7 +75,7 @@ const router = createRouter({
|
|||||||
from.query['view'] === undefined &&
|
from.query['view'] === undefined &&
|
||||||
!savedPosition
|
!savedPosition
|
||||||
)
|
)
|
||||||
return { el: `.scenery-left`, behavior: 'instant', top: 3 };
|
return { el: `.app_main`, behavior: 'instant', top: -13 };
|
||||||
|
|
||||||
if (savedPosition) return savedPosition;
|
if (savedPosition) return savedPosition;
|
||||||
},
|
},
|
||||||
|
|||||||
+84
-115
@@ -23,8 +23,8 @@
|
|||||||
v-for="(viewMode, i) in viewModes"
|
v-for="(viewMode, i) in viewModes"
|
||||||
:key="i"
|
:key="i"
|
||||||
class="btn btn--option"
|
class="btn btn--option"
|
||||||
:class="{ checked: currentMode == viewMode.component }"
|
:class="{ checked: currentMode == viewMode.component.name }"
|
||||||
@click="setViewMode(viewMode.component)"
|
@click="setViewMode(viewMode.component.name!)"
|
||||||
>
|
>
|
||||||
{{ $t(viewMode.id) }}
|
{{ $t(viewMode.id) }}
|
||||||
</button>
|
</button>
|
||||||
@@ -32,17 +32,17 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
apiStore.dataStatuses.sceneries == Status.Loading ||
|
apiStore.dataStatuses.sceneries == Status.Data.Loading ||
|
||||||
apiStore.dataStatuses.connection == Status.Loading
|
apiStore.dataStatuses.connection == Status.Data.Loading
|
||||||
"
|
"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
<keep-alive v-else>
|
<keep-alive v-else>
|
||||||
<component
|
<component
|
||||||
:is="currentMode"
|
:is="currentViewComponent"
|
||||||
:onlineScenery="onlineSceneryInfo"
|
:onlineScenery="onlineSceneryInfo"
|
||||||
:station="stationInfo"
|
:station="stationInfo"
|
||||||
:key="currentMode"
|
:key="currentViewComponent.name"
|
||||||
></component>
|
></component>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,130 +50,99 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import routerMixin from '../mixins/routerMixin';
|
|
||||||
import { useMainStore } from '../store/mainStore';
|
import { useMainStore } from '../store/mainStore';
|
||||||
|
|
||||||
import SceneryInfo from '../components/SceneryView/SceneryInfo.vue';
|
import SceneryInfo from '../components/SceneryView/SceneryInfo.vue';
|
||||||
import SceneryHeader from '../components/SceneryView/SceneryHeader.vue';
|
import SceneryHeader from '../components/SceneryView/SceneryHeader.vue';
|
||||||
|
|
||||||
import SceneryTimetable from '../components/SceneryView/SceneryTimetable.vue';
|
import SceneryTimetable from '../components/SceneryView/SceneryTimetable.vue';
|
||||||
import SceneryTimetablesHistory from '../components/SceneryView/SceneryTimetablesHistory.vue';
|
import SceneryTimetablesHistory from '../components/SceneryView/SceneryTimetablesHistory.vue';
|
||||||
import SceneryDispatchersHistory from '../components/SceneryView/SceneryDispatchersHistory.vue';
|
import SceneryDispatchersHistory from '../components/SceneryView/SceneryDispatchersHistory.vue';
|
||||||
import ActionButton from '../components/Global/ActionButton.vue';
|
|
||||||
import { Status } from '../typings/common';
|
|
||||||
import { useApiStore } from '../store/apiStore';
|
import { useApiStore } from '../store/apiStore';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { Status } from '../typings/common';
|
||||||
|
|
||||||
enum SceneryViewMode {
|
const route = useRoute();
|
||||||
'TIMETABLES_ACTIVE',
|
const router = useRouter();
|
||||||
'TIMETABLES_HISTORY',
|
|
||||||
'SCENERY_HISTORY'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default defineComponent({
|
const prevPath = ref('/');
|
||||||
name: 'SceneryView',
|
|
||||||
|
|
||||||
components: {
|
const props = defineProps({
|
||||||
SceneryInfo,
|
region: {
|
||||||
SceneryTimetable,
|
type: String,
|
||||||
ActionButton,
|
required: false
|
||||||
SceneryHeader,
|
|
||||||
SceneryTimetablesHistory,
|
|
||||||
SceneryDispatchersHistory
|
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
station: {
|
||||||
region: {
|
type: String,
|
||||||
type: String,
|
required: true
|
||||||
required: false
|
|
||||||
},
|
|
||||||
|
|
||||||
station: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [routerMixin],
|
|
||||||
|
|
||||||
data: () => ({
|
|
||||||
store: useMainStore(),
|
|
||||||
apiStore: useApiStore(),
|
|
||||||
|
|
||||||
viewModes: [
|
|
||||||
{
|
|
||||||
id: 'scenery.option-active-timetables',
|
|
||||||
component: 'SceneryTimetable'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'scenery.option-timetables-history',
|
|
||||||
component: 'SceneryTimetablesHistory'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'scenery.option-dispatchers-history',
|
|
||||||
component: 'SceneryDispatchersHistory'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
sceneryViewMode: SceneryViewMode,
|
|
||||||
selectedCheckpoint: '',
|
|
||||||
currentViewCompontent: 'SceneryTimetable',
|
|
||||||
onlineFrom: -1,
|
|
||||||
Status: Status.Data
|
|
||||||
}),
|
|
||||||
|
|
||||||
setup() {
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const isComponentVisible = computed(() => route.path === '/scenery');
|
|
||||||
|
|
||||||
return {
|
|
||||||
isComponentVisible
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
currentMode() {
|
|
||||||
return this.$route.query.view?.toString() ?? 'SceneryTimetable';
|
|
||||||
},
|
|
||||||
|
|
||||||
stationInfo() {
|
|
||||||
return this.store.stationList.find(
|
|
||||||
(station) => station.name === this.station?.toString().replace(/_/g, ' ')
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
onlineSceneryInfo() {
|
|
||||||
return this.store.activeSceneryList.find(
|
|
||||||
(scenery) =>
|
|
||||||
scenery.name === this.station?.toString().replace(/_/g, ' ') &&
|
|
||||||
scenery.region == this.store.region.id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
setViewMode(componentName: string) {
|
|
||||||
this.$router.push({
|
|
||||||
path: this.$route.path,
|
|
||||||
query: {
|
|
||||||
...this.$route.query,
|
|
||||||
view: componentName
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
loadSelectedCheckpoint() {
|
|
||||||
if (!this.stationInfo?.generalInfo?.checkpoints) return;
|
|
||||||
if (this.stationInfo.generalInfo.checkpoints.length == 0) return;
|
|
||||||
this.selectedCheckpoint = this.stationInfo.generalInfo.checkpoints[0];
|
|
||||||
},
|
|
||||||
|
|
||||||
onReturnButtonClick() {
|
|
||||||
this.$router.back();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const store = useMainStore();
|
||||||
|
const apiStore = useApiStore();
|
||||||
|
|
||||||
|
const viewModes = [
|
||||||
|
{
|
||||||
|
id: 'scenery.option-active-timetables',
|
||||||
|
component: SceneryTimetable
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'scenery.option-timetables-history',
|
||||||
|
component: SceneryTimetablesHistory
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'scenery.option-dispatchers-history',
|
||||||
|
component: SceneryDispatchersHistory
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
prevPath.value = (route.meta['prevPath'] as string) ?? '/';
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentMode = computed(() => {
|
||||||
|
return route.query.view?.toString() ?? 'SceneryTimetable';
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentViewComponent = computed(() => {
|
||||||
|
return (
|
||||||
|
viewModes.find((mode) => mode.component.name == currentMode.value)?.component ??
|
||||||
|
SceneryTimetable
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const stationInfo = computed(() => {
|
||||||
|
return store.stationList.find(
|
||||||
|
(station) => station.name === props.station?.toString().replace(/_/g, ' ')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const onlineSceneryInfo = computed(() => {
|
||||||
|
return store.activeSceneryList.find(
|
||||||
|
(scenery) =>
|
||||||
|
scenery.name === props.station?.toString().replace(/_/g, ' ') &&
|
||||||
|
scenery.region == store.region.id
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function setViewMode(componentName: string) {
|
||||||
|
router.push({
|
||||||
|
path: route.path,
|
||||||
|
query: {
|
||||||
|
...route.query,
|
||||||
|
view: componentName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onReturnButtonClick() {
|
||||||
|
router.push(prevPath.value);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user