mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
chore: moved language button to sceneries table top bar
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gb" viewBox="0 0 640 480">
|
||||||
|
<path fill="#012169" d="M0 0h640v480H0z"/>
|
||||||
|
<path fill="#FFF" d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0z"/>
|
||||||
|
<path fill="#C8102E" d="m424 281 216 159v40L369 281zm-184 20 6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z"/>
|
||||||
|
<path fill="#FFF" d="M241 0v480h160V0zM0 160v160h640V160z"/>
|
||||||
|
<path fill="#C8102E" d="M0 193v96h640v-96zM273 0v480h96V0z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 504 B |
@@ -1,4 +1,6 @@
|
|||||||
<svg width="39" height="23" viewBox="0 0 39 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-pl" viewBox="0 0 640 480">
|
||||||
<rect width="39" height="23" fill="#FF0F0F"/>
|
<g fill-rule="evenodd">
|
||||||
<rect width="39" height="11.5" fill="white"/>
|
<path fill="#fff" d="M640 480H0V0h640z"/>
|
||||||
|
<path fill="#dc143c" d="M640 480H0V240h640z"/>
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 219 B |
+3
-10
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<Tooltip />
|
<Tooltip />
|
||||||
|
|
||||||
<AppHeader :current-lang="store.currentLocale" @change-lang="changeLang" />
|
<AppHeader />
|
||||||
|
|
||||||
<main class="app_main">
|
<main class="app_main">
|
||||||
<router-view v-slot="{ Component }">
|
<router-view v-slot="{ Component }">
|
||||||
@@ -159,18 +159,11 @@ export default defineComponent({
|
|||||||
this.apiStore.connectToAPI();
|
this.apiStore.connectToAPI();
|
||||||
},
|
},
|
||||||
|
|
||||||
changeLang(lang: string) {
|
|
||||||
this.$i18n.locale = lang;
|
|
||||||
this.store.currentLocale = lang;
|
|
||||||
|
|
||||||
StorageManager.setStringValue('lang', lang);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadLang() {
|
loadLang() {
|
||||||
const storageLang = StorageManager.getStringValue('lang');
|
const storageLang = StorageManager.getStringValue('lang');
|
||||||
|
|
||||||
if (storageLang) {
|
if (storageLang) {
|
||||||
this.changeLang(storageLang);
|
this.store.changeLocale(storageLang);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +172,7 @@ export default defineComponent({
|
|||||||
const naviLanguage = window.navigator.language.toString();
|
const naviLanguage = window.navigator.language.toString();
|
||||||
|
|
||||||
if (!naviLanguage.startsWith('pl')) {
|
if (!naviLanguage.startsWith('pl')) {
|
||||||
this.changeLang('en');
|
this.store.changeLocale('en');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,18 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<header class="app_header">
|
<header class="app_header">
|
||||||
<div class="header_container">
|
<div class="header_container">
|
||||||
<div class="header_icons">
|
|
||||||
<span class="icons-top">
|
|
||||||
<img
|
|
||||||
src="/images/icon-pl.svg"
|
|
||||||
alt="icon-pl"
|
|
||||||
@click="changeLang('en')"
|
|
||||||
v-if="currentLang == 'pl'"
|
|
||||||
/>
|
|
||||||
<img src="/images/icon-en.jpg" alt="icon-en" @click="changeLang('pl')" v-else />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="header_body">
|
<div class="header_body">
|
||||||
<StatusIndicator />
|
<StatusIndicator />
|
||||||
|
|
||||||
@@ -76,27 +64,12 @@ import RegionDropdown from '../Global/RegionDropdown.vue';
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { StatusIndicator, Clock, RegionDropdown },
|
components: { StatusIndicator, Clock, RegionDropdown },
|
||||||
|
|
||||||
emits: ['changeLang'],
|
|
||||||
|
|
||||||
props: {
|
|
||||||
currentLang: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
store: useMainStore()
|
store: useMainStore()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
|
||||||
changeLang(lang: string) {
|
|
||||||
this.$emit('changeLang', lang);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
onlineTrainsCount() {
|
onlineTrainsCount() {
|
||||||
return this.store.trainList.filter((train) => train.region == this.store.region.id).length;
|
return this.store.trainList.filter((train) => train.region == this.store.region.id).length;
|
||||||
@@ -141,7 +114,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
border-radius: 0 0 1em 1em;
|
border-radius: 0 0 1em 1em;
|
||||||
|
|
||||||
@include responsive.smallScreen{
|
@include responsive.smallScreen {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
@@ -180,20 +153,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
|
||||||
@include responsive.smallScreen{
|
@include responsive.smallScreen {
|
||||||
transform: translateX(85%);
|
transform: translateX(85%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ICONS
|
|
||||||
.icons-top {
|
|
||||||
img {
|
|
||||||
width: 2.5em;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// COUNTER
|
// COUNTER
|
||||||
.info_counter {
|
.info_counter {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<h1>{{ $t('welcome.title') }}</h1>
|
<h1>{{ $t('welcome.title') }}</h1>
|
||||||
|
|
||||||
<div class="language-select">
|
<div class="language-select">
|
||||||
<button :data-active="$i18n.locale == 'pl'" @click="changeLang('pl')">
|
<button :data-active="$i18n.locale == 'pl'" @click="store.changeLocale('pl')">
|
||||||
<img src="/images/icon-pl.svg" alt="" width="45" />
|
<img src="/images/icon-pl.svg" alt="" width="45" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button :data-active="$i18n.locale == 'en'" @click="changeLang('en')">
|
<button :data-active="$i18n.locale == 'en'" @click="store.changeLocale('en')">
|
||||||
<img src="/images/icon-en.jpg" alt="" width="45" />
|
<img src="/images/icon-en.jpg" alt="" width="45" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,12 +114,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import Card from '../Global/Card.vue';
|
import Card from '../Global/Card.vue';
|
||||||
import { useMainStore } from '../../store/mainStore';
|
import { useMainStore } from '../../store/mainStore';
|
||||||
import StorageManager from '../../managers/storageManager';
|
|
||||||
|
|
||||||
const i18n = useI18n();
|
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
|
|
||||||
const emit = defineEmits(['toggleCard']);
|
const emit = defineEmits(['toggleCard']);
|
||||||
@@ -130,13 +127,6 @@ const props = defineProps({
|
|||||||
function toggleCard(state: boolean) {
|
function toggleCard(state: boolean) {
|
||||||
emit('toggleCard', state);
|
emit('toggleCard', state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeLang(localeName: string) {
|
|
||||||
i18n.locale.value = localeName;
|
|
||||||
store.currentLocale = localeName;
|
|
||||||
|
|
||||||
StorageManager.setStringValue('lang', localeName);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
"tooltip-driver-offline": "Driver is offline",
|
"tooltip-driver-offline": "Driver is offline",
|
||||||
"tooltip-scenery-offline": "Scenery is offline",
|
"tooltip-scenery-offline": "Scenery is offline",
|
||||||
"pojazdownik-link-content": "POJAZDOWNIK",
|
"pojazdownik-link-content": "POJAZDOWNIK",
|
||||||
|
"language-tooltip-content": "JĘZYK / LANGUAGE",
|
||||||
"gnr-link-content": "TRAIN ORDERS <br> GENERATOR"
|
"gnr-link-content": "TRAIN ORDERS <br> GENERATOR"
|
||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
"tooltip-driver-offline": "Maszynista offline",
|
"tooltip-driver-offline": "Maszynista offline",
|
||||||
"tooltip-scenery-offline": "Sceneria offline",
|
"tooltip-scenery-offline": "Sceneria offline",
|
||||||
"pojazdownik-link-content": "POJAZDOWNIK",
|
"pojazdownik-link-content": "POJAZDOWNIK",
|
||||||
|
"language-tooltip-content": "JĘZYK / LANGUAGE",
|
||||||
"gnr-link-content": "GENERATOR <br> ROZKAZÓW PISEMNYCH"
|
"gnr-link-content": "GENERATOR <br> ROZKAZÓW PISEMNYCH"
|
||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import {
|
|||||||
} from '../typings/common';
|
} from '../typings/common';
|
||||||
import { useApiStore } from './apiStore';
|
import { useApiStore } from './apiStore';
|
||||||
import { MainStoreState } from './typings';
|
import { MainStoreState } from './typings';
|
||||||
|
import i18n from '../i18n';
|
||||||
|
import StorageManager from '../managers/storageManager';
|
||||||
|
|
||||||
const checkpointsTrains: Map<string, CheckpointTrain[]> = new Map();
|
const checkpointsTrains: Map<string, CheckpointTrain[]> = new Map();
|
||||||
const unknownSceneryCheckpoints: Map<string, Set<string>> = new Map();
|
const unknownSceneryCheckpoints: Map<string, Set<string>> = new Map();
|
||||||
@@ -37,6 +39,15 @@ export const useMainStore = defineStore('mainStore', {
|
|||||||
currentLocale: 'pl'
|
currentLocale: 'pl'
|
||||||
}) as MainStoreState,
|
}) as MainStoreState,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
changeLocale(localeName: string) {
|
||||||
|
(i18n.global.locale.value as any) = localeName;
|
||||||
|
this.currentLocale = localeName;
|
||||||
|
|
||||||
|
StorageManager.setStringValue('lang', localeName);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
trainList(): Train[] {
|
trainList(): Train[] {
|
||||||
const apiStore = useApiStore();
|
const apiStore = useApiStore();
|
||||||
|
|||||||
@@ -13,6 +13,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="topbar-links">
|
<div class="topbar-links">
|
||||||
|
<button
|
||||||
|
class="btn--image lang-button"
|
||||||
|
@click="toggleLocales()"
|
||||||
|
data-tooltip-type="HtmlTooltip"
|
||||||
|
:data-tooltip-content="`<b>${$t('app.language-tooltip-content')}</b>`"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
:src="`/images/icon-${mainStore.currentLocale}.svg`"
|
||||||
|
alt="change language flag icon"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class="a-button btn--image gnr-link"
|
class="a-button btn--image gnr-link"
|
||||||
href="https://generator-td2.web.app/"
|
href="https://generator-td2.web.app/"
|
||||||
@@ -96,6 +108,10 @@ export default defineComponent({
|
|||||||
methods: {
|
methods: {
|
||||||
toggleDonationCard(value: boolean) {
|
toggleDonationCard(value: boolean) {
|
||||||
this.isDonationCardOpen = value;
|
this.isDonationCardOpen = value;
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleLocales() {
|
||||||
|
this.mainStore.changeLocale(this.mainStore.currentLocale == 'pl' ? 'en' : 'pl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -149,6 +165,11 @@ button.donation-button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.lang-button {
|
||||||
|
padding: 0 0.5em;
|
||||||
|
background-color: #111;
|
||||||
|
}
|
||||||
|
|
||||||
a.pojazdownik-link {
|
a.pojazdownik-link {
|
||||||
background-color: #1f263b;
|
background-color: #1f263b;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user