-
-
Notifications
You must be signed in to change notification settings - Fork 858
/
BottomStatusIcons.vue
137 lines (134 loc) · 3.36 KB
/
BottomStatusIcons.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<div class="bottomStatusIcons">
<div
i18n_title="mainHelpArmed"
class="armedicon cf_tip i18n_title-replaced"
:class="{ active: setActiveArmed }"
/>
<div
i18n_title="mainHelpFailsafe"
class="failsafeicon cf_tip i18n_title-replaced"
:class="{ active: setFailsafeActive }"
/>
<div
i18n_title="mainHelpLink"
class="linkicon cf_tip i18n_title-replaced"
:class="{ active: setActiveLink }"
/>
</div>
</template>
<script>
import { bit_check } from "../../js/bit";
export default {
props: {
lastReceivedTimestamp: { type: Number, default: 0 },
mode: { type: Number, default: 0 },
auxConfig: { type: Object, default: null },
},
computed: {
setActiveArmed() {
if (!this.auxConfig?.length) {
return false;
}
if (
this.auxConfig.includes("ARM") &&
bit_check(this.mode, this.auxConfig.indexOf("ARM"))
) {
return true;
}
return false;
},
setFailsafeActive() {
if (!this.auxConfig?.length) {
return false;
}
if (
this.auxConfig.includes("FAILSAFE") &&
bit_check(this.mode, this.auxConfig.indexOf("FAILSAFE"))
) {
return true;
}
return false;
},
setActiveLink() {
const active = performance.now() - this.lastReceivedTimestamp < 300;
if (active) {
return true;
}
return false;
},
},
};
</script>
<style scoped>
.bottomStatusIcons {
display: flex;
justify-content: space-between;
background-color: #272727;
height: 31px;
max-width: 105px;
margin-top: 2px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
button {
padding: 0.5em 0.75em;
border-radius: 4px;
background-color: #ccc;
color: #666;
border: 1px solid var(--subtleAccent);
font-weight: 600;
font-size: 10pt;
cursor: pointer;
}
button.active {
background-color: var(--accent);
border: 1px solid #dba718;
color: #000;
}
.armedicon {
margin-left: 8px;
margin-right: 8px;
margin-top: 6px;
height: 18px;
width: 18px;
opacity: 0.8;
background-size: contain;
background-position: center;
transition: none;
background-image: url(../../images/icons/cf_icon_armed_grey.svg);
}
.failsafeicon {
margin-left: 8px;
margin-right: 8px;
margin-top: 6px;
height: 18px;
width: 18px;
opacity: 0.8;
background-size: contain;
background-position: center;
transition: none;
background-image: url(../../images/icons/cf_icon_failsafe_grey.svg);
}
.linkicon {
margin-left: 8px;
margin-right: 8px;
margin-top: 6px;
height: 18px;
width: 18px;
opacity: 0.8;
background-size: contain;
background-position: center;
transition: none;
background-image: url(../../images/icons/cf_icon_link_grey.svg);
}
.armedicon.active {
background-image: url(../../images/icons/cf_icon_armed_active.svg);
}
.failsafeicon.active {
background-image: url(../../images/icons/cf_icon_failsafe_active.svg);
}
.linkicon.active {
background-image: url(../../images/icons/cf_icon_link_active.svg);
}
</style>