Compare commits

...

11 Commits

25 changed files with 8046 additions and 31 deletions
+5
View File
@@ -22,6 +22,11 @@
<link rel="icon" href="favicon.ico" /> <link rel="icon" href="favicon.ico" />
<link rel="stylesheet" href="fa/css/fontawesome.css" />
<link rel="stylesheet" href="fa/css/brands.css" />
<link rel="stylesheet" href="fa/css/regular.css" />
<link rel="stylesheet" href="fa/css/solid.css" />
<!-- Static OpenGraph meta --> <!-- Static OpenGraph meta -->
<meta name="description" content="Pomocnik maszynisty i dyżurnego symulatora Train Driver 2" /> <meta name="description" content="Pomocnik maszynisty i dyżurnego symulatora Train Driver 2" />
<meta property="og:url" content="https://stacjownik-td2.web.app/" /> <meta property="og:url" content="https://stacjownik-td2.web.app/" />
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "stacjownik", "name": "stacjownik",
"version": "1.28.5", "version": "1.28.7",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
File diff suppressed because it is too large Load Diff
+6243
View File
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
/*!
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2024 Fonticons, Inc.
*/
:root, :host {
--fa-style-family-classic: 'Font Awesome 6 Free';
--fa-font-regular: normal 400 1em/1 'Font Awesome 6 Free'; }
@font-face {
font-family: 'Font Awesome 6 Free';
font-style: normal;
font-weight: 400;
font-display: block;
src: url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.ttf") format("truetype"); }
.far,
.fa-regular {
font-weight: 400; }
+19
View File
@@ -0,0 +1,19 @@
/*!
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2024 Fonticons, Inc.
*/
:root, :host {
--fa-style-family-classic: 'Font Awesome 6 Free';
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free'; }
@font-face {
font-family: 'Font Awesome 6 Free';
font-style: normal;
font-weight: 900;
font-display: block;
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype"); }
.fas,
.fa-solid {
font-weight: 900; }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -59,7 +59,7 @@
</span> </span>
</div> </div>
<div class="stock-dangers" v-if="timetable.twr || timetable.skr"> <div class="stock-dangers" v-if="timetable.warningNotes">
<div class="g-separator"></div> <div class="g-separator"></div>
<b>{{ $t('journal.stock-dangers') }}:</b> <b>{{ $t('journal.stock-dangers') }}:</b>
@@ -95,7 +95,11 @@
<div class="g-separator"></div> <div class="g-separator"></div>
<b>{{ $t('journal.stock-preview') }}:</b> <b>{{ $t('journal.stock-preview') }}:</b>
<div class="stock-history" v-if="stockHistory.length > 1"> <div class="stock-history">
<button class="btn btn--action" @click="copyStockToClipboard()">
<i class="fa-regular fa-copy"></i> {{ $t('journal.stock-copy') }}
</button>
<button <button
v-for="(sh, i) in stockHistory" v-for="(sh, i) in stockHistory"
:key="i" :key="i"
@@ -128,6 +132,7 @@ import StockList from '../../Global/StockList.vue';
import { API } from '../../../typings/api'; import { API } from '../../../typings/api';
import { RouteLocationRaw } from 'vue-router'; import { RouteLocationRaw } from 'vue-router';
import EntryStops from './EntryStops.vue'; import EntryStops from './EntryStops.vue';
import { useI18n } from 'vue-i18n';
export default defineComponent({ export default defineComponent({
components: { StockList, EntryStops }, components: { StockList, EntryStops },
@@ -146,7 +151,8 @@ export default defineComponent({
}, },
data() { data() {
return { return {
currentHistoryIndex: 0 currentHistoryIndex: 0,
i18n: useI18n()
}; };
}, },
computed: { computed: {
@@ -167,6 +173,7 @@ export default defineComponent({
}; };
}); });
}, },
driverRouteLocation(): RouteLocationRaw | null { driverRouteLocation(): RouteLocationRaw | null {
if (this.timetable.terminated) return null; if (this.timetable.terminated) return null;
return { return {
@@ -185,6 +192,25 @@ export default defineComponent({
toggleExtraInfo() { toggleExtraInfo() {
this.$emit('toggleExtraInfo', this.timetable.id); this.$emit('toggleExtraInfo', this.timetable.id);
},
copyStockToClipboard() {
const currentStockString =
this.stockHistory[this.currentHistoryIndex]?.stockString ?? this.timetable.stockString;
if (!currentStockString) {
alert(this.i18n.t('journal.stock-clipboard-failure'));
return;
}
navigator.clipboard
.writeText(currentStockString)
.then(() => {
prompt(this.i18n.t('journal.stock-clipboard-success'), currentStockString);
})
.catch(() => {
alert(this.i18n.t('journal.stock-clipboard-failure'));
});
} }
} }
}); });
@@ -21,7 +21,7 @@
> >
</span> </span>
<span class="text--grayed" v-if="timetable.currentSceneryName"> <span class="entry-location" v-if="timetable.currentSceneryName">
<b> <b>
{{ $t(`journal.${timetable.terminated ? 'last-seen-at' : 'currently-at'}`) }} {{ $t(`journal.${timetable.terminated ? 'last-seen-at' : 'currently-at'}`) }}
{{ timetable.currentSceneryName.replace(/.[a-zA-Z0-9]+.sc/, '') }} {{ timetable.currentSceneryName.replace(/.[a-zA-Z0-9]+.sc/, '') }}
@@ -71,4 +71,9 @@ export default defineComponent({
justify-content: center; justify-content: center;
} }
} }
.entry-location {
text-align: center;
color: #ccc;
}
</style> </style>
@@ -221,6 +221,10 @@ export default defineComponent({
.stop-name { .stop-name {
font-weight: bold; font-weight: bold;
color: #ccc; color: #ccc;
i {
display: none;
}
} }
.stop-date { .stop-date {
@@ -19,8 +19,25 @@
:data-status="status" :data-status="status"
> >
<router-link :to="train.driverRouteLocation" class="a-block"> <router-link :to="train.driverRouteLocation" class="a-block">
<span class="user_train">{{ train.trainNo }}</span> <span class="user_train"> {{ train.trainNo }}</span>
<span class="user_name">{{ train.driverName }}</span> <span class="user_name">
{{ train.driverName }}
<i
v-if="train.timetableData != undefined && train.lastSeen <= Date.now() - 120000"
class="fa-solid fa-user-slash"
style="color: lightcoral"
data-tooltip-type="BaseTooltip"
:data-tooltip-content="$t('app.tooltip-driver-offline')"
></i>
<i
v-if="train.currentStationName.indexOf('.sc') != -1"
class="fa-solid fa-ban"
style="color: lightcoral"
data-tooltip-type="BaseTooltip"
:data-tooltip-content="$t('app.tooltip-scenery-offline')"
></i>
</span>
</router-link> </router-link>
</li> </li>
</transition-group> </transition-group>
@@ -66,8 +83,13 @@ export default defineComponent({
this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW) this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW)
); );
const sceneryName =
train.currentStationName.indexOf('.sc') != -1
? train.currentStationName.split(' ').slice(0, -1).join(' ')
: train.currentStationName;
const status = stop const status = stop
? getTrainStopStatus(stop, train.currentStationName, this.onlineScenery!.name) ? getTrainStopStatus(stop, sceneryName, this.onlineScenery!.name)
: 'no-timetable'; : 'no-timetable';
return { return {
+15 -2
View File
@@ -4,10 +4,19 @@
:data-minor="stop.isSBL || (stop.nameRaw.endsWith(', po') && !stop.duration)" :data-minor="stop.isSBL || (stop.nameRaw.endsWith(', po') && !stop.duration)"
> >
<router-link v-if="/(, podg$|<strong>)/.test(stop.nameHtml)" :to="sceneryHref"> <router-link v-if="/(, podg$|<strong>)/.test(stop.nameHtml)" :to="sceneryHref">
<span class="stop-name" v-html="stop.nameHtml"></span> <b class="stop-name"
><i
v-if="!stop.isSceneryOnline"
class="fa-solid fa-ban"
data-tooltip-type="BaseTooltip"
:data-tooltip-content="$t('app.tooltip-scenery-offline')"
style="margin-right: 0.25rem; color: salmon"
></i>
{{ stop.nameRaw }}
</b>
</router-link> </router-link>
<span v-else class="stop-name" v-html="stop.nameHtml"></span> <span v-else class="stop-name">{{ stop.nameRaw }}</span>
<span <span
v-if="stop.position != 'begin'" v-if="stop.position != 'begin'"
@@ -139,6 +148,10 @@ s {
color: #aaa; color: #aaa;
padding: 0; padding: 0;
} }
i {
display: none;
}
} }
.stop { .stop {
+2 -2
View File
@@ -106,12 +106,12 @@
<div class="status-badges"> <div class="status-badges">
<div v-if="!train.currentStationHash" class="train-badge offline"> <div v-if="!train.currentStationHash" class="train-badge offline">
<img src="/images/icon-offline.svg" alt="offline train icon" /> <i class="fa-solid fa-ban"></i>
{{ $t('trains.scenery-offline') }} {{ $t('trains.scenery-offline') }}
</div> </div>
<div v-if="!train.online" class="train-badge offline"> <div v-if="!train.online" class="train-badge offline">
<img src="/images/icon-offline.svg" alt="offline train icon" /> <i class="fa-solid fa-user-slash"></i>
Offline {{ lastSeenMessage(train.lastSeen) }} Offline {{ lastSeenMessage(train.lastSeen) }}
</div> </div>
</div> </div>
+8 -2
View File
@@ -134,7 +134,7 @@ import StopLabel from './StopLabel.vue';
import StockList from '../Global/StockList.vue'; import StockList from '../Global/StockList.vue';
import { useMainStore } from '../../store/mainStore'; import { useMainStore } from '../../store/mainStore';
import { useApiStore } from '../../store/apiStore'; import { useApiStore } from '../../store/apiStore';
import { StationRoutesInfo, Train } from '../../typings/common'; import { Train } from '../../typings/common';
import { TrainScheduleStop } from './typings'; import { TrainScheduleStop } from './typings';
export default defineComponent({ export default defineComponent({
@@ -173,6 +173,10 @@ export default defineComponent({
const sceneryName = timetablePath[currentPathIndex].stationName; const sceneryName = timetablePath[currentPathIndex].stationName;
const sceneryInfo = this.apiStore.sceneryData.find((st) => st.name == sceneryName); const sceneryInfo = this.apiStore.sceneryData.find((st) => st.name == sceneryName);
const isSceneryOnline =
(this.apiStore.activeData?.activeSceneries?.find((sc) => sc.stationName == sceneryName)
?.isOnline ?? 0) == 1;
const arrivalLineInfo = sceneryInfo?.routesInfo.find( const arrivalLineInfo = sceneryInfo?.routesInfo.find(
(r) => r.routeName == stop.arrivalLine (r) => r.routeName == stop.arrivalLine
); );
@@ -214,8 +218,10 @@ export default defineComponent({
isLastConfirmed: this.lastConfirmed === i && !stop.terminatesHere, isLastConfirmed: this.lastConfirmed === i && !stop.terminatesHere,
isSBL: /sbl/gi.test(stop.stopName), isSBL: /sbl/gi.test(stop.stopName),
position: stop.beginsHere ? 'begin' : stop.terminatesHere ? 'end' : 'en-route', position: stop.beginsHere ? 'begin' : stop.terminatesHere ? 'end' : 'en-route',
status: stop.confirmed ? 'confirmed' : stop.stopped ? 'stopped' : 'unconfirmed',
sceneryName, sceneryName,
status: stop.confirmed ? 'confirmed' : stop.stopped ? 'stopped' : 'unconfirmed' isSceneryOnline
}; };
}) ?? [] }) ?? []
); );
+2
View File
@@ -151,6 +151,8 @@ export interface TrainScheduleStop {
isSBL: boolean; isSBL: boolean;
sceneryName: string | null; sceneryName: string | null;
isSceneryOnline: boolean;
distance: number; distance: number;
arrivalLine: string | null; arrivalLine: string | null;
+11 -2
View File
@@ -48,7 +48,9 @@
"no-result": "No results for current search!", "no-result": "No results for current search!",
"migration-warning": "Stacjownik services will be unavailable 2/06/2022 between 1-3am (CEST time) due to the migration of API hostings!", "migration-warning": "Stacjownik services will be unavailable 2/06/2022 between 1-3am (CEST time) due to the migration of API hostings!",
"migration-confirm": "Roger that!", "migration-confirm": "Roger that!",
"offline": "App is in the offline mode!" "offline": "App is in the offline mode!",
"tooltip-driver-offline": "Driver is offline",
"tooltip-scenery-offline": "Scenery is offline"
}, },
"footer": { "footer": {
"discord": "Stacjownik Discord server" "discord": "Stacjownik Discord server"
@@ -423,7 +425,11 @@
"driver-not-found-desc-2": "You can browse timetable history in the", "driver-not-found-desc-2": "You can browse timetable history in the",
"driver-not-found-journal": "TIMETABLES JOURNAL", "driver-not-found-journal": "TIMETABLES JOURNAL",
"driver-not-found-others": "Player {driver} is online as:", "driver-not-found-others": "Player {driver} is online as:",
"driver-not-found-return": "GO BACK TO THE MAIN SITE" "driver-not-found-return": "GO BACK TO THE MAIN SITE",
"stock-copy": "COPY THE STOCK",
"stock-clipboard-success": "Successfully copied the railway stock in a text form to your clipboard!",
"stock-clipboard-failure": "Oops! Something happened and the railway stock couldn't be copied to your clipboard! :/"
}, },
"train-stats": { "train-stats": {
"stats-button": "STATISTICS", "stats-button": "STATISTICS",
@@ -478,6 +484,9 @@
"stock-dangers": "ADDITIONAL NOTES", "stock-dangers": "ADDITIONAL NOTES",
"stock-preview": "STOCK PREVIEW", "stock-preview": "STOCK PREVIEW",
"stock-copy": "COPY THE STOCK",
"stock-clipboard-success": "Successfully copied the railway stock in a text form to your clipboard:",
"stock-clipboard-failure": "Oops! Something happened and the railway stock couldn't be copied to your clipboard! :/",
"load-data": "Load further data...", "load-data": "Load further data...",
+12 -3
View File
@@ -21,7 +21,7 @@
"driver-message": "Maszynista wspierający projekt Stacjownika!" "driver-message": "Maszynista wspierający projekt Stacjownika!"
}, },
"warnings": { "warnings": {
"TWR": "Pociąg z towarami niebezpiecznie wysokiego ryzyka", "TWR": "Pociąg z towarami niebezpiecznymi wysokiego ryzyka",
"SKR": "Pociąg z przekroczoną skrajnią", "SKR": "Pociąg z przekroczoną skrajnią",
"PN": "Pociąg z przesyłkami nadzwyczajnymi", "PN": "Pociąg z przesyłkami nadzwyczajnymi",
"TN": "Pociąg z towarami niebezpiecznymi", "TN": "Pociąg z towarami niebezpiecznymi",
@@ -45,7 +45,9 @@
"loading": "Pobieranie danych...", "loading": "Pobieranie danych...",
"error": "Wystąpił problem z załadowaniem danych!", "error": "Wystąpił problem z załadowaniem danych!",
"no-result": "Brak wyników o podanych kryteriach!", "no-result": "Brak wyników o podanych kryteriach!",
"offline": "Aplikacja w trybie offline!" "offline": "Aplikacja w trybie offline!",
"tooltip-driver-offline": "Maszynista offline",
"tooltip-scenery-offline": "Sceneria offline"
}, },
"footer": { "footer": {
"discord": "Serwer Discord Stacjownika" "discord": "Serwer Discord Stacjownika"
@@ -409,7 +411,11 @@
"driver-not-found-desc-2": "Historię rozkładów jazdy możesz przejrzeć w", "driver-not-found-desc-2": "Historię rozkładów jazdy możesz przejrzeć w",
"driver-not-found-journal": "DZIENNIKU RJ", "driver-not-found-journal": "DZIENNIKU RJ",
"driver-not-found-others": "Gracz {driver} jest online jako:", "driver-not-found-others": "Gracz {driver} jest online jako:",
"driver-not-found-return": "WRÓĆ NA STRONĘ GŁÓWNĄ" "driver-not-found-return": "WRÓĆ NA STRONĘ GŁÓWNĄ",
"stock-copy": "SKOPIUJ SKŁAD",
"stock-clipboard-success": "Pomyślnie skopiowano skład w postaci tekstowej do schowka!",
"stock-clipboard-failure": "Ups! Nie udało się skopiować składu do schowka! :/"
}, },
"train-stats": { "train-stats": {
"stats-button": "STATYSTYKI", "stats-button": "STATYSTYKI",
@@ -462,6 +468,9 @@
"stock-dangers": "DODATKOWE UWAGI", "stock-dangers": "DODATKOWE UWAGI",
"stock-preview": "PODGLĄD SKŁADU", "stock-preview": "PODGLĄD SKŁADU",
"stock-copy": "SKOPIUJ SKŁAD",
"stock-clipboard-success": "Pomyślnie skopiowano skład w postaci tekstowej do schowka:",
"stock-clipboard-failure": "Ups! Nie udało się skopiować składu do schowka! :/",
"load-data": "Pobierz dalszą historię...", "load-data": "Pobierz dalszą historię...",
+7 -7
View File
@@ -43,7 +43,7 @@ export const useMainStore = defineStore('mainStore', {
sceneriesTrains.clear(); sceneriesTrains.clear();
return (apiStore.activeData?.trains ?? []) return (apiStore.activeData?.trains ?? [])
.filter((train) => train.timetable || train.online) .filter((train) => train.timetable || train.lastSeen >= Date.now() - 60000)
.map((train) => { .map((train) => {
const stock = train.stockString.split(';'); const stock = train.stockString.split(';');
const locoType = stock ? stock[0] : train.stockString; const locoType = stock ? stock[0] : train.stockString;
@@ -112,13 +112,15 @@ export const useMainStore = defineStore('mainStore', {
: undefined : undefined
} as Train; } as Train;
const stationNameKey = train.currentStationName.indexOf('.sc') != -1 ? train.currentStationName.split(' ').slice(0, -1).join(' ') : train.currentStationName;
// Sceneries trains map // Sceneries trains map
if (sceneriesTrains.has(train.currentStationName)) { if (sceneriesTrains.has(stationNameKey)) {
sceneriesTrains.set(train.currentStationName, [ sceneriesTrains.set(stationNameKey, [
...sceneriesTrains.get(train.currentStationName)!, ...sceneriesTrains.get(stationNameKey)!,
trainObj trainObj
]); ]);
} else sceneriesTrains.set(train.currentStationName, [trainObj]); } else sceneriesTrains.set(stationNameKey, [trainObj]);
// Checkpoints trains map // Checkpoints trains map
if (trainObj.timetableData) { if (trainObj.timetableData) {
@@ -216,7 +218,6 @@ export const useMainStore = defineStore('mainStore', {
return acc; return acc;
}, [] as ActiveScenery[]); }, [] as ActiveScenery[]);
const referenceTimestamp = Date.now(); const referenceTimestamp = Date.now();
const onlineActiveSceneries = apiStore.activeData?.activeSceneries.reduce((list, scenery) => { const onlineActiveSceneries = apiStore.activeData?.activeSceneries.reduce((list, scenery) => {
@@ -230,7 +231,6 @@ export const useMainStore = defineStore('mainStore', {
? scenery.dispatcherStatus ? scenery.dispatcherStatus
: null; : null;
list.push({ list.push({
name: scenery.stationName, name: scenery.stationName,
hash: scenery.stationHash, hash: scenery.stationHash,
+1 -1
View File
@@ -227,7 +227,7 @@ a.a-button {
font-weight: bold; font-weight: bold;
&:hover { &:hover {
background-color: #424242; background-color: #505050;
} }
&:disabled { &:disabled {
+27 -3
View File
@@ -24,9 +24,12 @@
<div class="train-card"> <div class="train-card">
<TrainInfo :train="chosenTrain" :extended="true" /> <TrainInfo :train="chosenTrain" :extended="true" />
<div style="margin-top: 1em">
<StockList :trainStockList="chosenTrain.stockList" /> <button class="btn btn--action" style="margin: 1em 0" @click="copyStockToClipboard()">
</div> <i class="fa-regular fa-copy"></i> {{ $t('trains.stock-copy') }}
</button>
<StockList :trainStockList="chosenTrain.stockList" />
<TrainSchedule :train="chosenTrain" /> <TrainSchedule :train="chosenTrain" />
</div> </div>
</div> </div>
@@ -79,6 +82,7 @@ import { useMainStore } from '../store/mainStore';
import { useApiStore } from '../store/apiStore'; import { useApiStore } from '../store/apiStore';
import { Status } from '../typings/common'; import { Status } from '../typings/common';
import { regions as regionsJSON } from '../data/options.json'; import { regions as regionsJSON } from '../data/options.json';
import { useI18n } from 'vue-i18n';
const props = defineProps({ const props = defineProps({
trainId: { trainId: {
@@ -93,6 +97,8 @@ const props = defineProps({
const mainStore = useMainStore(); const mainStore = useMainStore();
const apiStore = useApiStore(); const apiStore = useApiStore();
const i18n = useI18n();
const chosenTrain = computed(() => const chosenTrain = computed(() =>
mainStore.trainList.find((train) => train.id == props.trainId || train.modalId == props.modalId) mainStore.trainList.find((train) => train.id == props.trainId || train.modalId == props.modalId)
); );
@@ -104,6 +110,24 @@ const otherDriverTrains = computed(() => {
(train.timetableData || train.online || train.lastSeen >= Date.now() - 60000) (train.timetableData || train.online || train.lastSeen >= Date.now() - 60000)
); );
}); });
function copyStockToClipboard() {
const stockString = chosenTrain.value?.stockList.join(';');
if (!stockString) {
alert(i18n.t('trains.stock-clipboard-failure'));
return;
}
navigator.clipboard
.writeText(stockString)
.then(() => {
prompt(i18n.t('trains.stock-clipboard-success'), stockString);
})
.catch(() => {
alert(i18n.t('trains.stock-clipboard-failure'));
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>