From 48623280907d4b6d863eaa8a9d23a82f9bf613f9 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 1 Jan 2024 22:49:19 +0100 Subject: [PATCH 1/9] =?UTF-8?q?rozbudowany=20szczeg=C3=B3=C5=82=C3=B3wy=20?= =?UTF-8?q?RJ=20poci=C4=85gu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/icon-warning.svg | 4 +- src/App.vue | 13 +- src/components/Global/StopDate.vue | 123 ---- src/components/TrainsView/StopLabel.vue | 147 ++++ .../{Global => TrainsView}/TrainModal.vue | 13 +- src/components/TrainsView/TrainSchedule.vue | 650 ++++++++++-------- src/components/TrainsView/newFile.ts | 14 + src/store/typings.ts | 1 + 8 files changed, 555 insertions(+), 410 deletions(-) delete mode 100644 src/components/Global/StopDate.vue create mode 100644 src/components/TrainsView/StopLabel.vue rename src/components/{Global => TrainsView}/TrainModal.vue (87%) create mode 100644 src/components/TrainsView/newFile.ts diff --git a/public/images/icon-warning.svg b/public/images/icon-warning.svg index d83e557..4aa7be9 100644 --- a/public/images/icon-warning.svg +++ b/public/images/icon-warning.svg @@ -1,4 +1,4 @@ - - + + diff --git a/src/App.vue b/src/App.vue index cf3a21d..7140476 100644 --- a/src/App.vue +++ b/src/App.vue @@ -33,16 +33,17 @@ - - diff --git a/src/components/TrainsView/StopLabel.vue b/src/components/TrainsView/StopLabel.vue new file mode 100644 index 0000000..443c3ff --- /dev/null +++ b/src/components/TrainsView/StopLabel.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/src/components/Global/TrainModal.vue b/src/components/TrainsView/TrainModal.vue similarity index 87% rename from src/components/Global/TrainModal.vue rename to src/components/TrainsView/TrainModal.vue index d05857a..89ced97 100644 --- a/src/components/Global/TrainModal.vue +++ b/src/components/TrainsView/TrainModal.vue @@ -15,19 +15,12 @@ diff --git a/src/scripts/interfaces/Station.ts b/src/scripts/interfaces/Station.ts index da48e47..2212562 100644 --- a/src/scripts/interfaces/Station.ts +++ b/src/scripts/interfaces/Station.ts @@ -1,5 +1,5 @@ import { Availability, OnlineScenery, ScheduledTrain } from '../../store/typings'; -import StationRoutes from './StationRoutes'; +import { StationRoutes } from './StationRoutes'; export default interface Station { name: string; diff --git a/src/scripts/interfaces/StationRoutes.ts b/src/scripts/interfaces/StationRoutes.ts index 2d8fffc..24c82d3 100644 --- a/src/scripts/interfaces/StationRoutes.ts +++ b/src/scripts/interfaces/StationRoutes.ts @@ -1,25 +1,8 @@ -export default interface StationRoutes { - oneWay: { - name: string; - catenary: boolean; - SBL: boolean; - TWB: boolean; - isInternal: boolean; - tracks: number; - speed: number; - length: number; - }[]; +import { StationRoutesInfo } from '../../store/typings'; - twoWay: { - name: string; - catenary: boolean; - SBL: boolean; - TWB: boolean; - isInternal: boolean; - tracks: number; - speed: number; - length: number; - }[]; +export interface StationRoutes { + oneWay: StationRoutesInfo[]; + twoWay: StationRoutesInfo[]; /* [catenary, noCatenary] */ oneWayCatenaryRouteNames: string[]; diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts index 4f5abd3..d1ef716 100644 --- a/src/store/mainStore.ts +++ b/src/store/mainStore.ts @@ -1,5 +1,4 @@ import { defineStore } from 'pinia'; -import StationRoutes from '../scripts/interfaces/StationRoutes'; import Train from '../scripts/interfaces/Train'; import { parseSpawns, getScheduledTrains, getStationTrains } from './utils'; @@ -9,6 +8,7 @@ import { Status } from '../typings/common'; import Station from '../scripts/interfaces/Station'; import { useApiStore } from './apiStore'; import { API } from '../typings/api'; +import { StationRoutes } from '../scripts/interfaces/StationRoutes'; export const useMainStore = defineStore('store', { state: () => @@ -155,46 +155,39 @@ export const useMainStore = defineStore('store', { const apiStore = useApiStore(); return apiStore.sceneryData.map((scenery) => { + const routes = scenery.routesInfo.reduce( + (acc, route) => { + const tracksKey = route.routeTracks == 2 ? 'twoWay' : 'oneWay'; + const isElectric = route.isElectric; + const routesKey: keyof StationRoutes = `${tracksKey}${ + !isElectric ? 'No' : '' + }CatenaryRouteNames`; + + if (!route.isInternal) acc[routesKey].push(route.routeName); + if (route.isRouteSBL) acc['sblRouteNames'].push(route.routeName); + + acc[tracksKey].push(route); + + return acc; + }, + { + oneWay: [], + oneWayCatenaryRouteNames: [], + oneWayNoCatenaryRouteNames: [], + twoWay: [], + twoWayCatenaryRouteNames: [], + twoWayNoCatenaryRouteNames: [], + sblRouteNames: [] + } as StationRoutes + ); + return { name: scenery.name, generalInfo: { ...scenery, authors: scenery.authors?.split(',').map((a) => a.trim()), - routes: - scenery.routesInfo.reduce( - (acc, route) => { - const propName: keyof StationRoutes = `${ - route.routeTracks == 2 ? 'twoWay' : 'oneWay' - }${route.isElectric ? '' : 'No'}CatenaryRouteNames`; - - acc[route.routeTracks == 2 ? 'twoWay' : 'oneWay'].push({ - name: route.routeName, - SBL: route.isRouteSBL, - TWB: false, - catenary: route.isElectric, - isInternal: route.isInternal, - tracks: route.routeTracks, - length: route.routeLength, - speed: route.routeSpeed - }); - - if (!route.isInternal) acc[propName].push(route.routeName); - - if (route.isRouteSBL) acc['sblRouteNames'].push(route.routeName); - - return acc; - }, - { - oneWay: [], - twoWay: [], - sblRouteNames: [], - oneWayCatenaryRouteNames: [], - oneWayNoCatenaryRouteNames: [], - twoWayCatenaryRouteNames: [], - twoWayNoCatenaryRouteNames: [] - } as StationRoutes - ) || {}, + routes: routes, checkpoints: scenery.checkpoints ? scenery.checkpoints .split(';') diff --git a/src/store/typings.ts b/src/store/typings.ts index 88382a1..0923bd9 100644 --- a/src/store/typings.ts +++ b/src/store/typings.ts @@ -35,6 +35,7 @@ export interface StationRoutesInfo { routeLength: number; routeSpeed: number; routeTracks: number; + hidden?: boolean; } export interface StationJSONData { From 9acf3c740ccb452d39afa62f40a7e9dbedae54be Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 6 Jan 2024 17:40:43 +0100 Subject: [PATCH 7/9] =?UTF-8?q?dodano=20wyb=C3=B3r=20z=20listy=20autor?= =?UTF-8?q?=C3=B3w=20w=20filtrach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StationsView/StationFilterCard.vue | 296 ++++++++++-------- src/locales/en.json | 5 +- src/locales/pl.json | 4 +- 3 files changed, 169 insertions(+), 136 deletions(-) diff --git a/src/components/StationsView/StationFilterCard.vue b/src/components/StationsView/StationFilterCard.vue index c664778..ad7f89a 100644 --- a/src/components/StationsView/StationFilterCard.vue +++ b/src/components/StationsView/StationFilterCard.vue @@ -60,8 +60,9 @@ -
-
{{ $t('filters.minimum-hours-title') }}
+
+

{{ $t('filters.minimum-hours-title') }}

+ {{ @@ -75,16 +76,27 @@
+ + + +
@@ -196,6 +208,19 @@ export default defineComponent({ currentOptionsActive() { return true; + }, + + authors() { + return this.store.stationList + .reduce((acc, station) => { + station.generalInfo?.authors?.forEach((author) => { + if (author.trim() != '' && !acc.includes(author.toLocaleLowerCase())) + acc.push(author.toLocaleLowerCase()); + }); + + return acc; + }, [] as string[]) + .sort((a, b) => a.localeCompare(b)); } }, @@ -230,12 +255,12 @@ export default defineComponent({ if (this.saveOptions) StorageManager.setStringValue(target.name, target.value); }, - handleAuthorsInput(e: Event) { - clearTimeout(this.delayInputTimer); + handleAuthorsInput() { + console.log(this.authorsInputValue); - this.delayInputTimer = window.setTimeout(() => { - this.handleInput(e); - }, 400); + this.filterStore.changeFilterValue('authors', this.authorsInputValue); + + if (this.saveOptions) StorageManager.setStringValue('authors', this.authorsInputValue); }, changeNumericFilterValue(name: string, value: number, saveToStorage = false) { @@ -297,136 +322,139 @@ export default defineComponent({ @import '../../styles/card.scss'; @import '../../styles/animations.scss'; +h3.section-header { + text-align: center; + margin: 0.5em 0; +} + .card { display: grid; grid-template-rows: 1fr auto; +} - &_info { - background-color: #111; - padding: 0.5em; +.card_info { + background-color: #111; + padding: 0.5em; +} + +.card_controls { + display: flex; + gap: 0.5em; + + input { + border-radius: 0.5em 0.5em 0 0; + height: 100%; + } +} + +.card_content { + padding: 1em 0.5em; + + display: flex; + flex-direction: column; + + gap: 1em; + overflow: auto; +} + +.card_title { + font-size: 2em; + font-weight: 700; + color: $accentCol; + + text-align: center; +} + +.card_regions { + display: flex; + justify-content: center; + + label > input { + display: none; } - &_controls { + label > span { + padding: 0.25em 0.5em; + margin: 0 0.25em; + + cursor: pointer; + + background-color: gray; + + &.checked { + background-color: seagreen; + } + } +} + +.card_timestamp { + display: flex; + flex-direction: column; + justify-content: center; + + .clock { + display: flex; + align-items: center; + justify-content: center; + + font-size: 1.2em; + text-align: center; + + span { + min-width: 120px; + font-weight: bold; + color: $accentCol; + } + + button { + padding: 0.2em 0.6em; + } + } +} + +.card_authors-search { + margin: 1em 0; + + form { + display: flex; + justify-content: center; + flex-wrap: wrap; + gap: 0.5em; + width: 100%; + margin-top: 1em; + } + + input { + width: 70%; + max-width: 400px; + padding: 0.5em; + outline: 1px solid white; + } +} + +.card_actions { + width: 100%; + padding: 0.5em; + + .filter-option { + max-width: 50%; + margin: 0 auto; + } + + .action-buttons { display: flex; gap: 0.5em; - - input { - border-radius: 0.5em 0.5em 0 0; - height: 100%; - } - } - - &_content { - padding: 1em 0.5em; - - display: flex; - flex-direction: column; - - gap: 1em; - overflow: auto; - } - - &_title { - font-size: 2em; - font-weight: 700; - color: $accentCol; - - text-align: center; - } - - &_regions { - display: flex; - justify-content: center; - - label > input { - display: none; - } - - label > span { - padding: 0.25em 0.5em; - margin: 0 0.25em; - - cursor: pointer; - - background-color: gray; - - &.checked { - background-color: seagreen; - } - } - } - - &_timestamp { - display: flex; - flex-direction: column; - justify-content: center; - - .clock { - display: flex; - align-items: center; - justify-content: center; - - font-size: 1.2em; - margin-top: 0.5em; - - span { - min-width: 120px; - font-weight: bold; - color: $accentCol; - } - - button { - padding: 0.2em 0.6em; - } - } - } - - &_modes { - display: flex; - justify-content: center; - - .option { - margin: 0 1em; - } - } - - &_authors-search { - display: inline-block; - margin: 0 auto; - width: 60%; - min-width: 240px; - - input { - width: 100%; - padding: 0.5em; - border: 1px solid white; - } - } - - &_actions { width: 100%; - padding: 0.5em; - .filter-option { - max-width: 50%; + margin-top: 0.5em; + + button { + width: 50%; margin: 0 auto; - } + padding: 0.5em; - .action-buttons { - display: flex; - gap: 0.5em; - width: 100%; - - margin-top: 0.5em; - - button { - width: 50%; - margin: 0 auto; - padding: 0.5em; - - &[data-selected='true'] { - background-color: forestgreen; - } + &[data-selected='true'] { + background-color: forestgreen; } } } diff --git a/src/locales/en.json b/src/locales/en.json index 5792dcb..2a4a4f5 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -227,7 +227,10 @@ "routes-2t-cat": "MIN. CATENARY DOUBLE TRACK ROUTES", "routes-2t-other": "MIN. OTHER DOUBLE TRACK ROUTES" }, - "authors-search": "Search by author (other filters apply)", + "authors-search": "SEARCH BY AUTHOR NAME (other filters apply):", + "authors-placeholder": "Enter the author nickname...", + "authors-button-title": "Search", + "minimum-hours-title": "SHOW ONLY SCENERIES UNTIL:", "now": "NOW", "hour": "h", diff --git a/src/locales/pl.json b/src/locales/pl.json index 348abb4..c54b56d 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -218,7 +218,9 @@ "routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)" }, - "authors-search": "Szukaj autora (uwzględnia inne filtry)", + "authors-search": "SZUKAJ AUTORA (uwzględnia inne filtry):", + "authors-placeholder": "Wpisz nick autora...", + "authors-button-title": "Szukaj", "minimum-hours-title": "POKAŻ TYLKO SCENERIE DOSTĘPNE MINIMUM DO:", "now": "TERAZ", "hour": " godz.", From f836a075b0840c1e820a4b420ba8214a8c03a3eb Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 13 Jan 2024 15:41:40 +0100 Subject: [PATCH 8/9] hotfix: pobieranie historii RJ nieznanych scenerii --- src/components/SceneryView/SceneryTimetablesHistory.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue index 8d08825..9ec1aa2 100644 --- a/src/components/SceneryView/SceneryTimetablesHistory.vue +++ b/src/components/SceneryView/SceneryTimetablesHistory.vue @@ -114,7 +114,7 @@ export default defineComponent({ const response: API.TimetableHistory.Response = await ( await http.get('api/getTimetables', { params: { - issuedFrom: this.station?.name + issuedFrom: this.station?.name || this.onlineScenery?.name } }) ).data; From 186ce81819392b238570ccbda9997eb466ffc0d7 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 13 Jan 2024 17:28:16 +0100 Subject: [PATCH 9/9] =?UTF-8?q?hotfix:=20filtrowanie=20aktywnych=20rj=20do?= =?UTF-8?q?=20odpowiednich=20region=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/utils.ts b/src/store/utils.ts index bf23475..443365f 100644 --- a/src/store/utils.ts +++ b/src/store/utils.ts @@ -196,6 +196,7 @@ export function getScheduledTrains( return trainList.reduce((acc: ScheduledTrain[], train) => { if (!train.timetableData) return acc; + if (train.region != sceneryData.region) return acc; const timetable = train.timetableData; if (!timetable.sceneries.includes(sceneryData.stationHash)) return acc;