Przeglądaj źródła

:construction: Added rendered response messages if invalid input passed in survey

tags/0.0.3^2
tomit4 3 lat temu
rodzic
commit
22426aff2d

+ 0
- 4
frontend/src/components/onboarding/FormDropdown.vue Wyświetl plik

@@ -25,10 +25,6 @@ export default {
25 25
     },
26 26
     methods: {
27 27
         handleSubmit() {
28
-            if (!this.selection) {
29
-                console.warn('Please select a role.')
30
-                return
31
-            }
32 28
             let payload = {
33 29
                 question: this.question,
34 30
                 input: this.selection,

+ 29
- 8
frontend/src/utils/lang.js Wyświetl plik

@@ -92,13 +92,17 @@ const promptOverrides = {
92 92
         "Looking good so far! You're doing great. The next piece of info we'll need is your zip code. That way we can be sure to only show you other people in your area. What's your zip code?:",
93 93
     blurb: "Please provide us with a short blurb about yourself. What's your backstory?:",
94 94
     image: "Hey, you're almost done! Please provide an image of yourself so others can recognize you if you ever meet up IRL:",
95
-    seeking: "Alright, let's continue! What are you seeking? Are you looking to find a position to be employed in, or are you looking to employ a candidate?",
96
-    pronouns: "When others refer to you, what pronouns do you prefer they use?:",
97
-    urgency: "How soon do you need the position filled or you need to be employed?",
98
-    presence: "Would you prefer remote, hybrid, in-person work?",
99
-    duration: "What kind of duration would you prefer? Are you looking for part-time, full-time, other?",
100
-    language: "Your native language is?...",
101
-    distance: "What distance from your home are you looking to work in?",
95
+    seeking:
96
+        "Alright, let's continue! What are you seeking? Are you looking to find a position to be employed in, or are you looking to employ a candidate?",
97
+    pronouns:
98
+        'When others refer to you, what pronouns do you prefer they use?:',
99
+    urgency:
100
+        'How soon do you need the position filled or you need to be employed?',
101
+    presence: 'Would you prefer remote, hybrid, in-person work?',
102
+    duration:
103
+        'What kind of duration would you prefer? Are you looking for part-time, full-time, other?',
104
+    language: 'Your native language is?...',
105
+    distance: 'What distance from your home are you looking to work in?',
102 106
 }
103 107
 
104 108
 const inputPlaceholders = {
@@ -107,12 +111,29 @@ const inputPlaceholders = {
107 111
     zipcode: '90012',
108 112
     password: 'supersecr3tp@ssword',
109 113
     blurb: 'my backstory starts long long ago...',
110
-    distance: '5 mi'
114
+    distance: '5 mi',
115
+}
116
+
117
+const invalidInputPrompts = {
118
+    name: "So sorry, but what's your name?",
119
+    email: "It looks like that email isn't valid, try en email that is formatted like so: joe@joe.com",
120
+    password: "That password doesn't fit our requirements, please follow the above instructions to generate a secure password.",
121
+    zipcode: "Oops! That isn't a recognized zipcode, please enter a 5 digit zipcode like: 97869",
122
+    blurb: "Whoa! Cool story. Unfortunately your backstory is either too long or too short. Please tell us a bit about yourself between 1 and 100 characters.",
123
+    image: "It appears you didn't upload an image. Please provide Siimee with an image in case you want to show others what you look like.",
124
+    seeking: "In order to provide you with the best results, Siimee will need to know whether you're an employer looking to fill a position, or a candidate looking for an employment. Please take a look at our above options and choose one.",
125
+    pronouns: "Ensuring that others on our platform are aware of what your preferred pronouns are is important to us. Please choose from one of the above options.",
126
+    urgency: "Looks like you left this field blank. Take a look at our provided options and tell us when you'd like be employed.",
127
+    presence: "Hold up! So sorry to put a pause here, but it looks like you haven't chosen whether to work remotely or in person. No worries, if you're unsure, just choose the 'flexible' option.",
128
+    duration: "Looks like you haven't filled out what kind of work you're most interested in. As in, part-time, full-time. Take a look at our above options and choose whatever feels right for you right now. You can always edit them later!",
129
+    language: "We try our best to provide results in the language of your choosing. ¿Prefieres ver resultados en español? Or would you prefer to see results in english?",
130
+    distance: "Whoa! You either left this field blank or tried to input an astronomically large distance you'd like to see results from. Please input a distance you'd like to see results in.",
111 131
 }
112 132
 
113 133
 export {
114 134
     promptOverrides,
115 135
     inputPlaceholders,
136
+    invalidInputPrompts,
116 137
     allSteps,
117 138
     aspectResponses,
118 139
     possible,

+ 2
- 1
frontend/src/utils/survey.js Wyświetl plik

@@ -1,6 +1,6 @@
1 1
 import { Survey } from '../entities/index.js'
2 2
 import { fetchQuestions } from '../services/index.js'
3
-import { promptOverrides, inputPlaceholders, possible } from './lang.js'
3
+import { promptOverrides, inputPlaceholders, invalidInputPrompts ,possible } from './lang.js'
4 4
 
5 5
 const promptToComponent = {
6 6
     splash: 'Splash',
@@ -70,6 +70,7 @@ class SurveyFactory {
70 70
                 const langStub = responseKeyLike.response_key_prompt
71 71
                 withComponent.response_key_prompt = promptOverrides[langStub]
72 72
                 withComponent.placeholder = inputPlaceholders[langStub]
73
+                withComponent.invalidInputPrompt = invalidInputPrompts[langStub]
73 74
                 withComponent.survey_stage = langStub
74 75
             }
75 76
 

+ 14
- 4
frontend/src/views/OnboardingView.vue Wyświetl plik

@@ -19,10 +19,15 @@ main.view--onboarding
19 19
                 @update-answers='updateAnswers'
20 20
                 v-if='step && currentStep == i'
21 21
             )
22
-            
22
+        .invalidResponseMessage(
23
+            style='text-align: center'
24
+            v-if='invalidResponse'
25
+        )
26
+            p {{ survey.steps[currentStep].invalidInputPrompt }}
27
+
23 28
         footer
24 29
             p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / {{ survey.steps.length -2 }} survey steps
25
-    
30
+
26 31
     article(v-else)
27 32
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
28 33
 </template>
@@ -47,6 +52,7 @@ export default {
47 52
         currentStep: 0,
48 53
         survey: null,
49 54
         incomplete: true,
55
+        invalidResponse: false,
50 56
     }),
51 57
     async created() {
52 58
         this.survey = await surveyFactory.createSurvey(allSteps['usa'])
@@ -62,11 +68,15 @@ export default {
62 68
         updateAnswers(payload) {
63 69
             // null payload is passed on splash page
64 70
             if (payload) {
71
+                console.log('payload >>', payload)
72
+                this.invalidResponse = false
65 73
                 const k = payload.question.survey_stage
66 74
                 this.answered[k] = payload.input
67 75
 
68
-                // TODO: render message to user on why they cannot proceed
69
-                if (!this.survey.validateAnswer(this.answered)) return 
76
+                if (!this.survey.validateAnswer(this.answered)) {
77
+                    this.invalidResponse = true
78
+                    return
79
+                }
70 80
 
71 81
                 // once validated, don't log password in answered object
72 82
                 this.answered[k] = k === 'password' ? undefined : payload.input 

Ładowanie…
Anuluj
Zapisz