Zmiany w wyglądzie filtrów, responsywność

This commit is contained in:
2020-07-08 14:27:25 +02:00
parent fbda6b73ac
commit 5386887076
5 changed files with 178 additions and 151 deletions
+134 -133
View File
@@ -1,129 +1,131 @@
<template> <template>
<div class="card" v-if="stationInfo"> <transition name="card-anim">
<div class="card-exit" @click="closeCard">X</div> <div class="card" v-if="stationInfo">
<div class="card-exit" @click="closeCard">X</div>
<div class="card-upper"> <div class="card-upper">
<div class="station-name"> <div class="station-name">
<a
v-if="stationInfo.stationURL"
:href="stationInfo.stationURL"
target="_blank"
rel="noopener noreferrer"
>{{stationInfo.stationName}}</a>
<span v-else>{{stationInfo.stationName}}</span>
</div>
<div class="station-hash">{{stationInfo.stationHash}}</div>
<div class="station-icons">
<img
v-if="stationInfo.controlType"
:src="require(`@/assets/icon-${stationInfo.controlType}.svg`)"
:alt="stationInfo.controlType"
:title="'Sterowanie ' + stationInfo.controlType"
/>
<img
v-if="stationInfo.signalType"
:src="require(`@/assets/icon-${stationInfo.signalType}.svg`)"
:alt="stationInfo.signalType"
:title="'Sygnalizacja ' + stationInfo.signalType"
/>
<img
v-if="stationInfo.SBL && stationInfo.SBL !== ''"
:src="require(`@/assets/icon-SBL.svg`)"
alt="SBL"
title="Sceneria posiada SBL na przynajmniej jednym ze szlaków"
/>
<img
v-if="stationInfo.default"
:src="require(`@/assets/icon-td2.svg`)"
alt="default-pack"
title="Sceneria domyślnie dostępna w grze"
/>
<img
v-if="stationInfo.nonPublic || !stationInfo.reqLevel"
:src="require(`@/assets/icon-lock.svg`)"
alt="non-public"
title="Sceneria niepubliczna"
/>
<span
v-if="stationInfo.reqLevel"
:title="'Wymagany poziom dyżurnego: ' + stationInfo.reqLevel"
>{{parseInt(stationInfo.reqLevel) < 2 ? "L" : stationInfo.reqLevel}}</span>
</div>
<div class="station-info"></div>
</div>
<div class="card-content">
<div class="dispatcher">
<div class="dispatcher-exp">{{stationInfo.dispatcherExp}}</div>
<div class="dispatcher-name">
<a <a
:href="'https://td2.info.pl/profile/?u=' + stationInfo.dispatcherId" v-if="stationInfo.stationURL"
:href="stationInfo.stationURL"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
>{{stationInfo.dispatcherName}}</a> >{{stationInfo.stationName}}</a>
<span v-else>{{stationInfo.stationName}}</span>
</div> </div>
</div>
<div class="rating"> <div class="station-hash">{{stationInfo.stationHash}}</div>
<div class="rating-content">
<img :src="require(`@/assets/icon-like.svg`)" alt="like-icon" />
{{stationInfo.dispatcherRate}}
</div>
</div>
<div class="occupation"> <div class="station-icons">
<div class="occupation-title text--title">SCENERIA ZAJĘTA DO</div> <img
<div class="occupation-content text--content">{{stationInfo.occupiedTo}}</div> v-if="stationInfo.controlType"
</div> :src="require(`@/assets/icon-${stationInfo.controlType}.svg`)"
:alt="stationInfo.controlType"
:title="'Sterowanie ' + stationInfo.controlType"
/>
<img
v-if="stationInfo.signalType"
:src="require(`@/assets/icon-${stationInfo.signalType}.svg`)"
:alt="stationInfo.signalType"
:title="'Sygnalizacja ' + stationInfo.signalType"
/>
<img
v-if="stationInfo.SBL && stationInfo.SBL !== ''"
:src="require(`@/assets/icon-SBL.svg`)"
alt="SBL"
title="Sceneria posiada SBL na przynajmniej jednym ze szlaków"
/>
<img
v-if="stationInfo.default"
:src="require(`@/assets/icon-td2.svg`)"
alt="default-pack"
title="Sceneria domyślnie dostępna w grze"
/>
<img
v-if="stationInfo.nonPublic || !stationInfo.reqLevel"
:src="require(`@/assets/icon-lock.svg`)"
alt="non-public"
title="Sceneria niepubliczna"
/>
<div class="spawns">
<div class="spawns-title text--title">OTWARTE SPAWNY</div>
<div class="spawns-content text--content">
<span <span
class="spawn" v-if="stationInfo.reqLevel"
v-for="(spawn, i) in stationInfo.spawnString" :title="'Wymagany poziom dyżurnego: ' + stationInfo.reqLevel"
:key="spawn + stationInfo.dispatcherName + i" >{{(parseInt(stationInfo.reqLevel) < 2) ? "L" : stationInfo.reqLevel}}</span>
>{{spawn}}</span>
<span class="spawn" v-if="!stationInfo.spawnString">BRAK</span>
</div> </div>
<div class="station-info"></div>
</div> </div>
<div class="users"> <div class="card-content">
<div class="users-title text--title">GRACZE NA STACJI</div> <div class="dispatcher">
<div class="users-content text--content"> <div class="dispatcher-exp">{{stationInfo.dispatcherExp}}</div>
<div <div class="dispatcher-name">
class="user"
v-for="train in stationInfo.trains"
:key="train.trainNo + train.driverName"
>
<a <a
:href="'https://rj.td2.info.pl/train#' + train.trainNo + ';eu'" :href="'https://td2.info.pl/profile/?u=' + stationInfo.dispatcherId"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >{{stationInfo.dispatcherName}}</a>
<span>{{train.trainNo}}</span>
|
<span>{{train.driverName}}</span>
</a>
</div> </div>
</div>
<span <div class="rating">
class="user borderless" <div class="rating-content">
v-if="!stationInfo.trains || stationInfo.trains.length == 0" <img :src="require(`@/assets/icon-like.svg`)" alt="like-icon" />
>BRAK</span> {{stationInfo.dispatcherRate}}
</div>
</div>
<div class="occupation">
<div class="occupation-title text--title">SCENERIA ZAJĘTA DO</div>
<div class="occupation-content text--content">{{stationInfo.occupiedTo}}</div>
</div>
<div class="spawns">
<div class="spawns-title text--title">OTWARTE SPAWNY</div>
<div class="spawns-content text--content">
<span
class="spawn"
v-for="(spawn, i) in stationInfo.spawnString"
:key="spawn + stationInfo.dispatcherName + i"
>{{spawn}}</span>
<span class="spawn" v-if="!stationInfo.spawnString">BRAK</span>
</div>
</div>
<div class="users">
<div class="users-title text--title">GRACZE NA STACJI</div>
<div class="users-content text--content">
<div
class="user"
v-for="train in stationInfo.trains"
:key="train.trainNo + train.driverName"
>
<a
:href="'https://rj.td2.info.pl/train#' + train.trainNo + ';eu'"
target="_blank"
rel="noopener noreferrer"
>
<span>{{train.trainNo}}</span>
|
<span>{{train.driverName}}</span>
</a>
</div>
<span
class="user borderless"
v-if="!stationInfo.trains || stationInfo.trains.length == 0"
>BRAK</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </transition>
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -149,27 +151,34 @@ export default Vue.extend({
} }
} }
.card-anim {
&-enter-active,
&-leave-active {
transition: all 0.25s ease-in-out;
}
&-enter,
&-leave-to {
opacity: 0;
}
}
.card { .card {
display: flex;
flex-direction: column;
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
z-index: 2; z-index: 2;
transform: translate(-50%, -50%);
background: #474747;
max-height: 95%;
overflow: auto; overflow: auto;
background: #474747;
box-shadow: 0 0 15px 5px #474747;
width: 65%; width: 65%;
max-width: 650px; max-width: 650px;
max-height: 95%;
box-shadow: 0 0 15px 5px #474747;
font-size: calc(0.6rem + 0.5vw); font-size: calc(0.6rem + 0.5vw);
@@ -181,9 +190,7 @@ export default Vue.extend({
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
padding: 1rem; padding: 1rem;
font-size: calc(1rem + 0.7vw); font-size: calc(1rem + 0.7vw);
cursor: pointer; cursor: pointer;
@@ -196,7 +203,6 @@ export default Vue.extend({
align-items: center; align-items: center;
text-align: center; text-align: center;
padding: 1em; padding: 1em;
& > div { & > div {
@@ -208,7 +214,6 @@ export default Vue.extend({
&-upper { &-upper {
background: #959595; background: #959595;
text-align: center; text-align: center;
padding: 0.2em; padding: 0.2em;
} }
} }
@@ -235,17 +240,16 @@ export default Vue.extend({
} }
&-icons { &-icons {
padding: 0.5rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 0.5rem;
img, img,
span { span {
margin: 0 0.5em;
width: 2.5em; width: 2.5em;
height: 2.5em; height: 2.5em;
margin: 0 0.5em;
} }
span { span {
@@ -257,9 +261,9 @@ export default Vue.extend({
font-weight: bold; font-weight: bold;
user-select: none;
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none;
} }
} }
} }
@@ -271,6 +275,8 @@ export default Vue.extend({
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center;
@include smallScreen() { @include smallScreen() {
flex-direction: column; flex-direction: column;
} }
@@ -280,12 +286,12 @@ export default Vue.extend({
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border: 2px solid #ffbb00;
border-radius: 50%;
font-size: 1.3em;
width: 2em; width: 2em;
height: 2em; height: 2em;
font-size: 1.3em;
border: 2px solid #ffbb00;
border-radius: 50%;
} }
&-name { &-name {
@@ -298,8 +304,6 @@ export default Vue.extend({
margin-left: 0; margin-left: 0;
margin-top: 0.2em; margin-top: 0.2em;
} }
text-align: center;
} }
} }
@@ -327,7 +331,6 @@ export default Vue.extend({
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
&-content { &-content {
@@ -343,7 +346,6 @@ export default Vue.extend({
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
&-content { &-content {
@@ -369,7 +371,6 @@ export default Vue.extend({
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
+4 -2
View File
@@ -2,8 +2,10 @@
<div class="list"> <div class="list">
<Card :stationInfo="focusedStationInfo" :closeCard="closeCard" /> <Card :stationInfo="focusedStationInfo" :closeCard="closeCard" />
<!-- <div class="info">Ups! Brak stacji do wyświetlenia!</div> -->
<div class="table-wrapper"> <div class="table-wrapper">
<table class="table"> <table class="table" v-if="stations.length > 0">
<thead> <thead>
<tr> <tr>
<th>Stacja</th> <th>Stacja</th>
@@ -248,7 +250,7 @@ export default Vue.extend({
font-size: calc(0.6rem + 0.4vw); font-size: calc(0.6rem + 0.4vw);
@include smallScreen() { @include smallScreen() {
font-size: 0.5rem; font-size: 0.65rem;
} }
thead th { thead th {
+3 -4
View File
@@ -12,7 +12,7 @@
<transition name="slide"> <transition name="slide">
<keep-alive> <keep-alive>
<ListFilter v-if="filtersOpen" /> <ListFilter v-if="filtersOpen" :exit="() => filtersOpen = !filtersOpen" />
</keep-alive> </keep-alive>
</transition> </transition>
</div> </div>
@@ -45,15 +45,14 @@ export default Vue.extend({
.slide-enter, .slide-enter,
.slide-leave-to { .slide-leave-to {
transform: translateX(10px); transform: translate(-40%, -50%);
opacity: 0; opacity: 0;
} }
.options { .options {
position: relative;
font-size: calc(0.6rem + 0.9vw); font-size: calc(0.6rem + 0.9vw);
display: flex; // display: flex;
} }
button { button {
+36 -12
View File
@@ -1,5 +1,7 @@
<template> <template>
<div class="list-filter"> <div class="list-filter">
<div class="exit" @click="exitFilters">X</div>
<div class="list-filter-title">FILTRY</div>
<ul class="grid"> <ul class="grid">
<li class="grid-row"> <li class="grid-row">
<div class="grid-col" v-for="(el, i) in gridElements" :key="i"> <div class="grid-col" v-for="(el, i) in gridElements" :key="i">
@@ -275,6 +277,7 @@ export default Vue.extend({
} }
} }
}), }),
props: ["exit"],
methods: { methods: {
...mapActions(["setFilter", "resetFilters"]), ...mapActions(["setFilter", "resetFilters"]),
handleChange(e: any) { handleChange(e: any) {
@@ -303,6 +306,9 @@ export default Vue.extend({
this.twoWayOther = 0; this.twoWayOther = 0;
this.resetFilters(); this.resetFilters();
},
exitFilters() {
this.exit();
} }
} }
}); });
@@ -313,28 +319,46 @@ export default Vue.extend({
@import "../../styles/variables"; @import "../../styles/variables";
.list-filter { .list-filter {
position: absolute; position: fixed;
top: 100%; top: 50%;
left: 0; left: 50%;
padding: 0.3rem;
@include smallScreen() { overflow: auto;
width: 100vw; max-height: 90%;
}
padding: 0.4em;
background: rgba(black, 0.85);
white-space: nowrap; white-space: nowrap;
transform: translate(-50%, -50%);
font-size: calc(0.6rem + 0.4vw); font-size: calc(0.6rem + 0.4vw);
@include smallScreen() { @include smallScreen() {
font-size: 0.65rem; width: 100vw;
font-size: 0.75em;
} }
} }
.grid { .exit {
background: rgba(black, 0.65); position: absolute;
padding: 0.5rem; top: 0;
right: 0;
padding: 0.4rem;
font-size: calc(1rem + 0.4vw);
cursor: pointer;
}
.list-filter-title {
text-align: center;
padding: 0.3rem;
font-size: 1.6em;
font-weight: bold;
}
.grid {
&-row { &-row {
display: flex; display: flex;
justify-content: center; justify-content: center;
+1
View File
@@ -196,6 +196,7 @@ class Store extends VuexModule {
public filterStations() { public filterStations() {
this.filteredStations = this.stations.filter(station => { this.filteredStations = this.stations.filter(station => {
if ((station.nonPublic || !station.reqLevel) && this.filters['nonPublic']) return false; if ((station.nonPublic || !station.reqLevel) && this.filters['nonPublic']) return false;
if (!station.reqLevel) return true; if (!station.reqLevel) return true;