1.3.5->1.4a: poprawki w wyglądzie, dodanie dziennika ruchu stacji

This commit is contained in:
2021-02-20 01:34:17 +01:00
parent aac1d6c132
commit ccac083716
13 changed files with 308 additions and 72 deletions
+4 -30
View File
@@ -2129,38 +2129,12 @@
"dev": true "dev": true
}, },
"axios": { "axios": {
"version": "0.19.2", "version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"dev": true, "dev": true,
"requires": { "requires": {
"follow-redirects": "1.5.10" "follow-redirects": "^1.10.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"dev": true,
"requires": {
"debug": "=3.1.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
} }
}, },
"babel-code-frame": { "babel-code-frame": {
+1 -1
View File
@@ -24,7 +24,7 @@
"@vue/cli-plugin-typescript": "~4.4.0", "@vue/cli-plugin-typescript": "~4.4.0",
"@vue/cli-plugin-vuex": "~4.4.0", "@vue/cli-plugin-vuex": "~4.4.0",
"@vue/cli-service": "~4.4.0", "@vue/cli-service": "~4.4.0",
"axios": "^0.19.2", "axios": "^0.21.1",
"sass": "^1.26.10", "sass": "^1.26.10",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"typescript": "^3.9.7", "typescript": "^3.9.7",
+24 -12
View File
@@ -22,7 +22,8 @@
<span class="header_links"> <span class="header_links">
<router-link class="route" active-class="route-active" to="/" exact>SCENERIE</router-link>/ <router-link class="route" active-class="route-active" to="/" exact>SCENERIE</router-link>/
<router-link class="route" active-class="route-active" to="/trains">POCIĄGI</router-link> <router-link class="route" active-class="route-active" to="/trains">POCIĄGI</router-link>/
<router-link class="route" active-class="route-active" to="/history">DZIENNIK</router-link>
</span> </span>
</div> </div>
</header> </header>
@@ -59,7 +60,7 @@ export default class App extends Vue {
@Action("synchronizeData") synchronizeData; @Action("synchronizeData") synchronizeData;
@Getter("getAllData") data; @Getter("getAllData") data;
private VERSION = "1.3.6"; private VERSION = "1.4a";
async mounted() { async mounted() {
this.synchronizeData(); this.synchronizeData();
@@ -104,12 +105,12 @@ export default class App extends Vue {
background: $bgCol; background: $bgCol;
color: white; color: white;
font-size: calc(1.1rem + 2.1vw);
overflow: hidden; overflow: hidden;
@include smallScreen() { font-size: calc(0.4rem + 0.4vw);
font-size: 2.5rem;
@include bigScreen {
font-size: 1rem;
} }
} }
@@ -132,11 +133,15 @@ export default class App extends Vue {
display: flex; display: flex;
justify-content: center; justify-content: center;
@include smallScreen() {
font-size: 1.2em;
}
} }
.header_brand { .header_brand {
width: 100%; width: 100%;
font-size: 1.1em; font-size: 4.5em;
text-align: center; text-align: center;
@@ -149,9 +154,14 @@ export default class App extends Vue {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 1.35em;
margin: 0 0.3em; margin: 0 0.3em;
padding: 0.2em; padding: 0.2em;
font-size: 0.35em;
@include smallScreen() {
font-size: 1.5em;
}
} }
.header_links { .header_links {
@@ -160,8 +170,12 @@ export default class App extends Vue {
border-radius: 0.7em; border-radius: 0.7em;
padding: 0.2em; font-size: 1.2em;
font-size: 0.35em; padding: 0.5em;
@include smallScreen() {
font-size: 1.4em;
}
} }
// COUNTER // COUNTER
@@ -170,8 +184,6 @@ export default class App extends Vue {
align-items: center; align-items: center;
color: $accentCol; color: $accentCol;
font-size: 1em;
span { span {
margin: 0 0.15em; margin: 0 0.15em;
} }
-4
View File
@@ -32,9 +32,5 @@ export default Vue.extend({
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@include smallScreen() {
font-size: 0.95rem;
}
} }
</style> </style>
+93
View File
@@ -0,0 +1,93 @@
<template>
<div class="dropdown">
<div class="dropdown_wrapper">
<div class="dropdown_selected" @click="toggleList">
{{selectedItem}}
<img :src="isListOpen ? arrowAsc : arrowDesc" alt="arrow" />
</div>
<ul class="dropdown_list" v-if="isListOpen">
<li v-for="(item, i) in itemList" @click="selectItem(item)" :key="i">{{item}}</li>
</ul>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
@Component
export default class Dropdown extends Vue {
arrowDesc = require("@/assets/icon-arrow-desc.svg");
arrowAsc = require("@/assets/icon-arrow-asc.svg");
selectedItem: string = "---";
isListOpen: boolean = false;
@Prop() itemList!: string[];
mounted() {
// this.selectedItem = this.itemList[0];
}
toggleList() {
this.isListOpen = !this.isListOpen;
}
selectItem(itemName: string) {
this.selectedItem = itemName;
this.isListOpen = false;
this.$emit("itemSelected", this.selectedItem);
}
}
</script>
<style lang="scss" scoped>
.dropdown {
&_wrapper {
font-size: 1.15em;
min-width: 13em;
position: relative;
}
&_selected {
background-color: #333;
padding: 0.2em 0.5em;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
img {
width: 1.35em;
vertical-align: middle;
margin-left: 0.5em;
}
}
&_list {
position: absolute;
width: 100%;
max-height: 250px;
overflow-y: scroll;
}
&_list > li {
padding: 0.3em 0.5em;
background-color: #666;
font-size: 0.8em;
cursor: pointer;
&:hover {
background-color: #555;
}
}
}
</style>
View File
+2 -3
View File
@@ -164,13 +164,12 @@ export default class FilterCard extends Vue {
background: #262a2e; background: #262a2e;
font-size: calc(0.75rem + 0.45vw); font-size: 1.5em;
box-shadow: 0 0 15px 5px #474747; box-shadow: 0 0 15px 5px #474747;
@include smallScreen() { @include smallScreen() {
width: 100%; width: 95%;
font-size: calc(0.7em + 1.1vw);
} }
@include bigScreen { @include bigScreen {
+1 -3
View File
@@ -80,8 +80,6 @@ export default class Options extends Vue {
} }
.options { .options {
font-size: calc(0.6rem + 0.9vw);
&-actions { &-actions {
display: flex; display: flex;
} }
@@ -95,7 +93,7 @@ export default class Options extends Vue {
border: none; border: none;
color: #e0e0e0; color: #e0e0e0;
font-size: 0.75em; font-size: 0.4em;
padding: 0.3em; padding: 0.3em;
+1 -4
View File
@@ -164,7 +164,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator"; import { Component, Prop } from "vue-property-decorator";
import Station from "@/scripts/interfaces/Station"; import Station from "@/scripts/interfaces/Station";
@@ -253,9 +252,7 @@ section.station_table {
font-size: calc(0.55rem + 0.35vw); font-size: calc(0.55rem + 0.35vw);
font-weight: 500; font-weight: 500;
@include smallScreen() { font-size: 1.2em;
font-size: 0.6rem;
}
} }
.table_wrapper { .table_wrapper {
+5
View File
@@ -30,6 +30,11 @@ const routes: Array<RouteConfig> = [
component: () => import('@/views/SceneryView.vue'), component: () => import('@/views/SceneryView.vue'),
props: true, props: true,
}, },
{
path: '/history',
name: 'HistoryView',
component: () => import('@/views/HistoryView.vue'),
},
]; ];
const router = new VueRouter({ const router = new VueRouter({
+167
View File
@@ -0,0 +1,167 @@
<template>
<div class="history_view">
<div class="history_wrapper">
<div class="history_dropdown">
<div class="history_title title">Wybierz scenerię</div>
<Dropdown :itemList="sortedList" @itemSelected="itemSelected" />
</div>
<div class="history_content">
<div class="history_station-name title">DZIENNIK RUCHU DLA SCENERII ALEKSANDRÓW KUJAWSKI</div>
<div class="list_wrapper">
<ul class="history_list">
<li v-for="(history, i) in currentSceneryHistory" :key="i">
<div class="history_dispatcher">{{history.dispatcherName }}</div>
<div class="history_from">
<span
style="color: #888"
>{{ new Date(history.dispatcherFrom).toLocaleDateString('pl-PL') }}</span>
{{ new Date(history.dispatcherFrom).toLocaleTimeString('pl-PL', { hour: '2-digit', minute: '2-digit' })}}
</div>
<div>-</div>
<div class="history_to">
<span
style="color: #888"
>{{ new Date(history.dispatcherTo).toLocaleDateString('pl-PL') }}</span>
{{ new Date(history.dispatcherTo).toLocaleTimeString('pl-PL', { hour: '2-digit', minute: '2-digit' })}}
</div>
</li>
<li v-if="currentDispatcherFrom != -1" class="current">
<div class="history_dispatcher">{{ currentDispatcher }}</div>
<div class="history_from">
DYŻURUJE OD:
<span
style="color: #bbb"
>{{ new Date(currentDispatcherFrom).toLocaleDateString('pl-PL') }}</span>
{{ new Date(currentDispatcherFrom).toLocaleTimeString('pl-PL', { hour: '2-digit', minute: '2-digit' })}}
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
import axios from "axios";
import { Component, Vue } from "vue-property-decorator";
import { Getter } from "vuex-class";
import Dropdown from "@/components/Global/Dropdown.vue";
import Station from "@/scripts/interfaces/Station";
interface ISceneryHistory {
_id: string;
stationHash: string;
stationName: string;
currentDispatcher: string;
currentDispatcherId: string;
currentDispatcherFrom: number;
currentDispatcherTo: number;
dispatcherHistory: {
dispatcherName: string;
dispatcherFrom: number;
dispatcherTo: number;
}[];
}
@Component({
components: {
Dropdown,
},
})
export default class HistoryView extends Vue {
@Getter("getStationList") stationList!: Station[];
currentSceneryHistory: ISceneryHistory["dispatcherHistory"] = [];
currentDispatcher: string = "";
currentDispatcherFrom: number = -1;
get sortedList() {
return this.stationList
.map((v) => v.stationName)
.sort((a, b) => (a.toLowerCase() >= b.toLowerCase() ? 1 : -1));
}
async itemSelected(itemName: string) {
try {
const responseData: ISceneryHistory = await (
await axios.get(
`https://stacjownik.herokuapp.com/api/getSceneryHistory?name=${itemName.replaceAll(
" ",
"_"
)}`
)
).data;
this.currentSceneryHistory = responseData.dispatcherHistory;
this.currentDispatcher = responseData.currentDispatcher;
this.currentDispatcherFrom = responseData.currentDispatcherFrom;
} catch (error) {
this.currentSceneryHistory = [];
}
}
}
</script>
<style scoped lang="scss">
.history {
&_view {
font-size: 1.5em;
display: flex;
}
&_title {
text-align: center;
font-size: 1.2em;
}
&_wrapper {
width: 100%;
}
&_dropdown {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
&_content {
text-align: center;
margin-top: 1em;
}
&_list {
min-width: 45%;
}
&_list > li {
display: flex;
justify-content: center;
background: #222;
padding: 0.5em 0.3em;
margin: 0.3em 0;
& > div {
margin: 0 0.5em;
}
&.current {
background: #007200;
}
}
}
.list_wrapper {
display: flex;
justify-content: center;
}
</style>
+1 -1
View File
@@ -96,7 +96,7 @@ h3 {
display: flex; display: flex;
justify-content: center; justify-content: center;
font-size: calc(0.5rem + 0.65vw); font-size: 1.35em;
@include bigScreen() { @include bigScreen() {
font-size: 1.25rem; font-size: 1.25rem;
+9 -14
View File
@@ -247,10 +247,10 @@ export default class StationsView extends Vue {
.stations_view { .stations_view {
position: relative; position: relative;
font-size: 0.95em;
padding: 1rem 0; padding: 1rem 0;
min-height: 100%; min-height: 100%;
font-size: calc(0.6rem + 0.9vw);
} }
.stations_wrapper { .stations_wrapper {
@@ -270,6 +270,7 @@ export default class StationsView extends Vue {
.bar_actions { .bar_actions {
display: flex; display: flex;
font-size: 1.25em;
button { button {
margin-right: 0.5em; margin-right: 0.5em;
@@ -285,13 +286,12 @@ export default class StationsView extends Vue {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 1.2em; width: 2.5em;
height: 1.2em; height: 2.5em;
margin-left: 0.5em; margin-left: 0.5em;
// background-color: #e68e00; // background-color: #e68e00;
border-radius: 0.5em 0.5em 0 0; border-radius: 1em 1em 0 0;
&.loading { &.loading {
background-color: $accentCol; background-color: $accentCol;
@@ -306,14 +306,9 @@ export default class StationsView extends Vue {
} }
& > img { & > img {
width: 0.9em; width: 1.7em;
animation: blinkAnim 2s ease-in-out infinite forwards; animation: blinkAnim 2s ease-in-out infinite forwards;
} }
@include smallScreen() {
width: 1.5em;
height: 1.5em;
}
} }
} }
@@ -325,7 +320,7 @@ export default class StationsView extends Vue {
border: none; border: none;
color: #e0e0e0; color: #e0e0e0;
font-size: 0.65em; font-size: 1em;
padding: 0.3em; padding: 0.3em;
@@ -356,7 +351,7 @@ export default class StationsView extends Vue {
} }
@include smallScreen() { @include smallScreen() {
font-size: 0.75rem; font-size: 1.2em;
} }
} }