瀏覽代碼

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

tags/0.0.3^2
tomit4 3 年之前
父節點
當前提交
22426aff2d

+ 0
- 4
frontend/src/components/onboarding/FormDropdown.vue 查看文件

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

+ 29
- 8
frontend/src/utils/lang.js 查看文件

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?:",
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
     blurb: "Please provide us with a short blurb about yourself. What's your backstory?:",
93
     blurb: "Please provide us with a short blurb about yourself. What's your backstory?:",
94
     image: "Hey, you're almost done! Please provide an image of yourself so others can recognize you if you ever meet up IRL:",
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
 const inputPlaceholders = {
108
 const inputPlaceholders = {
107
     zipcode: '90012',
111
     zipcode: '90012',
108
     password: 'supersecr3tp@ssword',
112
     password: 'supersecr3tp@ssword',
109
     blurb: 'my backstory starts long long ago...',
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
 export {
133
 export {
114
     promptOverrides,
134
     promptOverrides,
115
     inputPlaceholders,
135
     inputPlaceholders,
136
+    invalidInputPrompts,
116
     allSteps,
137
     allSteps,
117
     aspectResponses,
138
     aspectResponses,
118
     possible,
139
     possible,

+ 2
- 1
frontend/src/utils/survey.js 查看文件

1
 import { Survey } from '../entities/index.js'
1
 import { Survey } from '../entities/index.js'
2
 import { fetchQuestions } from '../services/index.js'
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
 const promptToComponent = {
5
 const promptToComponent = {
6
     splash: 'Splash',
6
     splash: 'Splash',
70
                 const langStub = responseKeyLike.response_key_prompt
70
                 const langStub = responseKeyLike.response_key_prompt
71
                 withComponent.response_key_prompt = promptOverrides[langStub]
71
                 withComponent.response_key_prompt = promptOverrides[langStub]
72
                 withComponent.placeholder = inputPlaceholders[langStub]
72
                 withComponent.placeholder = inputPlaceholders[langStub]
73
+                withComponent.invalidInputPrompt = invalidInputPrompts[langStub]
73
                 withComponent.survey_stage = langStub
74
                 withComponent.survey_stage = langStub
74
             }
75
             }
75
 
76
 

+ 14
- 4
frontend/src/views/OnboardingView.vue 查看文件

19
                 @update-answers='updateAnswers'
19
                 @update-answers='updateAnswers'
20
                 v-if='step && currentStep == i'
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
         footer
28
         footer
24
             p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / {{ survey.steps.length -2 }} survey steps
29
             p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / {{ survey.steps.length -2 }} survey steps
25
-    
30
+
26
     article(v-else)
31
     article(v-else)
27
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
32
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
28
 </template>
33
 </template>
47
         currentStep: 0,
52
         currentStep: 0,
48
         survey: null,
53
         survey: null,
49
         incomplete: true,
54
         incomplete: true,
55
+        invalidResponse: false,
50
     }),
56
     }),
51
     async created() {
57
     async created() {
52
         this.survey = await surveyFactory.createSurvey(allSteps['usa'])
58
         this.survey = await surveyFactory.createSurvey(allSteps['usa'])
62
         updateAnswers(payload) {
68
         updateAnswers(payload) {
63
             // null payload is passed on splash page
69
             // null payload is passed on splash page
64
             if (payload) {
70
             if (payload) {
71
+                console.log('payload >>', payload)
72
+                this.invalidResponse = false
65
                 const k = payload.question.survey_stage
73
                 const k = payload.question.survey_stage
66
                 this.answered[k] = payload.input
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
                 // once validated, don't log password in answered object
81
                 // once validated, don't log password in answered object
72
                 this.answered[k] = k === 'password' ? undefined : payload.input 
82
                 this.answered[k] = k === 'password' ? undefined : payload.input 

Loading…
取消
儲存