diff --git a/package-lock.json b/package-lock.json index e1c9d7a..d2b8b94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5870,6 +5870,11 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, + "howler": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/howler/-/howler-2.2.1.tgz", + "integrity": "sha512-0iIXvuBO/81CcrQ/HSSweYmbT50fT2mIc9XMFb+kxIfk2pW/iKzDbX1n3fZmDXMEIpYvyyfrB+gXwPYSDqUxIQ==" + }, "hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", @@ -7374,9 +7379,9 @@ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-forge": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", - "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", "dev": true }, "node-ipc": { @@ -9227,12 +9232,12 @@ "dev": true }, "selfsigned": { - "version": "1.10.7", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", - "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", + "version": "1.10.8", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz", + "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==", "dev": true, "requires": { - "node-forge": "0.9.0" + "node-forge": "^0.10.0" } }, "semver": { diff --git a/package.json b/package.json index a4e6ead..f184be4 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "core-js": "^3.6.5", "dotenv": "^8.2.0", "firebase": "^7.21.0", + "howler": "^2.2.1", "vue": "^2.6.11", "vue-class-component": "^7.2.5", "vue-property-decorator": "^8.4.2", diff --git a/public/index.html b/public/index.html index 33ed6a9..66d5885 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,6 @@ - Stacjownik diff --git a/src/App.vue b/src/App.vue index 2d735b2..c0c1c44 100644 --- a/src/App.vue +++ b/src/App.vue @@ -65,6 +65,9 @@ import { mapGetters, mapActions } from "vuex"; import Clock from "@/components/App/Clock.vue"; +// import stationData from "@/data/stations.json"; + + @Component({ components: { Clock }, }) @@ -76,6 +79,19 @@ export default class App extends Vue { mounted() { this.synchronizeData(); + + // stationData + // .filter(data => data.stationName.length > 12 || (data.stops && data.stops.some(stop => stop.length > 12))) + // .forEach(data => { + // console.log(data.stationName, data.stationName.length); + + // data.stops?.forEach(stop => { + // console.log(stop, stop.length); + // }) + + // console.log("-----"); + // }); + } } diff --git a/src/assets/sound.wav b/src/assets/sound.wav new file mode 100644 index 0000000..920d6fd Binary files /dev/null and b/src/assets/sound.wav differ diff --git a/src/data/stations.json b/src/data/stations.json index 02543b3..e1db5d1 100644 --- a/src/data/stations.json +++ b/src/data/stations.json @@ -264,7 +264,7 @@ }, "default": true, "nonPublic": false, - "stops": ["Głowno, Domaniewice"] + "stops": ["Głowno", "Domaniewice"] }, { "stationName": "LCS Ozorków", diff --git a/src/router/index.ts b/src/router/index.ts index 8464264..bf26c11 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -3,6 +3,7 @@ import VueRouter, { RouteConfig } from 'vue-router'; import StationsView from '../views/StationsView.vue'; import TrainsView from '../views/TrainsView.vue'; +import TimetableView from '../views/TimetableView.vue'; Vue.use(VueRouter); @@ -18,6 +19,12 @@ const routes: Array = [ component: TrainsView, props: true, }, + { + path: '/timetable', + name: 'TimetableView', + component: TimetableView, + props: true + } ]; const router = new VueRouter({ diff --git a/src/scripts/interfaces/Station.ts b/src/scripts/interfaces/Station.ts index e8a9c54..8a8566a 100644 --- a/src/scripts/interfaces/Station.ts +++ b/src/scripts/interfaces/Station.ts @@ -37,6 +37,10 @@ export default interface Station { category: string; stopInfo: TrainStop; + terminatesAt: string; + beginsAt: string; + nearestStop: string; + stopLabel: string; stopStatus: string; }[]; diff --git a/src/store/store.ts b/src/store/store.ts index 4e3b3ab..2b70a87 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -372,7 +372,7 @@ export default class Store extends VuexModule { @Mutation private updateTimetableData(timetableList: any[]) { this.stationList = this.stationList.map(station => { - const scheduledTrains: Station['scheduledTrains'] = timetableList.reduce((acc: Station['scheduledTrains'], timetableData: any) => { + const scheduledTrains: Station['scheduledTrains'] = timetableList.reduce((acc: Station['scheduledTrains'], timetableData: any, index) => { const scheduledIndex = timetableData ? timetableData.followingStops.findIndex((stop: any) => { const stationName = station.stationName.toLowerCase(); @@ -386,19 +386,31 @@ export default class Store extends VuexModule { ); }) : -1; - + + if (scheduledIndex >= 0) { + const stopInfo = timetableData.followingStops[scheduledIndex]; let stopStatus = ""; let stopLabel = ""; + let nearestStop = ""; if (stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" } else if (!stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" } // else if (timetableData.currentStationName == station.stationName && stopInfo.beginsHere ) { stopStatus = "online"; stopLabel = "Podstawia się" } else if (timetableData.currentStationName == station.stationName && !stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" } else if (timetableData.currentStationName == station.stationName && stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" } - else if (timetableData.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" } + else if (timetableData.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" } + + for (let i = scheduledIndex + 1; i < timetableData.followingStops.length - 1; i++){ + const stop = timetableData.followingStops[i]; + + if (stop.mainStop && stop.stopType.includes("ph")) { + nearestStop = stop.stopNameRAW; + break; + } + } acc.push({ trainNo: timetableData.trainNo, @@ -407,6 +419,9 @@ export default class Store extends VuexModule { currentStationName: timetableData.currentStationName, currentStationHash: timetableData.currentStationHash, category: timetableData.category, + beginsAt: timetableData.followingStops[0].stopNameRAW, + terminatesAt: timetableData.followingStops[timetableData.followingStops.length - 1].stopNameRAW, + nearestStop, stopInfo, stopLabel, stopStatus diff --git a/src/views/StationsView.vue b/src/views/StationsView.vue index d10d08c..734d361 100644 --- a/src/views/StationsView.vue +++ b/src/views/StationsView.vue @@ -245,6 +245,7 @@ export default class StationsView extends Vue { this.focusedStationName = ""; } }); + } closeCard() { diff --git a/src/views/TimetableView.vue b/src/views/TimetableView.vue new file mode 100644 index 0000000..9d980ba --- /dev/null +++ b/src/views/TimetableView.vue @@ -0,0 +1,570 @@ + + + + + \ No newline at end of file