Просмотр исходного кода

:recycle: Extended refactoring to other onboarding components

tabs-content
tomit4 3 лет назад
Родитель
Сommit
d0e95e94c5

+ 2
- 2
frontend/src/components/onboarding/Aspects.vue Просмотреть файл

@@ -38,9 +38,9 @@ export default {
38 38
             this.$emit('update-answers', {
39 39
                 key: 'Aspects',
40 40
                 question: {
41
-                    response_key_prompt: 'aspects',
41
+                    survey_stage: 'aspects'
42 42
                 },
43
-                answer: answered,
43
+                input: answered,
44 44
             })
45 45
         },
46 46
     },

+ 2
- 3
frontend/src/components/onboarding/FormDropdown.vue Просмотреть файл

@@ -1,7 +1,6 @@
1 1
 <template lang="pug">
2 2
 .role
3
-    h3 {{ question.response_key_category }}
4
-    p {{ question.response_key_prompt }}
3
+    span {{ question.response_key_prompt }}
5 4
     w-select.mt4(:items='items' placeholder='i am' v-model='selection')
6 5
     w-button.ma1.grow(@click='handleSubmit') NEXT
7 6
 </template>
@@ -32,7 +31,7 @@ export default {
32 31
             }
33 32
             let payload = {
34 33
                 question: this.question,
35
-                answer: this.selection,
34
+                input: this.selection,
36 35
             }
37 36
             this.$emit('update-answers', payload)
38 37
         },

+ 12
- 13
frontend/src/components/onboarding/FormInput.vue Просмотреть файл

@@ -1,8 +1,12 @@
1 1
 <template lang="pug">
2 2
 .form-input
3 3
     span {{ question.response_key_prompt }}
4
-    input(:placeholder='question.placeholder' type='text' v-model='input')
5
-    w-button.ma1.grow(@click="this.$emit('update-answers', { question, input })") NEXT
4
+    input(v-if="question.survey_stage !== 'image' && question.survey_stage !== 'blurb'" :placeholder='question.placeholder' type='text' v-model='input')
5
+    w-button.ma1.grow(v-else-if="question.survey_stage == 'image'" @click="submitImage") UPLOAD IMAGE
6
+    textarea(v-else-if="question.survey_stage == 'blurb'" rows="4" cols="50"
7
+            v-model='input' :placeholder="`${question.placeholder}`")
8
+    w-button.ma1.grow(@click="handleSubmit({ question, input })") NEXT
9
+    
6 10
 </template>
7 11
 <script>
8 12
 export default {
@@ -18,22 +22,17 @@ export default {
18 22
         input: null,
19 23
     }),
