-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-pad-feedback.vue
204 lines (197 loc) · 8.27 KB
/
app-pad-feedback.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!--
**
** HUDS - Head-Up-Display Server (HUDS)
** Copyright (c) 2022-2024 Dr. Ralf S. Engelschall <[email protected]>
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
-->
<template>
<section class="app-pad-feedback">
<h2 style="grid-area: title">
{{ $t("feedback.feedback-label") }}
<span v-show="isFeedbackDisabled" class="disabled">
{{ $t("feedback.disabled-label") }}
</span>
</h2>
<button style="grid-area: button1"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.consent-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('thumbsup')">
<i class="icon positive fas fa-thumbs-up"></i>
<div class="title positive">{{ $t("feedback.consent-label") }}</div>
</button>
<button style="grid-area: button2"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.refusal-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('thumbsdn')">
<i class="icon fas fa-thumbs-down"></i>
<div class="title">{{ $t("feedback.refusal-label") }}</div>
</button>
<button style="grid-area: button3"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.surprise-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('surprise')">
<i class="icon positive fas fa-surprise"></i>
<div class="title positive">{{ $t("feedback.surprise-label") }}</div>
</button>
<button style="grid-area: button4"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.smile-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('smile')">
<i class="icon positive fas fa-grin-wink"></i>
<div class="title positive">{{ $t("feedback.smile-label") }}</div>
</button>
<button style="grid-area: button5"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.frown-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('frown')">
<i class="icon fas fa-angry"></i>
<div class="title">{{ $t("feedback.frown-label") }}</div>
</button>
<button style="grid-area: button6"
v-bind:disabled="isFeedbackDisabled"
v-tippy="{ placement: 'top', content: $t('feedback.sadness-hint'), trigger: $global.value.tippyTrigger }"
@click="sendFeedback('sadness')">
<i class="icon fas fa-sad-tear"></i>
<div class="title">{{ $t("feedback.sadness-label") }}</div>
</button>
</section>
</template>
<i18n lang="yaml">
en:
feedback:
feedback-label: FEEDBACK
disabled-label: (temporarily disabled for throttling reasons)
consent-label: Consent
consent-hint: Indicate your consent with<br/>the current content.
refusal-label: Refusal
refusal-hint: Indicate your refusal with<br/>the current content.
surprise-label: Surprise
surprise-hint: Indicate your surprise with<br/>the current content.
smile-label: Smile
smile-hint: Indicate your smile with<br/>the current content.
frown-label: Frown
frown-hint: Indicate your frown with<br/>the current content.
sadness-label: Sadness
sadness-hint: Indicate your sadness with<br/>the current content.
de:
feedback:
feedback-label: RÜCKMELDUNG
disabled-label: (vorläufig gesperrt aus Drosselungsgründen)
consent-label: Zustimmung
consent-hint: Zeige deine Zustimmung<br/>zum actuellen Inhalt.
refusal-label: Ablehnung
refusal-hint: Zeige deine Ablehnung<br/>zum aktuellen Inhalt.
surprise-label: Überraschung
surprise-hint: Zeige deine Überraschung<br/>zum aktuellen Inhalt.
smile-label: Lächeln
smile-hint: Zeige dein Lächeln<br/>zum aktuellen Inhalt.
frown-label: Stirnrunzeln
frown-hint: Zeige dein Stirnrunzeln<br/>zum aktuellen Inhalt.
sadness-label: Traurigkeit
sadness-hint: Zeige deine Traurigkeit<br/>zum aktuellen Inhalt.
</i18n>
<style lang="stylus">
.app-pad-feedback
display: grid
grid-template: "title title title title title title" "button1 button2 button3 button4 button5 button6"
grid-template-columns: repeat(6, minmax(45px, 1fr))
grid-gap: 2px
.disabled
font-size: 9pt
font-weight: 300
color: var(--color-acc-fg-3)
margin-left: 4px
button
cursor: pointer
color: var(--color-std-fg-3)
background-color: var(--color-std-bg-4)
border-top: 1px solid var(--color-std-bg-5)
border-left: 1px solid var(--color-std-bg-5)
border-right: 1px solid var(--color-std-bg-1)
border-bottom: 1px solid var(--color-std-bg-1)
border-radius: 4px
font-size: 22pt
text-align: center
line-height: 0
padding: 8px 0
.icon
width: 100%
padding-bottom: 6px
&.positive
color: var(--color-acc-fg-3)
.title
font-weight: normal
font-size: 8pt
text-align: center
line-height: 8pt
overflow: hidden
text-overflow: ellipsis
&.positive
color: var(--color-acc-fg-3)
.hoverable &:hover:not(:disabled)
border: 0
outline: none
color: var(--color-acc-fg-5)
background-color: var(--color-acc-bg-3)
border-top: 1px solid var(--color-acc-bg-5)
border-left: 1px solid var(--color-acc-bg-5)
border-right: 1px solid var(--color-acc-bg-1)
border-bottom: 1px solid var(--color-acc-bg-1)
&:disabled
cursor: not-allowed
color: var(--color-std-fg-0)
background-color: var(--color-std-bg-3)
border-top: 1px solid var(--color-std-bg-5)
border-left: 1px solid var(--color-std-bg-5)
border-right: 1px solid var(--color-std-bg-1)
border-bottom: 1px solid var(--color-std-bg-1)
.icon
color: var(--color-std-fg-0)
&.positive
color: var(--color-acc-fg-0)
.title
color: var(--color-std-fg-0)
&.positive
color: var(--color-acc-fg-0)
</style>
<script setup lang="ts">
import { defineComponent } from "vue"
</script>
<script lang="ts">
export default defineComponent({
name: "app-pad-feedback",
data: () => ({
isFeedbackDisabled: false
}),
methods: {
sendFeedback (value: string) {
if (this.isFeedbackDisabled)
return
this.isFeedbackDisabled = true
this.huds.sendFeedback(value)
setTimeout(() => {
this.isFeedbackDisabled = false
}, 30 * 1000)
}
}
})
</script>