mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6992b998a8 | |||
| 669975c68e | |||
| 084823de44 | |||
| f62d6982e5 | |||
| 1c9b54b578 | |||
| 0f4e5ee5f3 | |||
| 29b5e715fa |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stacjownik",
|
"name": "stacjownik",
|
||||||
"version": "1.22.0",
|
"version": "1.22.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
@import './styles/responsive.scss';
|
|
||||||
@import './styles/variables.scss';
|
|
||||||
@import './styles/global.scss';
|
|
||||||
@import './styles/animations.scss';
|
|
||||||
|
|
||||||
.route {
|
|
||||||
margin: 0 0.2em;
|
|
||||||
|
|
||||||
&-active,
|
|
||||||
&[data-active='true'] {
|
|
||||||
color: $accentCol;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// APP
|
|
||||||
#app {
|
|
||||||
color: white;
|
|
||||||
font-size: 1rem;
|
|
||||||
overflow-x: hidden;
|
|
||||||
|
|
||||||
@include smallScreen() {
|
|
||||||
font-size: calc(0.65rem + 0.8vw);
|
|
||||||
}
|
|
||||||
|
|
||||||
@include screenLandscape() {
|
|
||||||
font-size: calc(0.45rem + 0.8vw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CONTAINER
|
|
||||||
.app_container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-rows: auto 1fr auto;
|
|
||||||
grid-template-columns: 100%;
|
|
||||||
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app_main {
|
|
||||||
padding: 0 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
background-color: firebrick;
|
|
||||||
text-align: center;
|
|
||||||
padding: 0.5em 0.4em;
|
|
||||||
max-width: 1100px;
|
|
||||||
margin: 0 auto;
|
|
||||||
|
|
||||||
border-radius: 0 0 1em 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FOOTER
|
|
||||||
footer.app_footer {
|
|
||||||
max-width: 100%;
|
|
||||||
padding: 0.5em;
|
|
||||||
|
|
||||||
img {
|
|
||||||
width: 1.1em;
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
z-index: 10;
|
|
||||||
|
|
||||||
background: #111;
|
|
||||||
color: white;
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
+78
-2
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app_container">
|
<div class="app_container" v-cloak>
|
||||||
<transition name="modal-anim">
|
<transition name="modal-anim">
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
<TrainModal v-if="store.chosenModalTrainId" />
|
<TrainModal v-if="store.chosenModalTrainId" />
|
||||||
@@ -73,6 +73,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
window.addEventListener('focus', () => {
|
||||||
|
if (Date.now() - this.apiStore.lastFetchData.getTime() < 15000) return;
|
||||||
|
|
||||||
|
this.apiStore.fetchActiveData();
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => this.store.blockScroll,
|
() => this.store.blockScroll,
|
||||||
(value) => {
|
(value) => {
|
||||||
@@ -175,4 +181,74 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" src="./App.scss"></style>
|
<style lang="scss">
|
||||||
|
@import './styles/global';
|
||||||
|
@import './styles/animations';
|
||||||
|
|
||||||
|
.route {
|
||||||
|
margin: 0 0.2em;
|
||||||
|
|
||||||
|
&-active,
|
||||||
|
&[data-active='true'] {
|
||||||
|
color: $accentCol;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// APP
|
||||||
|
#app {
|
||||||
|
color: white;
|
||||||
|
font-size: 1rem;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
@include smallScreen() {
|
||||||
|
font-size: calc(0.65rem + 0.8vw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@include screenLandscape() {
|
||||||
|
font-size: calc(0.45rem + 0.8vw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CONTAINER
|
||||||
|
.app_container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto 1fr auto;
|
||||||
|
grid-template-columns: 100%;
|
||||||
|
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app_main {
|
||||||
|
padding: 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
background-color: firebrick;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0.5em 0.4em;
|
||||||
|
max-width: 1100px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
border-radius: 0 0 1em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FOOTER
|
||||||
|
footer.app_footer {
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0.5em;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 1.1em;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
background: #111;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default defineComponent({
|
|||||||
regionList() {
|
regionList() {
|
||||||
return regionsJSON.map((region) => {
|
return regionsJSON.map((region) => {
|
||||||
const regionStationCount = this.store.activeSceneryList.filter(
|
const regionStationCount = this.store.activeSceneryList.filter(
|
||||||
(scenery) => scenery.region == region.id
|
(scenery) => scenery.region == region.id && scenery.dispatcherId != -1
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
const regionTrainCount =
|
const regionTrainCount =
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default defineComponent({
|
|||||||
onImageError(event: Event, stockName: string) {
|
onImageError(event: Event, stockName: string) {
|
||||||
let fallbackName = '';
|
let fallbackName = '';
|
||||||
|
|
||||||
const isLoco = /.-\d/.test(stockName);
|
const isLoco = /.-\d{3}/.test(stockName);
|
||||||
|
|
||||||
if (isLoco) {
|
if (isLoco) {
|
||||||
fallbackName += 'loco-';
|
fallbackName += 'loco-';
|
||||||
|
|||||||
@@ -286,7 +286,9 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<Loading v-if="apiStore.dataStatuses.connection == Status.Loading" />
|
<Loading
|
||||||
|
v-if="apiStore.dataStatuses.connection == Status.Loading && stations.length == 0"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="no-stations" v-else-if="stations.length == 0">
|
<div class="no-stations" v-else-if="stations.length == 0">
|
||||||
{{ $t('sceneries.no-stations') }}
|
{{ $t('sceneries.no-stations') }}
|
||||||
|
|||||||
@@ -148,11 +148,6 @@ export default defineComponent({
|
|||||||
if (distance < 1000) return `${distance}m`;
|
if (distance < 1000) return `${distance}m`;
|
||||||
|
|
||||||
return `${(distance / 1000).toPrecision(2)}km`;
|
return `${(distance / 1000).toPrecision(2)}km`;
|
||||||
},
|
|
||||||
|
|
||||||
onImageError(e: Event) {
|
|
||||||
const imageEl = e.target as HTMLImageElement;
|
|
||||||
imageEl.src = '/images/icon-unknown.png';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-4
@@ -1,6 +1,4 @@
|
|||||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||||
import JournalDispatchersVue from '../views/JournalDispatchers.vue';
|
|
||||||
import JournalTimetablesVue from '../views/JournalTimetables.vue';
|
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
@@ -38,7 +36,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: '/journal/timetables',
|
path: '/journal/timetables',
|
||||||
name: 'JournalTimetables',
|
name: 'JournalTimetables',
|
||||||
component: JournalTimetablesVue,
|
component: () => import('../views/JournalTimetables.vue'),
|
||||||
props: (route) => ({
|
props: (route) => ({
|
||||||
region: route.query.region
|
region: route.query.region
|
||||||
})
|
})
|
||||||
@@ -46,7 +44,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: '/journal/dispatchers',
|
path: '/journal/dispatchers',
|
||||||
name: 'JournalDispatchers',
|
name: 'JournalDispatchers',
|
||||||
component: JournalDispatchersVue,
|
component: () => import('../views/JournalDispatchers.vue'),
|
||||||
props: (route) => ({
|
props: (route) => ({
|
||||||
region: route.query.region
|
region: route.query.region
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export const useApiStore = defineStore('apiStore', {
|
|||||||
donatorsData: [] as API.Donators.Response,
|
donatorsData: [] as API.Donators.Response,
|
||||||
sceneryData: [] as StationJSONData[],
|
sceneryData: [] as StationJSONData[],
|
||||||
|
|
||||||
|
lastFetchData: new Date(),
|
||||||
|
|
||||||
client: undefined as AxiosInstance | undefined,
|
client: undefined as AxiosInstance | undefined,
|
||||||
|
|
||||||
activeDataScheduler: undefined as number | undefined
|
activeDataScheduler: undefined as number | undefined
|
||||||
@@ -64,20 +66,19 @@ export const useApiStore = defineStore('apiStore', {
|
|||||||
async setupActiveDataFetcher() {
|
async setupActiveDataFetcher() {
|
||||||
if (this.activeDataScheduler) return;
|
if (this.activeDataScheduler) return;
|
||||||
|
|
||||||
this.dataStatuses.connection = Status.Data.Loading;
|
|
||||||
|
|
||||||
this.activeDataScheduler = window.setInterval(() => {
|
this.activeDataScheduler = window.setInterval(() => {
|
||||||
if (UPDATE_SECONDS.includes(new Date().getSeconds())) {
|
|
||||||
this.fetchActiveData();
|
this.fetchActiveData();
|
||||||
}
|
}, 25000);
|
||||||
}, 1000);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchActiveData() {
|
async fetchActiveData() {
|
||||||
|
if (!this.activeData) this.dataStatuses.connection = Status.Data.Loading;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.client!.get<API.ActiveData.Response>('api/getActiveData');
|
const response = await this.client!.get<API.ActiveData.Response>('api/getActiveData');
|
||||||
|
|
||||||
this.activeData = response.data;
|
this.activeData = response.data;
|
||||||
|
this.lastFetchData = new Date();
|
||||||
this.dataStatuses.connection = Status.Data.Loaded;
|
this.dataStatuses.connection = Status.Data.Loaded;
|
||||||
|
|
||||||
console.log('Fetching active data at ' + new Date().toLocaleTimeString('pl-PL'));
|
console.log('Fetching active data at ' + new Date().toLocaleTimeString('pl-PL'));
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
@import 'fonts.scss';
|
@import 'fonts';
|
||||||
|
@import 'variables';
|
||||||
|
@import 'responsive';
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--clr-primary: #ffc014;
|
--clr-primary: #ffc014;
|
||||||
|
|||||||
Reference in New Issue
Block a user