Переглянути джерело

:construction: Finished up custom invalid input messages to user on survey

tags/0.0.3^2
tomit4 3 роки тому
джерело
коміт
3340a568e8

+ 9
- 7
frontend/src/components/onboarding/QuestionResponse.vue Переглянути файл

@@ -1,12 +1,13 @@
1 1
 <template lang="pug">
2 2
 w-card.question
3
+    p {{ question }}
3 4
     p {{question.question}} 
4 5
     section.radio-buttons.w-flex.row.justify-space-between
5 6
         p(v-for="label in question.labels") {{label}}
6 7
     w-radios.w-flex.row.justify-space-between(@update:model-value="onUpdate" :items="radioItems" color="red")
7 8
     w-button.ma1.grow(v-if='question.id !== 6' @click="updateAnswers") NEXT
8 9
     w-button.ma1.grow(v-else @click="updateAll") SUBMIT ANSWERS
9
-
10
+    p(v-if='noChoiceMade') Tough choices, we know! Just answer to the best of your ability. The team over at Siimee values the answers you provide us so that we can show you results catered to your specific needs.
10 11
 </template>
11 12
 
12 13
 <script>
@@ -26,23 +27,24 @@ export default {
26 27
             { answer: 4 },
27 28
             { answer: 5 },
28 29
         ],
29
-        isAnswered: false
30
+        isAnswered: false,
31
+        noChoiceMade: null,
30 32
     }),
31 33
     methods: {
32 34
         onUpdate(e) {
33 35
             this.isAnswered = true
36
+            this.noChoiceMade = false
34 37
             this.$emit('updated', { ...this.question, answer: e + 1 })
35 38
         },
36
-        // TODO: render message to user on why they cannot proceed
37 39
         updateAnswers() {
38 40
             this.isAnswered ?
39 41
             this.$emit('update-is-answered', this.question.id) :
40
-            console.error('no selection made')
42
+            this.noChoiceMade = true
41 43
         },
42 44
         updateAll() {
43
-            this.isAnswered ? 
44
-            this.$emit('update-all') : 
45
-            console.error('no selection made')
45
+            this.isAnswered ?
46
+            this.$emit('update-all') :
47
+            this.noChoiceMade = true
46 48
         }
47 49
     },
48 50
 }

Завантаження…
Відмінити
Зберегти