diff --git a/src/App.scss b/src/App.scss index 218ee02..6c84526 100644 --- a/src/App.scss +++ b/src/App.scss @@ -3,18 +3,6 @@ @import "./styles/global.scss"; @import "./styles/scenery_status.scss"; -:root { - --clr-primary: #ffc014; - --clr-secondary: #2f2f2f; - - --clr-bg: #333; - - --clr-accent: #1085b3; - --clr-accent2: #ff3d5d; - - --clr-skr: #ff5100; - --clr-twr: #ffbb00; -} // VUE ROUTE CHANGE ANIMATION .view-anim { diff --git a/src/components/TrainsView/TrainTable.vue b/src/components/TrainsView/TrainTable.vue index 3f8d2d3..05ba2d8 100644 --- a/src/components/TrainsView/TrainTable.vue +++ b/src/components/TrainsView/TrainTable.vue @@ -21,10 +21,10 @@ v-for="(train, i) in computedTrains" :key="i" :ref=" - train.timetableData && - ((el) => { + (el) => { + if (!train.timetableData) return; elList[train.timetableData.timetableId] = el; - }) + } " >
@@ -259,7 +259,7 @@ export default defineComponent({ setup(props) { const store = useStore(); - const elList: Ref = ref([]); + const elList: Ref<(HTMLElement | null)[]> = ref([]); onBeforeUpdate(() => { elList.value.length = 0; @@ -293,16 +293,25 @@ export default defineComponent({ }, methods: { + focusOnTrain(trainNoStr: string) { + const timetableId = this.computedTrains.find( + (train) => train.trainNo == Number(trainNoStr) + )?.timetableData?.timetableId; + + if (!timetableId) return; + + this.changeScheduleShowState(timetableId); + }, + changeScheduleShowState(timetableId: number | undefined) { if (!timetableId || timetableId < 0) return; this.showedSchedule = this.showedSchedule == timetableId ? 0 : timetableId; - this.$nextTick(() => { - const currentEl: HTMLElement = this.elList[timetableId]; + const currentEl = this.elList[timetableId]; - currentEl.scrollIntoView({ + currentEl?.scrollIntoView({ behavior: "smooth", block: "nearest", }); @@ -352,16 +361,8 @@ export default defineComponent({ }, }, - watch: { - queryTrain(trainNo: string) { - const timetableId = this.computedTrains.find( - (train) => train.trainNo == parseInt(trainNo) - )?.timetableData?.timetableId; - - if (!timetableId) return; - - this.changeScheduleShowState(timetableId); - }, + activated() { + if (this.queryTrain) this.focusOnTrain(this.queryTrain); }, }); @@ -388,7 +389,7 @@ img.train-image { .traffic-warning { padding: 1em 0.5em; margin-bottom: 0.5em; - background: firebrick; + background: var(--clr-warning); } .train { diff --git a/src/styles/global.scss b/src/styles/global.scss index 442e0e5..4ab5974 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -1,3 +1,20 @@ +:root { + --clr-primary: #ffc014; + --clr-secondary: #2f2f2f; + + --clr-bg: #333; + + --clr-accent: #1085b3; + --clr-accent2: #ff3d5d; + + --clr-skr: #ff5100; + --clr-twr: #ffbb00; + + --clr-error: #df3e3e; + --clr-warning: #c59429; +} + + html { scroll-behavior: smooth; } @@ -171,4 +188,10 @@ ul { &-column { flex-direction: column; } +} + +.text { + &--primary { + color: var(--clr-primary); + } } \ No newline at end of file diff --git a/src/views/HistoryView.vue b/src/views/HistoryView.vue index 0436d78..eb38534 100644 --- a/src/views/HistoryView.vue +++ b/src/views/HistoryView.vue @@ -30,77 +30,110 @@
- -
  • -
    - - - {{ item.trainCategoryCode }} {{ item.trainNo }} - +
    + +
    +
    Ładowanie...
    -
    - {{ item.route.replace("|", " - ") }} -
    - - - - {{ - !item.terminated - ? "AKTYWNY" - : item.fulfilled - ? "WYPEŁNIONY" - : "NIEWYPEŁNIONY" - }} - + Wystąpił błąd! +
    + +
    + Brak wyników! +
    + +
      +
    • +
      + + + {{ item.trainCategoryCode }} + {{ item.trainNo }} + + +
      + {{ item.route.replace("|", " - ") }} +
      +
      + + + {{ + !item.terminated + ? "AKTYWNY" + : item.fulfilled + ? "WYPEŁNIONY" + : "NIEWYPEŁNIONY" + }} + +
      + +
      +
      + Maszynista: + {{ item.driverName }} +
      +
      + Kilometraż: + {{ !item.fulfilled ? item.currentDistance + " /" : "" }} + {{ item.routeDistance }} km +
      + +
      + Stacje: + {{ item.confirmedStopsCount }} / + {{ item.allStopsCount }} +
      + +
      + Rozpoczęcie: + {{ localeDate(item.beginDate) }} +
      + +
      + Zakończenie: + {{ localeDate(item.endDate) }} +
      +
      +
    • +
    - -
    -
    Maszynista: {{ item.driverName }}
    -
    - Kilometraż: - {{ !item.fulfilled ? item.currentDistance + " /" : "" }} - {{ item.routeDistance }} km -
    - -
    - Stacje: - {{ item.confirmedStopsCount }} / - {{ item.allStopsCount }} -
    - -
    - Rozpoczęcie: - {{ localeDate(item.beginDate) }} -
    - -
    Zakończenie: {{ localeDate(item.endDate) }}
    -
    -
  • -
    + +
    \ No newline at end of file diff --git a/src/views/TrainsView.vue b/src/views/TrainsView.vue index 4ce6dde..ef72fdd 100644 --- a/src/views/TrainsView.vue +++ b/src/views/TrainsView.vue @@ -2,10 +2,7 @@
    - +
    - +