Przekierowanie do strony głównej

This commit is contained in:
2022-12-21 20:32:41 +01:00
parent db3be87dd8
commit 240817acc3
+19 -11
View File
@@ -22,7 +22,9 @@
<StatusIndicator /> <StatusIndicator />
<span class="header_brand"> <span class="header_brand">
<router-link to="/">
<img :src="getImage('stacjownik-header-logo.svg')" alt="Stacjownik" /> <img :src="getImage('stacjownik-header-logo.svg')" alt="Stacjownik" />
</router-link>
</span> </span>
<span class="header_info"> <span class="header_info">
@@ -48,7 +50,12 @@
/ /
<router-link class="route" active-class="route-active" to="/trains">{{ $t('app.trains') }}</router-link> <router-link class="route" active-class="route-active" to="/trains">{{ $t('app.trains') }}</router-link>
/ /
<router-link class="route" active-class="route-active" :data-active="$route.path.startsWith('/journal')" to="/journal"> <router-link
class="route"
active-class="route-active"
:data-active="$route.path.startsWith('/journal')"
to="/journal"
>
{{ $t('app.journal') }} {{ $t('app.journal') }}
</router-link> </router-link>
</span> </span>
@@ -66,7 +73,7 @@ import StatusIndicator from './StatusIndicator.vue';
import Clock from './Clock.vue'; import Clock from './Clock.vue';
export default defineComponent({ export default defineComponent({
emits: ["changeLang"], emits: ['changeLang'],
mixins: [imageMixin], mixins: [imageMixin],
props: { props: {
currentLang: { currentLang: {
@@ -80,14 +87,11 @@ export default defineComponent({
}; };
}, },
methods: { methods: {
changeRegion(region: { changeRegion(region: { id: string; value: string }) {
id: string;
value: string;
}) {
this.store.changeRegion(region); this.store.changeRegion(region);
}, },
changeLang(lang: string) { changeLang(lang: string) {
this.$emit("changeLang", lang); this.$emit('changeLang', lang);
}, },
}, },
computed: { computed: {
@@ -95,12 +99,16 @@ export default defineComponent({
return this.store.trainList.filter((train) => train.online).length; return this.store.trainList.filter((train) => train.online).length;
}, },
onlineDispatchersCount() { onlineDispatchersCount() {
return this.store.stationList.filter((station) => station.onlineInfo && station.onlineInfo.region == this.store.region.id).length; return this.store.stationList.filter(
(station) => station.onlineInfo && station.onlineInfo.region == this.store.region.id
).length;
}, },
computedRegions() { computedRegions() {
return options.regions.map((region) => { return options.regions.map((region) => {
const regionStationCount = this.store.apiData.stations?.filter((station) => station.region == region.id && station.isOnline).length || 0; const regionStationCount =
const regionTrainCount = this.store.apiData.trains?.filter((train) => train.region == region.id && train.online).length || 0; this.store.apiData.stations?.filter((station) => station.region == region.id && station.isOnline).length || 0;
const regionTrainCount =
this.store.apiData.trains?.filter((train) => train.region == region.id && train.online).length || 0;
return { return {
id: region.id, id: region.id,
value: `${region.value} <div class='text--grayed'>${regionStationCount} / ${regionTrainCount}</div>`, value: `${region.value} <div class='text--grayed'>${regionStationCount} / ${regionTrainCount}</div>`,
@@ -109,7 +117,7 @@ export default defineComponent({
}); });
}, },
}, },
components: { SelectBox, StatusIndicator, Clock } components: { SelectBox, StatusIndicator, Clock },
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>