Poprawki w tabeli scenerii

This commit is contained in:
2020-12-06 19:50:24 +01:00
parent 229621b875
commit 8d604826ff
3 changed files with 60 additions and 20 deletions
-7
View File
@@ -61,13 +61,6 @@ export default class App extends Vue {
private VERSION = "1.3.4"; private VERSION = "1.3.4";
get dataStatusClass() {
if (this.data.dataConnectionStatus == 0) return "loading";
if (this.data.dataConnectionStatus == 1) return "error";
return "";
}
mounted() { mounted() {
this.synchronizeData(); this.synchronizeData();
} }
+22 -9
View File
@@ -33,7 +33,7 @@
class="station" class="station"
v-for="(station, i) in stations" v-for="(station, i) in stations"
:key="i + station.stationHash" :key="i + station.stationHash"
@click="setScenery(station.stationHash)" @click="() => setScenery(station.stationName)"
> >
<td <td
class="station_name" class="station_name"
@@ -131,7 +131,7 @@
/> />
</td> </td>
<td class="station_users"> <td class="station_users" :class="{inactive: !station.online }">
<span> <span>
<span class="highlight">{{ station.currentUsers }}</span> <span class="highlight">{{ station.currentUsers }}</span>
/ /
@@ -139,11 +139,11 @@
</span> </span>
</td> </td>
<td class="station_spawns"> <td class="station_spawns" :class="{inactive: !station.online }">
<span class="highlight">{{ station.spawns.length }}</span> <span class="highlight">{{ station.spawns.length }}</span>
</td> </td>
<td class="station_schedules"> <td class="station_schedules" :class="{inactive: !station.online }">
<span class="highlight">{{station.scheduledTrains.length}} &nbsp;</span> <span class="highlight">{{station.scheduledTrains.length}} &nbsp;</span>
/ /
<span <span
@@ -205,19 +205,22 @@ export default class StationTable extends styleMixin {
[this.timetableIcon, "Aktywne RJ"], [this.timetableIcon, "Aktywne RJ"],
]; ];
setScenery(sceneryHash: string) { setScenery(name: string) {
const station = this.stations.find( const station = this.stations.find(
(station) => station.stationHash === sceneryHash (station) => station.stationName === name
); );
if (!station) return; if (!station) return;
if (!station.online) { if (!station.online) {
location.href = station.stationURL; window.location.href = station.stationURL;
return; return;
} }
this.$router.push({ name: "SceneryView", query: { hash: sceneryHash } }); this.$router.push({
name: "SceneryView",
query: { hash: station.stationHash },
});
} }
} }
</script> </script>
@@ -263,13 +266,15 @@ table {
white-space: nowrap; white-space: nowrap;
border-collapse: collapse; border-collapse: collapse;
min-width: 1000px;
thead th { thead th {
position: sticky; position: sticky;
top: 0; top: 0;
min-width: 85px; min-width: 85px;
padding: 0.3rem; padding: 0.5em;
background-color: $primaryCol; background-color: $primaryCol;
cursor: pointer; cursor: pointer;
@@ -359,6 +364,14 @@ td.station {
padding: 0.5em; padding: 0.5em;
} }
} }
&_users,
&_spawns,
&_schedules {
&.inactive {
opacity: 0.2;
}
}
} }
.separator { .separator {
+38 -4
View File
@@ -16,13 +16,21 @@
<div class="bar_indicators"> <div class="bar_indicators">
<transition name="indicator-anim"> <transition name="indicator-anim">
<span class="indicator_scenery-data" v-if="data.dataConnectionStatus < 2"> <span
class="indicator_scenery-data"
v-if="data.dataConnectionStatus < 2"
:class="dataStatusClass"
>
<img :src="trainIcon" alt="icon-train" /> <img :src="trainIcon" alt="icon-train" />
</span> </span>
</transition> </transition>
<transition name="indicator-anim"> <transition name="indicator-anim">
<span class="indicator_timetable-data" v-if="data.timetableDataStatus < 2"> <span
class="indicator_timetable-data"
v-if="data.timetableDataStatus < 2"
:class="timetableDataStatusClass"
>
<img :src="timetableIcon" alt="icon-timetable" /> <img :src="timetableIcon" alt="icon-timetable" />
</span> </span>
</transition> </transition>
@@ -115,6 +123,20 @@ export default class StationsView extends Vue {
@Getter("getStationList") stationList!: Station[]; @Getter("getStationList") stationList!: Station[];
@Getter("getAllData") data; @Getter("getAllData") data;
get dataStatusClass() {
if (this.data.dataConnectionStatus == 0) return "loading";
if (this.data.dataConnectionStatus == 1) return "error";
return "success";
}
get timetableDataStatusClass() {
if (this.data.timetableDataStatus == 0) return "loading";
if (this.data.timetableDataStatus == 1) return "error";
return "success";
}
mounted() { mounted() {
const storage = window.localStorage; const storage = window.localStorage;
@@ -368,7 +390,7 @@ export default class StationsView extends Vue {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
& > span { > span {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -378,9 +400,21 @@ export default class StationsView extends Vue {
margin-left: 0.5em; margin-left: 0.5em;
background-color: #e68e00; // background-color: #e68e00;
border-radius: 0.5em 0.5em 0 0; border-radius: 0.5em 0.5em 0 0;
&.loading {
background-color: $accentCol;
}
&.error {
background-color: $errorCol;
}
&.success {
background-color: $secondaryCol;
}
& > img { & > img {
width: 0.9em; width: 0.9em;
animation: blinkAnim 2s ease-in-out infinite forwards; animation: blinkAnim 2s ease-in-out infinite forwards;