mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c78af4dc0 | |||
| 052ca08f01 | |||
| b01b2f8360 | |||
| bda369d13b | |||
| a8cac9ebe9 | |||
| 0d55a10ec2 | |||
| fa7b1c1629 | |||
| c99b5df4aa | |||
| 0b435c95a0 | |||
| 5d32145f13 | |||
| cb6ea1edb2 | |||
| 6a3974f899 | |||
| 2cbeef7611 | |||
| 43be04826d | |||
| d9986da354 | |||
| ac2269c5a5 | |||
| 6957120b3b |
@@ -3,10 +3,10 @@ name: Build & Deploy to VPS
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
env:
|
||||
PROJECT_NAME: stacjownik
|
||||
PROJECT_NAME: stacjownik-td2
|
||||
|
||||
jobs:
|
||||
build_and_deploy:
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ app.get('/api/getSceneries', (_, res) => {
|
||||
res.sendFile(path.join(cwd(), 'endpoints', 'getSceneries.json'));
|
||||
});
|
||||
|
||||
app.get('/api/getVehicles', (_, res) => {
|
||||
res.sendFile(path.join(cwd(), 'endpoints', 'getVehicles.json'));
|
||||
app.get('/api/getVehiclesData', (_, res) => {
|
||||
res.sendFile(path.join(cwd(), 'endpoints', 'getVehiclesData.json'));
|
||||
});
|
||||
|
||||
app.get('/api/getDonators', (_, res) => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stacjownik",
|
||||
"version": "1.30.7",
|
||||
"version": "1.31.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<Card :is-open="isUpdateCardOpen" @toggle-card="toggleCard(false)">
|
||||
<div class="content">
|
||||
<div class="content" tabindex="0" ref="content">
|
||||
<h1 style="margin-bottom: 0.5em">🚀 {{ $t('update.title') }}</h1>
|
||||
|
||||
<div class="features-body" v-if="htmlChangelog != ''" v-html="htmlChangelog"></div>
|
||||
@@ -13,7 +13,14 @@
|
||||
<p class="bottom-info">
|
||||
{{ $t('update.info-1') }}
|
||||
<br />
|
||||
<span v-html="$t('update.info-2')"></span>
|
||||
|
||||
<i18n-t keypath="update.info-2">
|
||||
<template v-slot:link>
|
||||
<a href="https://github.com/Spythere/stacjownik" target="_blank">{{
|
||||
$t('update.info-2-link-text')
|
||||
}}</a>
|
||||
</template>
|
||||
</i18n-t>
|
||||
</p>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -51,7 +58,7 @@ export default defineComponent({
|
||||
watch: {
|
||||
isUpdateCardOpen(val: boolean) {
|
||||
this.$nextTick(() => {
|
||||
if (val) (this.$refs['confirm-btn'] as HTMLElement).focus();
|
||||
if (val) (this.$refs['content'] as HTMLElement).focus();
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -79,13 +86,18 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
::v-deep(h2) {
|
||||
padding: 0.25em 0;
|
||||
margin-top: 1em;
|
||||
padding: 0.5em 0;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
|
||||
::v-deep(h3) {
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
::v-deep(ul) {
|
||||
list-style: initial;
|
||||
padding: 1em;
|
||||
list-style: disc;
|
||||
padding: 0 1.5em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
@@ -105,7 +117,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 0 auto;
|
||||
margin: 0.5em auto;
|
||||
padding: 0.5em 0.75em;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
@@ -117,5 +129,6 @@ p.bottom-info {
|
||||
|
||||
a {
|
||||
text-decoration: underline;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -205,7 +205,7 @@ const availableCategories = computed(() => {
|
||||
for (const stockName of stockList) {
|
||||
const [vehicleName, ...cargoList] = stockName.split(':');
|
||||
|
||||
const vehicleData = apiStore.vehiclesData?.find((v) => v.name == vehicleName);
|
||||
const vehicleData = apiStore.vehiclesData?.vehicles.find((v) => v.name == vehicleName);
|
||||
|
||||
if (!vehicleData) continue;
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<button class="action-btn btn--filled">
|
||||
<div class="button_content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@use '../../styles/responsive';
|
||||
|
||||
.button_content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -10,6 +10,7 @@ export namespace Journal {
|
||||
| 'search-train'
|
||||
| 'search-date-from'
|
||||
| 'search-dispatcher'
|
||||
| 'search-includesScenery'
|
||||
| 'search-issuedFrom'
|
||||
| 'search-terminatingAt'
|
||||
| 'search-via'
|
||||
|
||||
@@ -151,6 +151,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
@use '../../styles/responsive';
|
||||
@use '../../styles/scenery-history-table';
|
||||
@use '../../styles/badge';
|
||||
|
||||
.scenery-dispatchers-history {
|
||||
height: 100%;
|
||||
|
||||
@@ -57,20 +57,8 @@ export default defineComponent({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
@use '../../styles/responsive';
|
||||
@use '../../styles/badge';
|
||||
|
||||
h3.section-header {
|
||||
margin: 0.5em 0;
|
||||
padding: 0.3em;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.info-lists {
|
||||
display: flex;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="info-spawn-list">
|
||||
<h3 class="spawn-header section-header">
|
||||
<h3 class="spawn-header">
|
||||
<img src="/images/icon-spawn.svg" alt="Open spawns icon" />
|
||||
{{ $t('scenery.spawns') }}
|
||||
<span class="text--primary">{{ onlineScenery?.spawns.length || '0' }}</span>
|
||||
@@ -53,10 +53,23 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '../../../styles/badge';
|
||||
|
||||
ul {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
h3.spawn-header {
|
||||
margin: 0.5em 0;
|
||||
padding: 0.3em;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.spawns-anim {
|
||||
&-move,
|
||||
&-enter-active,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="info-user-list">
|
||||
<h3 class="user-header section-header">
|
||||
<h3 class="user-header">
|
||||
<img src="/images/icon-user.svg" alt="Users icon" />
|
||||
{{ $t('scenery.users') }}
|
||||
<span class="text--primary">{{ onlineScenery?.stationTrains?.length || 0 }}</span
|
||||
@@ -111,6 +111,8 @@ export default defineComponent({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '../../../styles/badge';
|
||||
|
||||
$no-timetable: #aaa;
|
||||
$departed: springgreen;
|
||||
$stopped: #ffa600;
|
||||
@@ -118,6 +120,17 @@ $online: gold;
|
||||
$terminated: salmon;
|
||||
$disconnected: slategray;
|
||||
|
||||
h3.user-header {
|
||||
margin: 0.5em 0;
|
||||
padding: 0.3em;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.info-user-list {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
id="scenery-search"
|
||||
list="sceneries"
|
||||
:placeholder="$t('filters.sceneries-placeholder')"
|
||||
@change="handleSceneriesInput"
|
||||
@focus="preventKeyDown = true"
|
||||
@blur="preventKeyDown = false"
|
||||
/>
|
||||
@@ -44,42 +45,40 @@
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="card_input-search authors">
|
||||
<datalist id="authors" name="authors">
|
||||
<option v-for="(author, i) in authorsOptions" :key="i" :value="author"></option>
|
||||
</datalist>
|
||||
|
||||
<section class="card_input-search">
|
||||
<input
|
||||
type="text"
|
||||
id="author"
|
||||
list="authors"
|
||||
name="authors"
|
||||
v-model="filters['authors']"
|
||||
:placeholder="$t('filters.authors-placeholder')"
|
||||
v-model="filters['lines']"
|
||||
id="line-numbers-search"
|
||||
:placeholder="$t('filters.line-numbers-placeholder')"
|
||||
@focus="preventKeyDown = true"
|
||||
@blur="preventKeyDown = false"
|
||||
/>
|
||||
|
||||
<button class="btn--action btn--image" @click="resetLineNumbersInput">
|
||||
<img src="/images/icon-exit.svg" alt="reset line numbers search" />
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="card_input-search">
|
||||
<select id="author" name="authors" v-model="filters['authors']">
|
||||
<option value="">{{ $t('filters.authors-placeholder') }}</option>
|
||||
<option v-for="(author, i) in authorsOptions" :key="i" :value="author">
|
||||
{{ author }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<button class="btn--action btn--image" @click="resetAuthorsInput">
|
||||
<img src="/images/icon-exit.svg" alt="reset authors search" />
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="card_input-search">
|
||||
<datalist id="projects" name="projects">
|
||||
<option v-for="(project, i) in projectsOptions" :key="i" :value="project"></option>
|
||||
</datalist>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
id="projects"
|
||||
list="projects"
|
||||
name="projects"
|
||||
v-model="filters['projects']"
|
||||
:placeholder="$t('filters.projects-placeholder')"
|
||||
@focus="preventKeyDown = true"
|
||||
@blur="preventKeyDown = false"
|
||||
/>
|
||||
<select id="projects" name="projects" v-model="filters['projects']">
|
||||
<option value="">{{ $t('filters.projects-placeholder') }}</option>
|
||||
<option v-for="(project, i) in projectsOptions" :key="i" :value="project">
|
||||
{{ project }}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<button class="btn--action btn--image" @click="resetProjectsInput">
|
||||
<img src="/images/icon-exit.svg" alt="reset projects search" />
|
||||
@@ -92,7 +91,7 @@
|
||||
v-for="(sectionFilters, sectionKey) in filtersSections"
|
||||
:key="sectionKey"
|
||||
>
|
||||
<h3 class="text--primary">
|
||||
<h3 class="section-header">
|
||||
<span class="active-indicator" v-if="!areSectionFiltersDefault(sectionKey)"></span>
|
||||
{{ $t(`filters.sections.${sectionKey}`) }}
|
||||
<button @click="resetSectionFilters(sectionKey)">RESET</button>
|
||||
@@ -122,7 +121,7 @@
|
||||
</section>
|
||||
|
||||
<section class="card_timestamp">
|
||||
<h3 class="section-header">{{ $t('filters.minimum-hours-title') }}</h3>
|
||||
<h3 class="hours-section-header">{{ $t('filters.minimum-hours-title') }}</h3>
|
||||
|
||||
<span class="clock">
|
||||
<button class="btn--action" @click="subHour">-</button>
|
||||
@@ -217,8 +216,6 @@ export default defineComponent({
|
||||
sliderStates,
|
||||
|
||||
minimumHours: 0,
|
||||
authorSearchFilter: '',
|
||||
projectSearchFilter: '',
|
||||
|
||||
currentRegion: { id: '', value: '' },
|
||||
|
||||
@@ -276,6 +273,8 @@ export default defineComponent({
|
||||
authorsOptions() {
|
||||
return this.store.stationList
|
||||
.reduce((acc, station) => {
|
||||
if (station.generalInfo?.hidden === true) return acc;
|
||||
|
||||
station.generalInfo?.authors?.forEach((author) => {
|
||||
if (author.trim() != '' && !acc.includes(author.toLocaleLowerCase()))
|
||||
acc.push(author.toLocaleLowerCase());
|
||||
@@ -289,8 +288,10 @@ export default defineComponent({
|
||||
projectsOptions() {
|
||||
return this.store.stationList
|
||||
.reduce((acc, station) => {
|
||||
if (!station.generalInfo || !station.generalInfo.project || station.generalInfo.hidden) return acc;
|
||||
if (!acc.includes(station.generalInfo.project.trim())) acc.push(station.generalInfo.project.trim());
|
||||
if (!station.generalInfo || !station.generalInfo.project || station.generalInfo.hidden)
|
||||
return acc;
|
||||
if (!acc.includes(station.generalInfo.project.trim()))
|
||||
acc.push(station.generalInfo.project.trim());
|
||||
|
||||
return acc;
|
||||
}, [] as string[])
|
||||
@@ -320,11 +321,15 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
resetAuthorsInput() {
|
||||
this.filters['authors'] = this.authorSearchFilter;
|
||||
this.filters['authors'] = '';
|
||||
},
|
||||
|
||||
resetProjectsInput() {
|
||||
this.filters['projects'] = this.projectSearchFilter;
|
||||
this.filters['projects'] = '';
|
||||
},
|
||||
|
||||
resetLineNumbersInput() {
|
||||
this.filters['lines'] = '';
|
||||
},
|
||||
|
||||
handleSceneriesInput() {
|
||||
@@ -369,7 +374,6 @@ export default defineComponent({
|
||||
|
||||
// Reset local model values
|
||||
this.minimumHours = 0;
|
||||
this.authorSearchFilter = '';
|
||||
|
||||
// Reset global filters
|
||||
Object.keys(this.filters).forEach((filterKey) => {
|
||||
@@ -413,6 +417,14 @@ export default defineComponent({
|
||||
@use '../../styles/animations';
|
||||
|
||||
h3.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 0.25em;
|
||||
gap: 0.5em;
|
||||
color: var(--clr-primary);
|
||||
}
|
||||
|
||||
h3.hours-section-header {
|
||||
text-align: center;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
@@ -494,15 +506,12 @@ h3.section-header {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
input {
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.5em;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
|
||||
&.authors {
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.section-filters {
|
||||
@@ -573,12 +582,6 @@ h3.section-header {
|
||||
}
|
||||
|
||||
.option-section h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 0.25em;
|
||||
|
||||
gap: 0.5em;
|
||||
|
||||
button {
|
||||
padding: 0.15em;
|
||||
color: coral;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class="header-text"
|
||||
:class="headerName"
|
||||
>
|
||||
<span class="header_wrapper">
|
||||
<div class="header_wrapper">
|
||||
<div v-html="$t(`sceneries.headers.${headerName}`)"></div>
|
||||
|
||||
<img
|
||||
@@ -23,7 +23,7 @@
|
||||
:src="`/images/icon-arrow-${activeSorter.dir == 1 ? 'asc' : 'desc'}.svg`"
|
||||
alt="sort icon"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th
|
||||
@@ -52,14 +52,14 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<router-link
|
||||
<tr
|
||||
v-for="station in filteredStationList"
|
||||
class="a-row"
|
||||
role="row"
|
||||
tabindex="0"
|
||||
:key="station.name"
|
||||
@click.right.prevent="openForumSite($event, station.generalInfo?.url)"
|
||||
@keydown.space.prevent="openForumSite($event, station.generalInfo?.url)"
|
||||
:to="getSceneryRoute(station)"
|
||||
@click="getSceneryRoute(station)"
|
||||
@keydown.enter="getSceneryRoute(station)"
|
||||
>
|
||||
<td class="station-name" :class="station.generalInfo?.availability">
|
||||
<b v-if="station.generalInfo?.project" style="color: salmon">{{
|
||||
@@ -314,7 +314,7 @@
|
||||
>
|
||||
{{ station.onlineInfo?.scheduledTrainCount.confirmed ?? '-' }}
|
||||
</td>
|
||||
</router-link>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -384,15 +384,13 @@ export default defineComponent({
|
||||
|
||||
methods: {
|
||||
getSceneryRoute(station: Station) {
|
||||
// TODO: Hide tooltips when navigating away
|
||||
|
||||
return {
|
||||
this.$router.push({
|
||||
name: 'SceneryView',
|
||||
query: {
|
||||
station: station.name,
|
||||
region: this.$route.query.region || undefined
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
openDonationCard(e: Event) {
|
||||
@@ -459,78 +457,78 @@ table {
|
||||
width: 100%;
|
||||
min-width: 1250px;
|
||||
white-space: wrap;
|
||||
}
|
||||
|
||||
thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
thead tr {
|
||||
background-color: var(--clr-bg3);
|
||||
}
|
||||
|
||||
thead th {
|
||||
background-color: var(--clr-bg3);
|
||||
white-space: pre-wrap;
|
||||
padding: 0.5em 0.25em;
|
||||
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
&.station {
|
||||
width: 12em;
|
||||
}
|
||||
|
||||
thead tr {
|
||||
background-color: var(--clr-bg3);
|
||||
&.min-lvl {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
thead th {
|
||||
&.station {
|
||||
width: 12em;
|
||||
}
|
||||
&.status {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
&.min-lvl {
|
||||
width: 4em;
|
||||
}
|
||||
&.dispatcher {
|
||||
width: 12em;
|
||||
}
|
||||
|
||||
&.status {
|
||||
width: 10em;
|
||||
}
|
||||
&.dispatcher-lvl {
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
&.dispatcher {
|
||||
width: 12em;
|
||||
}
|
||||
&.routes-double,
|
||||
&.routes-single {
|
||||
width: 7em;
|
||||
}
|
||||
|
||||
&.dispatcher-lvl {
|
||||
width: 6em;
|
||||
}
|
||||
&.general {
|
||||
width: 11em;
|
||||
}
|
||||
|
||||
&.routes-double,
|
||||
&.routes-single {
|
||||
width: 7em;
|
||||
}
|
||||
&.header-image {
|
||||
width: 3.5em;
|
||||
|
||||
&.general {
|
||||
width: 11em;
|
||||
}
|
||||
|
||||
&.header-image {
|
||||
width: 3.5em;
|
||||
|
||||
&.user {
|
||||
width: 5em;
|
||||
}
|
||||
}
|
||||
|
||||
padding: 0.5em 0.25em;
|
||||
background-color: var(--clr-bg3);
|
||||
white-space: pre-wrap;
|
||||
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 1.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
&.user {
|
||||
width: 5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tr,
|
||||
.a-row {
|
||||
thead th .header_wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 1.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
background-color: $rowCol;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -550,6 +548,7 @@ tr,
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
height: 2.5em;
|
||||
|
||||
&.inactive {
|
||||
opacity: 0.2;
|
||||
|
||||
@@ -145,13 +145,33 @@ function filterSliderValues(filters: Record<string, any>, generalInfo: StationGe
|
||||
}
|
||||
|
||||
function filterInputValues(filters: Record<string, any>, generalInfo: StationGeneralInfo) {
|
||||
return (
|
||||
(filters['authors'].length > 3 &&
|
||||
!generalInfo.authors
|
||||
?.map((a) => a.toLocaleLowerCase())
|
||||
.includes(filters['authors'].toLocaleLowerCase())) ||
|
||||
(filters['projects'].length > 0 && generalInfo.project != filters['projects'])
|
||||
);
|
||||
if (
|
||||
filters['authors'].length > 3 &&
|
||||
generalInfo.authors &&
|
||||
!generalInfo.authors.some(
|
||||
(a) => a.toLocaleLowerCase() == filters['authors'].toLocaleLowerCase()
|
||||
)
|
||||
)
|
||||
return true;
|
||||
|
||||
if (filters['projects'].length > 0 && generalInfo.project != filters['projects']) return true;
|
||||
|
||||
if (filters['lines'].length > 0) {
|
||||
const linesNumbers = (filters['lines'] as string)
|
||||
.split(',')
|
||||
.map((l) => Number(l))
|
||||
.filter((l) => !isNaN(l) && l != 0);
|
||||
|
||||
if (
|
||||
!generalInfo.lines
|
||||
?.split(',')
|
||||
.map((l) => Number(l))
|
||||
.some((l) => linesNumbers.includes(l))
|
||||
)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export const sortStations = (a: Station, b: Station, sorter: ActiveSorter) => {
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
<span v-if="vehicleCargo">({{ vehicleCargo.id }})</span>
|
||||
</div>
|
||||
|
||||
<div class="vehicle-props" v-if="vehicleData">
|
||||
{{ vehicleData.group.speed }}km/h • {{ vehicleData.group.length }}m •
|
||||
{{ (vehicleData.group.weight / 1000).toFixed(1) }}t
|
||||
<div class="vehicle-props" v-if="vehicleGroup">
|
||||
{{ vehicleGroup.speed }}km/h • {{ vehicleGroup.length }}m •
|
||||
{{ (vehicleGroup.weight / 1000).toFixed(1) }}t
|
||||
<span v-if="vehicleCargo">(+{{ (vehicleCargo.weight / 1000).toFixed(1) }}t)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,12 +73,18 @@ export default defineComponent({
|
||||
return this.tooltipStore.content.split(':')[0];
|
||||
},
|
||||
|
||||
vehicleData() {
|
||||
return this.apiStore.vehiclesData?.find((v) => v.name == this.vehicleName);
|
||||
vehicleGroup() {
|
||||
if (!this.apiStore.vehiclesData) return null;
|
||||
|
||||
const vehicle = this.apiStore.vehiclesData.vehicles.find((v) => v.name == this.vehicleName);
|
||||
|
||||
if (!vehicle) return null;
|
||||
|
||||
return this.apiStore.vehiclesData.vehicleGroups.find((g) => g.id == vehicle?.vehicleGroupsId);
|
||||
},
|
||||
|
||||
vehicleCargo() {
|
||||
const x = this.vehicleData?.group.cargoTypes?.find(
|
||||
const x = this.vehicleGroup?.cargoTypes?.find(
|
||||
(c) => c.id == this.tooltipStore.content.split(':')[1]
|
||||
);
|
||||
|
||||
|
||||
+6
-3
@@ -69,7 +69,8 @@
|
||||
"confirm": "ROGER THAT!",
|
||||
"no-data": "No data about the latest app update has been found",
|
||||
"info-1": "This changelog will be available to see once again after clicking the version number in the footer",
|
||||
"info-2": "The full app changelog available on <a href='https://github.com/Spythere/stacjownik' target='_blank'>the project's GitHub</a>"
|
||||
"info-2": "The full app changelog available on {link}",
|
||||
"info-2-link-text": "the project's GitHub page"
|
||||
},
|
||||
"app": {
|
||||
"sceneries": "SCENERIES",
|
||||
@@ -199,6 +200,7 @@
|
||||
"search-dispatcher": "Dispatcher name",
|
||||
"search-station": "Scenery name / #",
|
||||
"search-author": "Timetable author name",
|
||||
"search-includesScenery": "Includes scenery name",
|
||||
"search-issuedFrom": "Issuing scenery name",
|
||||
"search-via": "Via scenery name",
|
||||
"search-terminatingAt": "Terminating scenery name",
|
||||
@@ -316,8 +318,9 @@
|
||||
"minTwoWayInt": "MIN. INTERNAL OTHER DOUBLE TRACK ROUTES"
|
||||
},
|
||||
"sceneries-placeholder": "Search for scenery",
|
||||
"authors-placeholder": "Scenery author (other filters apply)",
|
||||
"projects-placeholder": "Scenery project (other filters apply)",
|
||||
"line-numbers-placeholder": "Line numbers (separated by commas)",
|
||||
"authors-placeholder": "Scenery author",
|
||||
"projects-placeholder": "Scenery project",
|
||||
"search-button-title": "SEARCH",
|
||||
"minimum-hours-title": "SHOW ONLY SCENERIES UNTIL:",
|
||||
"now": "NOW",
|
||||
|
||||
+6
-3
@@ -68,7 +68,8 @@
|
||||
"confirm": "PRZYJĄŁEM!",
|
||||
"no-data": "Nie znaleziono informacji o ostatnich zmianach w aplikacji",
|
||||
"info-1": "Ten changelog będzie zawsze dostępny po kliknięciu numeru wersji w stopce strony",
|
||||
"info-2": "Pełny changelog dostępny na <a href='https://github.com/Spythere/stacjownik' target='_blank'>GitHubie projektu</a>"
|
||||
"info-2": "Pełny changelog dostępny na {link}",
|
||||
"info-2-link-text": "GitHubie projektu"
|
||||
},
|
||||
"app": {
|
||||
"sceneries": "SCENERIE",
|
||||
@@ -195,6 +196,7 @@
|
||||
"search-dispatcher": "Nick dyżurnego",
|
||||
"search-station": "Nazwa scenerii / #",
|
||||
"search-author": "Nick autora rozkładu jazdy",
|
||||
"search-includesScenery": "Zawiera scenerię",
|
||||
"search-issuedFrom": "Sceneria początkowa",
|
||||
"search-via": "Przez scenerię",
|
||||
"search-terminatingAt": "Sceneria końcowa",
|
||||
@@ -313,8 +315,9 @@
|
||||
"minTwoWayInt": "SZLAKI DWUTOROWE NIEZELEKTR. WEWNĘTRZNE (MINIMUM)"
|
||||
},
|
||||
"sceneries-placeholder": "Wyszukaj scenerię",
|
||||
"authors-placeholder": "Autor scenerii (uwzględnia inne filtry)",
|
||||
"projects-placeholder": "Projekt scenerii (uwzględnia inne filtry)",
|
||||
"line-numbers-placeholder": "Numery linii (oddzielone przecinkami)",
|
||||
"authors-placeholder": "Autor scenerii",
|
||||
"projects-placeholder": "Projekt scenerii",
|
||||
"search-button-title": "SZUKAJ",
|
||||
"minimum-hours-title": "POKAŻ TYLKO SCENERIE DOSTĘPNE MINIMUM DO:",
|
||||
"now": "TERAZ",
|
||||
|
||||
@@ -69,7 +69,8 @@ export const initFilters = {
|
||||
minTwoWayInt: 0,
|
||||
minTwoWayCatenaryInt: 0,
|
||||
authors: '',
|
||||
projects: ''
|
||||
projects: '',
|
||||
lines: ''
|
||||
};
|
||||
|
||||
export const sliderStates = [
|
||||
|
||||
@@ -122,19 +122,27 @@ export default defineComponent({
|
||||
|
||||
// Check the whole consist speed limit
|
||||
const vehicleMaxSpeed = stockList.reduce((acc, stockName, i) => {
|
||||
if (!this.apiStore.vehiclesData) return acc;
|
||||
|
||||
const [vehicleName, vehicleCargo] = stockName.split(':');
|
||||
|
||||
const vehicleData = this.apiStore.vehiclesData?.find((v) => v.name == vehicleName);
|
||||
const vehicle = this.apiStore.vehiclesData.vehicles.find((v) => v.name == vehicleName);
|
||||
|
||||
if (!vehicleData) return acc;
|
||||
if (!vehicle) return acc;
|
||||
|
||||
let vehicleSpeed = vehicleData.group.speed;
|
||||
const vehicleGroup = this.apiStore.vehiclesData.vehicleGroups.find(
|
||||
(g) => g.id == vehicle.vehicleGroupsId
|
||||
);
|
||||
|
||||
if (vehicleData.type == 'wagon-freight') {
|
||||
if (!vehicleGroup) return acc;
|
||||
|
||||
let vehicleSpeed = vehicleGroup.speed;
|
||||
|
||||
if (vehicle.type == 'wagon-freight') {
|
||||
isPassenger = false;
|
||||
|
||||
if (vehicleCargo !== undefined && vehicleData.group.speedLoaded) {
|
||||
vehicleSpeed = vehicleData.group.speedLoaded;
|
||||
if (vehicleCargo !== undefined && vehicleGroup.speedLoaded) {
|
||||
vehicleSpeed = vehicleGroup.speedLoaded;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,14 +151,23 @@ export default defineComponent({
|
||||
|
||||
// Check the head vehicle speed limit
|
||||
const headLocoName = stockList[0];
|
||||
const headLocoVehicleData = this.apiStore.vehiclesData?.find((v) => v.name == headLocoName);
|
||||
|
||||
const headLocoVehicle = this.apiStore.vehiclesData!.vehicles.find(
|
||||
(v) => v.name == headLocoName
|
||||
);
|
||||
|
||||
const headLocoVehicleGroup = this.apiStore.vehiclesData!.vehicleGroups.find(
|
||||
(g) => g.id == headLocoVehicle?.vehicleGroupsId
|
||||
);
|
||||
|
||||
if (!headLocoVehicleGroup) return vehicleMaxSpeed;
|
||||
|
||||
// Omit speed check for head vehicle if there's no data for it
|
||||
if (!headLocoName || !headLocoVehicleData || !headLocoVehicleData.group.massSpeeds)
|
||||
if (!headLocoName || !headLocoVehicle || !headLocoVehicleGroup.massSpeeds)
|
||||
return vehicleMaxSpeed;
|
||||
|
||||
const massSpeeds =
|
||||
headLocoVehicleData.group.massSpeeds[
|
||||
headLocoVehicleGroup.massSpeeds[
|
||||
stockList.length == 1 ? 'none' : isPassenger ? 'passenger' : 'cargo'
|
||||
];
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export const useApiStore = defineStore('apiStore', {
|
||||
},
|
||||
|
||||
activeData: undefined as API.ActiveData.Response | undefined,
|
||||
vehiclesData: undefined as API.Vehicles.Response | undefined,
|
||||
vehiclesData: undefined as API.VehiclesData.Response | undefined,
|
||||
|
||||
donatorsData: [] as API.Donators.Response,
|
||||
sceneryData: [] as StationJSONData[],
|
||||
@@ -111,7 +111,7 @@ export const useApiStore = defineStore('apiStore', {
|
||||
|
||||
async fetchVehiclesInfo() {
|
||||
try {
|
||||
const response = await this.client!.get<API.Vehicles.Response>('api/getVehicles');
|
||||
const response = await this.client!.get<API.VehiclesData.Response>('api/getVehiclesData');
|
||||
|
||||
this.vehiclesData = response.data;
|
||||
this.dataStatuses.vehicles = response.data ? Status.Data.Loaded : Status.Data.Warning;
|
||||
|
||||
@@ -38,7 +38,8 @@ export const useMainStore = defineStore('mainStore', {
|
||||
modalLastClickedTarget: null,
|
||||
currentLocale: 'pl',
|
||||
|
||||
isMigrateInfoCardOpen: false
|
||||
isMigrateInfoCardOpen: false,
|
||||
pinnedStationNames: []
|
||||
}) as MainStoreState,
|
||||
|
||||
actions: {
|
||||
@@ -431,7 +432,6 @@ export const useMainStore = defineStore('mainStore', {
|
||||
|
||||
return {
|
||||
name: scenery.name,
|
||||
|
||||
generalInfo: {
|
||||
...scenery,
|
||||
authors: scenery.authors?.split(',').map((a) => a.trim()),
|
||||
@@ -446,7 +446,7 @@ export const useMainStore = defineStore('mainStore', {
|
||||
},
|
||||
|
||||
allStationInfo(): Station[] {
|
||||
const onlineUnsavedStations = this.activeSceneryList
|
||||
const onlineUnsavedStations: Station[] = this.activeSceneryList
|
||||
.filter(
|
||||
(scenery) =>
|
||||
this.stationList.findIndex((st) => st.name == scenery.name) == -1 &&
|
||||
|
||||
+21
-1
@@ -89,7 +89,8 @@ select {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
input {
|
||||
input,
|
||||
select {
|
||||
background: none;
|
||||
color: white;
|
||||
font-size: 1em;
|
||||
@@ -358,3 +359,22 @@ a.a-button {
|
||||
background-color: #aaa;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.g-checkbox {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,3 @@
|
||||
transform: translateY(-50%);
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
select.search-input {
|
||||
|
||||
}
|
||||
|
||||
+46
-3
@@ -1,4 +1,4 @@
|
||||
import { Status, VehicleData } from './common';
|
||||
import { Status, Vehicle, VehicleGroup } from './common';
|
||||
|
||||
export enum APIDataStatus {
|
||||
OK = 'OK',
|
||||
@@ -329,8 +329,51 @@ export namespace API {
|
||||
export type Response = string[];
|
||||
}
|
||||
|
||||
export namespace Vehicles {
|
||||
export type Response = VehicleData[];
|
||||
export namespace VehiclesData {
|
||||
export interface VehicleObject {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
cabinName: string | null;
|
||||
restrictions: Record<string, any> | null;
|
||||
vehicleGroupsId: number;
|
||||
}
|
||||
|
||||
export interface VehicleGroupObject {
|
||||
id: number;
|
||||
name: string;
|
||||
speed: number;
|
||||
speedLoaded?: number;
|
||||
speedLoco?: number;
|
||||
length: number;
|
||||
weight: number;
|
||||
cargoTypes: VehicleCargo[] | null;
|
||||
|
||||
locoProps: {
|
||||
coldStart: boolean;
|
||||
doubleManned: boolean;
|
||||
} | null;
|
||||
|
||||
massSpeeds: VehicleGroupMassSpeeds | null;
|
||||
}
|
||||
|
||||
export interface VehicleGroupMassSpeeds {
|
||||
passenger: Record<string, number> | null;
|
||||
cargo: Record<string, number> | null;
|
||||
none: number | null;
|
||||
}
|
||||
|
||||
export interface VehicleCargo {
|
||||
id: string;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
vehicles: VehicleObject[];
|
||||
vehicleGroups: VehicleGroupObject[];
|
||||
}
|
||||
|
||||
export type Response = Data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-42
@@ -1,5 +1,6 @@
|
||||
import { RouteLocationRaw } from 'vue-router';
|
||||
import { StationJSONData } from '../store/typings';
|
||||
import { API } from './api';
|
||||
|
||||
export type Availability = 'default' | 'unavailable' | 'nonPublic' | 'abandoned' | 'nonDefault';
|
||||
export type ScenerySpawnType = 'passenger' | 'freight' | 'loco' | 'all';
|
||||
@@ -95,9 +96,7 @@ export interface TrainTimetableData {
|
||||
|
||||
export interface Station {
|
||||
name: string;
|
||||
|
||||
generalInfo?: StationGeneralInfo;
|
||||
|
||||
onlineInfo?: ActiveScenery;
|
||||
}
|
||||
|
||||
@@ -107,7 +106,7 @@ export interface StationGeneralInfo {
|
||||
abbr: string;
|
||||
hash?: string;
|
||||
reqLevel: number;
|
||||
lines: string;
|
||||
lines?: string;
|
||||
project: string;
|
||||
projectUrl?: string;
|
||||
signalType: string;
|
||||
@@ -216,45 +215,8 @@ export interface CheckpointTrain {
|
||||
}
|
||||
|
||||
// Vehicles Data
|
||||
|
||||
export interface VehicleData {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
cabinName: string | null;
|
||||
restrictions: Record<string, any> | null;
|
||||
vehicleGroupsId: number;
|
||||
group: VehiclesGroup;
|
||||
}
|
||||
|
||||
export interface VehiclesGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
speed: number;
|
||||
speedLoaded?: number;
|
||||
speedLoco?: number;
|
||||
length: number;
|
||||
weight: number;
|
||||
cargoTypes: VehicleCargo[] | null;
|
||||
|
||||
locoProps: {
|
||||
coldStart: boolean;
|
||||
doubleManned: boolean;
|
||||
} | null;
|
||||
|
||||
massSpeeds: VehicleGroupMassSpeeds | null;
|
||||
}
|
||||
|
||||
export interface VehicleGroupMassSpeeds {
|
||||
passenger: Record<string, number> | null;
|
||||
cargo: Record<string, number> | null;
|
||||
none: number | null;
|
||||
}
|
||||
|
||||
export interface VehicleCargo {
|
||||
id: string;
|
||||
weight: number;
|
||||
}
|
||||
export type Vehicle = API.VehiclesData.VehicleObject;
|
||||
export type VehicleGroup = API.VehiclesData.VehicleGroupObject;
|
||||
|
||||
export interface TooltipUserTrain {
|
||||
driverName: string;
|
||||
|
||||
@@ -280,9 +280,25 @@ export default defineComponent({
|
||||
const dateFromString = this.searchersValues['search-date-from'].trim() || undefined;
|
||||
const dateToString = this.searchersValues['search-date-to'].trim() || undefined;
|
||||
|
||||
let dateFromISO: string | undefined = undefined;
|
||||
let dateToISO: string | undefined = undefined;
|
||||
|
||||
if (dateFromString) {
|
||||
let dateFrom = new Date(dateFromString);
|
||||
dateFrom.setMinutes(dateFrom.getMinutes() + dateFrom.getTimezoneOffset());
|
||||
dateFromISO = dateFrom.toISOString();
|
||||
}
|
||||
|
||||
if (dateToString) {
|
||||
let dateTo = new Date(dateToString);
|
||||
dateTo.setMinutes(dateTo.getMinutes() + dateTo.getTimezoneOffset());
|
||||
dateToISO = dateTo.toISOString();
|
||||
}
|
||||
|
||||
queryParams['dispatcherName'] = dispatcherName;
|
||||
queryParams['dateFrom'] = dateFromString;
|
||||
queryParams['dateTo'] = dateToString ? `${dateToString}T23:00:00` : undefined;
|
||||
|
||||
queryParams['dateFrom'] = dateFromISO;
|
||||
queryParams['dateTo'] = dateToISO;
|
||||
|
||||
queryParams['countLimit'] = 30;
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ interface TimetablesQueryParams {
|
||||
issuedFrom?: string;
|
||||
terminatingAt?: string;
|
||||
via?: string;
|
||||
includesScenery?: string;
|
||||
|
||||
countFrom?: number;
|
||||
countLimit?: number;
|
||||
@@ -213,6 +214,7 @@ export default defineComponent({
|
||||
'search-train': '',
|
||||
'search-driver': '',
|
||||
'search-dispatcher': '',
|
||||
'search-includesScenery': '',
|
||||
'search-issuedFrom': '',
|
||||
'search-via': '',
|
||||
'search-terminatingAt': '',
|
||||
@@ -355,19 +357,25 @@ export default defineComponent({
|
||||
const driverName = this.searchersValues['search-driver'].trim() || undefined;
|
||||
const trainNo = this.searchersValues['search-train'].trim() || undefined;
|
||||
const authorName = this.searchersValues['search-dispatcher'].trim() || undefined;
|
||||
const dateFrom = this.searchersValues['search-date-from'].trim() || undefined;
|
||||
const dateFromString = this.searchersValues['search-date-from'].trim() || undefined;
|
||||
const includesScenery = this.searchersValues['search-includesScenery'].trim() || undefined;
|
||||
const issuedFrom = this.searchersValues['search-issuedFrom'].trim() || undefined;
|
||||
const via = this.searchersValues['search-via'].trim() || undefined;
|
||||
const terminatingAt = this.searchersValues['search-terminatingAt'].trim() || undefined;
|
||||
const categoryCode = this.searchersValues['select-categoryCode'].trim() || undefined;
|
||||
|
||||
let dateTo: string | undefined = undefined;
|
||||
let dateFromISO: string | undefined = undefined;
|
||||
let dateToISO: string | undefined = undefined;
|
||||
|
||||
if (dateFrom) {
|
||||
const d = new Date(dateFrom);
|
||||
d.setDate(d.getDate() + 1);
|
||||
if (dateFromString) {
|
||||
let dateFrom = new Date(dateFromString);
|
||||
dateFrom.setMinutes(dateFrom.getMinutes() + dateFrom.getTimezoneOffset());
|
||||
|
||||
dateTo = d.toISOString().split('T')[0];
|
||||
let dateTo = new Date(dateFrom);
|
||||
dateTo.setDate(dateTo.getDate() + 1);
|
||||
|
||||
dateFromISO = dateFrom.toISOString();
|
||||
dateToISO = dateTo.toISOString();
|
||||
}
|
||||
|
||||
const queryParams: TimetablesQueryParams = {};
|
||||
@@ -430,8 +438,9 @@ export default defineComponent({
|
||||
queryParams['countLimit'] = undefined;
|
||||
|
||||
queryParams['authorName'] = authorName;
|
||||
queryParams['dateFrom'] = dateFrom;
|
||||
queryParams['dateTo'] = dateTo;
|
||||
queryParams['dateFrom'] = dateFromISO;
|
||||
queryParams['dateTo'] = dateToISO;
|
||||
queryParams['includesScenery'] = includesScenery;
|
||||
queryParams['issuedFrom'] = issuedFrom;
|
||||
queryParams['terminatingAt'] = terminatingAt;
|
||||
queryParams['via'] = via;
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { VitePWA } from 'vite-plugin-pwa';
|
||||
import path from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
server: { port: 5123, open: true },
|
||||
server: { port: 5123, open: false },
|
||||
preview: { port: 4001, open: false },
|
||||
publicDir: 'public',
|
||||
css: {
|
||||
@@ -28,7 +28,7 @@ export default defineConfig({
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern:
|
||||
/^https:\/\/stacjownik.spythere.eu\/api\/(getVehicles|getDonators|getSceneries)/i,
|
||||
/^https:\/\/stacjownik.spythere.eu\/api\/(getVehiclesData|getDonators|getSceneries)/i,
|
||||
handler: 'NetworkFirst',
|
||||
options: {
|
||||
cacheName: 'stacjownik-api-cache',
|
||||
|
||||
Reference in New Issue
Block a user