20 24
     methods: {
21
-        handleSubmit() {
22
-            if (this.question.response_key_prompt === 'password') {
23
-                this.$emit('update-answers') // no password collection
24
-                return
25
+        handleSubmit(answerInfo) {
26
+            if (answerInfo.question.survey_stage === 'password') {
27
+                this.$emit('update-answers') // don't reveal password here...
28
+            } else {
29
+                this.$emit('update-answers', answerInfo)
25 30
             }
26
-
27
-            let payload = {
28
-                question: this.question,
29
-                answer: this.input,
30
-            }
31
-            this.$emit('update-answers', payload)
32 31
         },
33 32
         submitImage() {
34 33
             let payload = {
35 34
                 question: this.question,
36
-                answer: 'placeholder for image',
35
+                input: 'placeholder for image',
37 36
             }
38 37
             this.$emit('update-answers', payload)
39 38
         },

+ 24
- 14
frontend/src/utils/lang.js Просмотреть файл

@@ -7,19 +7,19 @@ const allSteps = {
7 7
         name: 'name',
8 8
         email: 'email',
9 9
         password: 'password',
10
-        // pronouns: 'pronouns',
11
-        // seeking: 'seeking',
12
-        // urgency: 'urgency',
13
-        // experience: 'experience',
14
-        // roles: 'role',
15
-        // duration: 'duration',
16
-        // presence: 'presence',
17
-        // language: 'language',
18 10
         zipcode: 'zipcode',
19
-        // distance: 'distance',
20
-        // blurb: 'blurb',
21
-        // image: 'image',
11
+        seeking: 'seeking',
12
+        urgency: 'urgency',
13
+        presence: 'presence',
14
+        duration: 'duration',
15
+        pronouns: 'pronouns',
16
+        language: 'language',
17
+        image: 'image',
18
+        distance: 'distance',
19
+        blurb: 'blurb',
22 20
         aspects: 'aspects',
21
+        // experience: 'experience',
22
+        // roles: 'role',
23 23
     },
24 24
 }
25 25
 
@@ -81,23 +81,33 @@ possible.usa = {
81 81
     blurb: [],
82 82
 }
83 83
 
84
+// TODO: set up a separate object of similar prompts based off of
85
+// employer/employee, right now is generic
84 86
 const promptOverrides = {
85 87
     name: "What's your name?:",
86 88
     email: "In order for you to reach out to others on siimee, we'll need an email address. Where can we best reach you?:",
87 89
     password:
88 90
         "Next we'll need you to establish a super secret password. Your password should be at least 10 characters long and have at least 2 special characters. Please enter your:",
89 91
     zipcode:
90
-        "Password looks good! 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?:",
91 93
     blurb: "Please provide us with a short blurb about yourself. What's your backstory?:",
92 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?",
93 102
 }
94 103
 
95 104
 const inputPlaceholders = {
96 105
     name: 'Joe Doe',
97 106
     email: 'Joe@mailme.com',
98 107
     zipcode: '90012',
99
-    blurb: '',
100
-    image: '',
108
+    password: 'supersecr3tp@ssword',
109
+    blurb: 'my backstory starts long long ago...',
110
+    distance: '5 mi'
101 111
 }
102 112
 
103 113
 export {

+ 10
- 9
frontend/src/utils/survey.js Просмотреть файл

@@ -8,17 +8,18 @@ const promptToComponent = {
8 8
     email: 'FormInput',
9 9
     password: 'FormInput',
10 10
     zipcode: 'FormInput',
11
-    // seeking: 'FormDropdown',
12
-    // urgency: 'FormDropdown',
13
-    // presence: 'FormDropdown',
14
-    // duration: 'FormDropdown',
15
-    // experience: 'FormTags',
16
-    // pronouns: 'FormDropdown',
17
-    // language: 'FormDropdown',
11
+    seeking: 'FormDropdown',
12
+    urgency: 'FormDropdown',
13
+    presence: 'FormDropdown',
14
+    duration: 'FormDropdown',
15
+    pronouns: 'FormDropdown',
16
+    language: 'FormDropdown',
18 17
     image: 'FormInput',
19
-    // distance: 'FormInput',
18
+    distance: 'FormInput',
20 19
     blurb: 'FormInput',
21 20
     aspects: 'Aspects',
21
+    // experience: 'FormTags',
22
+    // role: 'FormDropdown',
22 23
 }
23 24
 /**
24 25
  * Make a step from match or step information
@@ -69,7 +70,7 @@ class SurveyFactory {
69 70
                 const langStub = responseKeyLike.response_key_prompt
70 71
                 withComponent.response_key_prompt = promptOverrides[langStub]
71 72
                 withComponent.placeholder = inputPlaceholders[langStub]
72
-                withComponent.charzard = langStub
73
+                withComponent.survey_stage = langStub
73 74
             }
74 75
 
75 76
             return withComponent

+ 8
- 9
frontend/src/views/OnboardingView.vue Просмотреть файл

@@ -7,21 +7,21 @@ main.view--onboarding
7 7
         .answers(v-for='(value, key) in answered')
8 8
             span(v-if='key == "name" && value && currentStep == 2') Hi {{ value }}!
9 9
             span(v-if='key == "email" && value && currentStep == 3') Thanks for the contact info, {{ answered.name }}!
10
-            span(v-if='key == "zipcode" && value && currentStep == 5') Very cool, {{ answered.name }}, we'll be sure only to show you results in your area. Now let's get to know more about you!
11
-
10
+            
12 11
         h3(v-if="currentStep == 1") Welcome to Siimee Onboarding! Let's get started!
13
-        
12
+        br
14 13
         .step(v-for='(step, i) in survey.steps')
15 14
             component(
16 15
                 :aspect-questions='step.component == "Aspects" ? survey.aspectQuestions : null'
17 16
                 :is='step.component'
18 17
                 :question='step'
18
+                @handle-submit='onSubmit'
19 19
                 @update-answers='updateAnswers'
20 20
                 v-if='step && currentStep == i'
21 21
             )
22 22
             
23 23
         footer
24
-            p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / {{ survey.steps.length }} survey steps
24
+            p(v-if='currentStep != 0') You have completed: {{ currentStep - 1 }} / {{ survey.steps.length -2 }} survey steps
25 25
     
26 26
     article(v-else)
27 27
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
@@ -62,11 +62,10 @@ export default {
62 62
         updateAnswers(payload) {
63 63
             // null payload is passed on splash page
64 64
             if (payload) {
65
-                // const k = payload.question.response_key_prompt
66
-                this.answered[payload.question.charzard] = payload.input
67
-                // console.log(`${k}:`, this.answered[k])
68
-                // console.log(`Updated answers: ${JSON.stringify(this.answered)}`)
69
-                // if (k === 'aspects') return
65
+                const k = payload.question.survey_stage
66
+                this.answered[k] = payload.input
67
+                console.log(`Updated answers: ${JSON.stringify(this.answered)}`)
68
+                if (k === 'aspects') return
70 69
             }
71 70
             console.log('this.answered :>> ', this.answered)
72 71
             if (this.currentStep > this.survey.steps.length) {

Загрузка…
Отмена
Сохранить