From c7950ac757faf2f1e9a95b7c2312f04cef09b8b1 Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 31 Aug 2020 23:45:56 +0200 Subject: [PATCH] =?UTF-8?q?Zmiana=20w=20wygl=C4=85dzie=20element=C3=B3w=20?= =?UTF-8?q?listy=20poci=C4=85g=C3=B3w,=20poprawki=20kosmetyczne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 44 +- src/assets/icon-distance.svg | 5 + src/assets/icon-person.svg | 1 + src/assets/icon-point.svg | 1 + src/assets/icon-route.svg | 5 + src/assets/icon-scenery.svg | 8 + src/assets/icon-schedule.svg | 1 + src/assets/icon-signal.svg | 18 + src/components/StationsView/StationCard.vue | 28 ++ src/components/StationsView/StationTable.vue | 397 +++++++------------ src/components/TrainsView/TrainSearch.vue | 86 ++++ src/components/TrainsView/TrainTable.vue | 131 ++++-- src/scripts/interfaces/Train.ts | 1 + src/store/modules/trainsModule.ts | 18 +- src/styles/global.scss | 6 +- src/views/StationsView.vue | 108 ++++- src/views/TrainsView.vue | 80 +--- 17 files changed, 550 insertions(+), 388 deletions(-) create mode 100644 src/assets/icon-distance.svg create mode 100644 src/assets/icon-person.svg create mode 100644 src/assets/icon-point.svg create mode 100644 src/assets/icon-route.svg create mode 100644 src/assets/icon-scenery.svg create mode 100644 src/assets/icon-schedule.svg create mode 100644 src/assets/icon-signal.svg create mode 100644 src/components/TrainsView/TrainSearch.vue diff --git a/public/index.html b/public/index.html index f0e9cc4..a4bccd9 100644 --- a/public/index.html +++ b/public/index.html @@ -1,26 +1,24 @@ - - - - - - - Stacjownik - - - -
- - - + + + + + + + + Stacjownik + + + + +
+ + + + \ No newline at end of file diff --git a/src/assets/icon-distance.svg b/src/assets/icon-distance.svg new file mode 100644 index 0000000..60064ca --- /dev/null +++ b/src/assets/icon-distance.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icon-person.svg b/src/assets/icon-person.svg new file mode 100644 index 0000000..9ef4fd6 --- /dev/null +++ b/src/assets/icon-person.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon-point.svg b/src/assets/icon-point.svg new file mode 100644 index 0000000..1b6ccbf --- /dev/null +++ b/src/assets/icon-point.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon-route.svg b/src/assets/icon-route.svg new file mode 100644 index 0000000..af2fd9e --- /dev/null +++ b/src/assets/icon-route.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icon-scenery.svg b/src/assets/icon-scenery.svg new file mode 100644 index 0000000..31a0b5d --- /dev/null +++ b/src/assets/icon-scenery.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/assets/icon-schedule.svg b/src/assets/icon-schedule.svg new file mode 100644 index 0000000..df508af --- /dev/null +++ b/src/assets/icon-schedule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon-signal.svg b/src/assets/icon-signal.svg new file mode 100644 index 0000000..00e97c5 --- /dev/null +++ b/src/assets/icon-signal.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/components/StationsView/StationCard.vue b/src/components/StationsView/StationCard.vue index 3ddd7cf..2accf47 100644 --- a/src/components/StationsView/StationCard.vue +++ b/src/components/StationsView/StationCard.vue @@ -132,6 +132,14 @@ + + @@ -356,4 +364,24 @@ export default class StationCard extends styleMixin { } } } + +.card-timetables { + position: absolute; + width: 100%; + + height: 90%; + + background: #333; + + overflow: hidden; + + bottom: 0; + left: 0; + + .content { + position: absolute; + } + + // transform: translateY(80%); +} \ No newline at end of file diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index cbf2f60..c995c56 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -1,145 +1,140 @@ @@ -164,13 +159,12 @@ const descSVG = require("@/assets/icon-arrow-desc.svg"); }) export default class StationTable extends styleMixin { @Prop() readonly stations!: Station[]; - @Prop() readonly setFocusedStation!: () => void; + @Prop() readonly sorterActive!: number; - @Getter("trainsDataList") trains!: Train[]; - @Getter("trainsDataState") trainsDataState!: number; + @Prop() readonly setFocusedStation!: () => void; + @Prop() readonly changeSorter!: () => void; icons: { ascSVG; descSVG } = { ascSVG, descSVG }; - sorterActive: { index: number; dir: number } = { index: 0, dir: 1 }; headTitles: string[][] = [ ["Stacja"], @@ -183,108 +177,6 @@ export default class StationTable extends styleMixin { ["Szlaki", "2tor | 1tor"], ["Aktywne RJ"], ]; - - changeSorter(index: number) { - if (index > 5) return; - - if (index == this.sorterActive.index) - this.sorterActive.dir = -1 * this.sorterActive.dir; - else this.sorterActive.dir = 1; - - this.sorterActive.index = index; - } - - getScheduledTrains(stationName: string) { - if (this.trainsDataState != 2) return null; - // console.log( - // this.computedStations.find((s) => s.stationName === stationName) - // ?.scheduledTrains - // ); - } - - get scheduledTrains() { - const reducedList = this.stations.reduce((acc, station) => { - if (!acc[station.stationName]) acc[station.stationName] = []; - - this.trains - .filter((train) => !train.noTimetable) - .forEach((train) => { - const found = train.stopPoints!.find( - (sp) => - (station.stationName - .toLowerCase() - .includes(sp.pointNameRAW.toLowerCase()) || - station.stationName - .toLowerCase() - .includes(sp.pointNameRAW.toLowerCase().split(",")[0]) || - station.stationName - .toLowerCase() - .includes(sp.pointNameRAW.toLowerCase().split(" ")[0])) && - !acc[station.stationName].find((t) => t.trainNo === train.trainNo) - ); - - if (!found) return acc; - - acc[station.stationName].push({ - trainNo: train.trainNo, - driverName: train.driverName, - category: train.category, - ...found, - }); - }); - - return acc; - }, {}); - - return reducedList; - } - - get computedStations() { - const dir: number = this.sorterActive.dir; - const scheduledTrainList = this.scheduledTrains; - - return this.stations - .sort((a, b) => { - switch (this.sorterActive.index) { - case 1: - if (parseInt(a.reqLevel) > parseInt(b.reqLevel)) return dir; - if (parseInt(a.reqLevel) < parseInt(b.reqLevel)) return -dir; - break; - - case 2: - if (a.statusTimestamp > b.statusTimestamp) return dir; - if (a.statusTimestamp < b.statusTimestamp) return -dir; - break; - - case 3: - if (a.dispatcherName > b.dispatcherName) return dir; - if (a.dispatcherName < b.dispatcherName) return -dir; - break; - - case 4: - if (a.dispatcherExp > b.dispatcherExp) return dir; - if (a.dispatcherExp < b.dispatcherExp) return -dir; - break; - - case 5: - if (a.currentUsers > b.currentUsers) return dir; - if (a.currentUsers < b.currentUsers) return -dir; - if (a.maxUsers > b.maxUsers) return dir; - if (a.maxUsers < b.maxUsers) return -dir; - break; - - default: - break; - } - - if (a.stationName >= b.stationName) return dir; - return -dir; - }) - .map((station) => ({ - ...station, - scheduledTrains: scheduledTrainList[station.stationName], - })); - } } @@ -306,7 +198,9 @@ export default class StationTable extends styleMixin { } .station-table { - font-size: calc(0.6rem + 0.3vw); + font-size: calc(0.5rem + 0.3vw); + overflow: auto; + overflow-y: hidden; } .separator { @@ -324,10 +218,6 @@ export default class StationTable extends styleMixin { } .table { - &-wrapper { - overflow: auto; - } - white-space: nowrap; border-collapse: collapse; @@ -335,15 +225,16 @@ export default class StationTable extends styleMixin { font-size: 0.6rem; } + thead th { + position: sticky; + top: 0; + } + &-head th { padding: 0.3rem; background-color: #444; min-width: 120px; - position: sticky; - top: 0; - z-index: 2; - cursor: pointer; user-select: none; -moz-user-select: none; diff --git a/src/components/TrainsView/TrainSearch.vue b/src/components/TrainsView/TrainSearch.vue new file mode 100644 index 0000000..6f349da --- /dev/null +++ b/src/components/TrainsView/TrainSearch.vue @@ -0,0 +1,86 @@ + + + + + \ No newline at end of file diff --git a/src/components/TrainsView/TrainTable.vue b/src/components/TrainsView/TrainTable.vue index f75ca12..53d1aa0 100644 --- a/src/components/TrainsView/TrainTable.vue +++ b/src/components/TrainsView/TrainTable.vue @@ -3,9 +3,9 @@
Ups! Brak pociągów do wyświetlenia :/