mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 05:48:11 +00:00
Dodano podświetlenie rangi supportera w karcie stacji
This commit is contained in:
@@ -80,8 +80,8 @@
|
|||||||
<div class="dispatcher">
|
<div class="dispatcher">
|
||||||
<div
|
<div
|
||||||
class="dispatcher-level flex"
|
class="dispatcher-level flex"
|
||||||
:style="calculateExpStyle(stationInfo.dispatcherExp)"
|
:style="calculateExpStyle(stationInfo.dispatcherExp, stationInfo.dispatcherIsSupporter)"
|
||||||
>{{stationInfo.online ? computedExp : ""}}</div>
|
>{{stationInfo.online ? computedDispatcherExp : ""}}</div>
|
||||||
<div class="dispatcher-info">
|
<div class="dispatcher-info">
|
||||||
<div class="dispatcher-name">
|
<div class="dispatcher-name">
|
||||||
<a
|
<a
|
||||||
@@ -175,7 +175,7 @@ export default class StationCard extends styleMixin {
|
|||||||
|
|
||||||
cardMode: number = 0;
|
cardMode: number = 0;
|
||||||
|
|
||||||
get computedExp(): string {
|
get computedDispatcherExp(): string {
|
||||||
return this.stationInfo.dispatcherExp < 2
|
return this.stationInfo.dispatcherExp < 2
|
||||||
? "L"
|
? "L"
|
||||||
: `${this.stationInfo.dispatcherExp}`;
|
: `${this.stationInfo.dispatcherExp}`;
|
||||||
|
|||||||
+38
-43
@@ -1,52 +1,47 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue';
|
||||||
import Component from 'vue-class-component'
|
import Component from 'vue-class-component';
|
||||||
|
|
||||||
// You can declare mixins as the same style as components.
|
// You can declare mixins as the same style as components.
|
||||||
@Component
|
@Component
|
||||||
export default class styleMixin extends Vue {
|
export default class styleMixin extends Vue {
|
||||||
calculateExpStyle(exp: string | number): string {
|
calculateExpStyle(exp: string | number, isSupporter: boolean = false): string {
|
||||||
const bgColor =
|
const bgColor = exp > -1 ? (exp < 2 ? '#26B0D9' : `hsl(${-exp * 5 + 100}, 65%, 50%)`) : '#888';
|
||||||
exp > -1
|
|
||||||
? exp < 2
|
|
||||||
? "#26B0D9"
|
|
||||||
: `hsl(${-exp * 5 + 100}, 65%, 50%)`
|
|
||||||
: "#888";
|
|
||||||
|
|
||||||
const fontColor = exp > 15 ? "white" : "black";
|
const fontColor = exp > 15 ? 'white' : 'black';
|
||||||
|
const boxShadow = isSupporter ? `box-shadow: 0 0 10px 2px ${bgColor}` : '';
|
||||||
|
|
||||||
return `backgroundColor: ${bgColor}; color: ${fontColor}`;
|
return `backgroundColor: ${bgColor}; color: ${fontColor}; ${boxShadow};`;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusClasses(occupiedTo: string) {
|
||||||
|
let className = '';
|
||||||
|
|
||||||
|
switch (occupiedTo) {
|
||||||
|
case 'WOLNA':
|
||||||
|
className = 'free';
|
||||||
|
break;
|
||||||
|
case 'KOŃCZY':
|
||||||
|
className = 'ending';
|
||||||
|
break;
|
||||||
|
case 'NIEZALOGOWANY':
|
||||||
|
className = 'not-signed';
|
||||||
|
break;
|
||||||
|
case 'BEZ LIMITU':
|
||||||
|
className = 'no-limit';
|
||||||
|
break;
|
||||||
|
case 'NIEDOSTĘPNY':
|
||||||
|
className = 'unavailable';
|
||||||
|
break;
|
||||||
|
case 'Z/W':
|
||||||
|
className = 'brb';
|
||||||
|
break;
|
||||||
|
case 'BRAK MIEJSCA':
|
||||||
|
className = 'no-space';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return className;
|
||||||
statusClasses(occupiedTo: string) {
|
}
|
||||||
let className = "";
|
|
||||||
|
|
||||||
switch (occupiedTo) {
|
|
||||||
case "WOLNA":
|
|
||||||
className = "free";
|
|
||||||
break;
|
|
||||||
case "KOŃCZY":
|
|
||||||
className = "ending";
|
|
||||||
break;
|
|
||||||
case "NIEZALOGOWANY":
|
|
||||||
className = "not-signed";
|
|
||||||
break;
|
|
||||||
case "BEZ LIMITU":
|
|
||||||
className = "no-limit";
|
|
||||||
break;
|
|
||||||
case "NIEDOSTĘPNY":
|
|
||||||
className = "unavailable";
|
|
||||||
break;
|
|
||||||
case "Z/W":
|
|
||||||
className = "brb";
|
|
||||||
break;
|
|
||||||
case "BRAK MIEJSCA":
|
|
||||||
className = "no-space";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return className;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export default interface Station {
|
|||||||
dispatcherName: string;
|
dispatcherName: string;
|
||||||
dispatcherExp: number;
|
dispatcherExp: number;
|
||||||
dispatcherId: number;
|
dispatcherId: number;
|
||||||
|
dispatcherIsSupporter: boolean;
|
||||||
stationLines: string;
|
stationLines: string;
|
||||||
stationProject: string;
|
stationProject: string;
|
||||||
reqLevel: string;
|
reqLevel: string;
|
||||||
|
|||||||
+6
-1
@@ -223,6 +223,7 @@ export default class Store extends VuexModule {
|
|||||||
dispatcherRate: station.dispatcherRate,
|
dispatcherRate: station.dispatcherRate,
|
||||||
dispatcherId: station.dispatcherId,
|
dispatcherId: station.dispatcherId,
|
||||||
dispatcherExp: station.dispatcherExp,
|
dispatcherExp: station.dispatcherExp,
|
||||||
|
dispatcherIsSupporter: station.dispatcherIsSupporter,
|
||||||
occupiedTo: statusLabel,
|
occupiedTo: statusLabel,
|
||||||
stationTrains,
|
stationTrains,
|
||||||
statusTimestamp,
|
statusTimestamp,
|
||||||
@@ -282,6 +283,7 @@ export default class Store extends VuexModule {
|
|||||||
dispatcherRate: 0,
|
dispatcherRate: 0,
|
||||||
dispatcherExp: -1,
|
dispatcherExp: -1,
|
||||||
dispatcherId: 0,
|
dispatcherId: 0,
|
||||||
|
dispatcherIsSupporter: false,
|
||||||
online: false,
|
online: false,
|
||||||
occupiedTo: 'WOLNA',
|
occupiedTo: 'WOLNA',
|
||||||
statusTimestamp: -3,
|
statusTimestamp: -3,
|
||||||
@@ -315,9 +317,12 @@ export default class Store extends VuexModule {
|
|||||||
dispatcherRate: 0,
|
dispatcherRate: 0,
|
||||||
dispatcherExp: -1,
|
dispatcherExp: -1,
|
||||||
dispatcherId: 0,
|
dispatcherId: 0,
|
||||||
|
dispatcherIsSupporter: false,
|
||||||
|
online: false,
|
||||||
occupiedTo: 'WOLNA',
|
occupiedTo: 'WOLNA',
|
||||||
statusTimestamp: -3,
|
statusTimestamp: -3,
|
||||||
online: false,
|
stationTrains: [],
|
||||||
|
scheduledTrains: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
Reference in New Issue
Block a user