Преглед на файлове

:recycle: Extended refactoring to other onboarding components

tabs-content
tomit4 преди 3 години
родител
ревизия
d0e95e94c5

+ 2
- 2
frontend/src/components/onboarding/Aspects.vue Целия файл

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

+ 12
- 13
frontend/src/components/onboarding/FormInput.vue Целия файл

1
 <template lang="pug">
1
 <template lang="pug">
2
 .form-input
2
 .form-input
3
     span {{ question.response_key_prompt }}
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
 </template>
10
 </template>
7
 <script>
11
 <script>
8
 export default {
12
 export default {
18
         input: null,
22
         input: null,
19
     }),
23
     }),
20
     methods: {
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
         submitImage() {
32
         submitImage() {
34
             let payload = {
33
             let payload = {
35
                 question: this.question,
34
                 question: this.question,
36
-                answer: 'placeholder for image',
35
+                input: 'placeholder for image',
37
             }
36
             }
38
             this.$emit('update-answers', payload)
37
             this.$emit('update-answers', payload)
39
         },
38
         },

+ 24
- 14
frontend/src/utils/lang.js Целия файл

7
         name: 'name',
7
         name: 'name',
8
         email: 'email',
8
         email: 'email',
9
         password: 'password',
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
         zipcode: 'zipcode',
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
         aspects: 'aspects',
20
         aspects: 'aspects',
21
+        // experience: 'experience',
22
+        // roles: 'role',
23
     },
23
     },
24
 }
24
 }
25
 
25
 
81
     blurb: [],
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
 const promptOverrides = {
86
 const promptOverrides = {
85
     name: "What's your name?:",
87
     name: "What's your name?:",
86
     email: "In order for you to reach out to others on siimee, we'll need an email address. Where can we best reach you?:",
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
     password:
89
     password:
88
         "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:",
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
     zipcode:
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
     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?:",
92
     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?",
93
 }
102
 }
94
 
103
 
95
 const inputPlaceholders = {
104
 const inputPlaceholders = {
96
     name: 'Joe Doe',
105
     name: 'Joe Doe',
97
     email: 'Joe@mailme.com',
106
     email: 'Joe@mailme.com',
98
     zipcode: '90012',
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
 export {
113
 export {

+ 10
- 9
frontend/src/utils/survey.js Целия файл

8
     email: 'FormInput',
8
     email: 'FormInput',
9
     password: 'FormInput',
9
     password: 'FormInput',
10
     zipcode: 'FormInput',
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
     image: 'FormInput',
17
     image: 'FormInput',
19
-    // distance: 'FormInput',
18
+    distance: 'FormInput',
20
     blurb: 'FormInput',
19
     blurb: 'FormInput',
21
     aspects: 'Aspects',
20
     aspects: 'Aspects',
21
+    // experience: 'FormTags',
22
+    // role: 'FormDropdown',
22
 }
23
 }
23
 /**
24
 /**
24
  * Make a step from match or step information
25
  * Make a step from match or step information
69
                 const langStub = responseKeyLike.response_key_prompt
70
                 const langStub = responseKeyLike.response_key_prompt
70
                 withComponent.response_key_prompt = promptOverrides[langStub]
71
                 withComponent.response_key_prompt = promptOverrides[langStub]
71
                 withComponent.placeholder = inputPlaceholders[langStub]
72
                 withComponent.placeholder = inputPlaceholders[langStub]
72
-                withComponent.charzard = langStub
73
+                withComponent.survey_stage = langStub
73
             }
74
             }
74
 
75
 
75
             return withComponent
76
             return withComponent

+ 8
- 9
frontend/src/views/OnboardingView.vue Целия файл

7
         .answers(v-for='(value, key) in answered')
7
         .answers(v-for='(value, key) in answered')
8
             span(v-if='key == "name" && value && currentStep == 2') Hi {{ value }}!
8
             span(v-if='key == "name" && value && currentStep == 2') Hi {{ value }}!
9
             span(v-if='key == "email" && value && currentStep == 3') Thanks for the contact info, {{ answered.name }}!
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
         h3(v-if="currentStep == 1") Welcome to Siimee Onboarding! Let's get started!
11
         h3(v-if="currentStep == 1") Welcome to Siimee Onboarding! Let's get started!
13
-        
12
+        br
14
         .step(v-for='(step, i) in survey.steps')
13
         .step(v-for='(step, i) in survey.steps')
15
             component(
14
             component(
16
                 :aspect-questions='step.component == "Aspects" ? survey.aspectQuestions : null'
15
                 :aspect-questions='step.component == "Aspects" ? survey.aspectQuestions : null'
17
                 :is='step.component'
16
                 :is='step.component'
18
                 :question='step'
17
                 :question='step'
18
+                @handle-submit='onSubmit'
19
                 @update-answers='updateAnswers'
19
                 @update-answers='updateAnswers'
20
                 v-if='step && currentStep == i'
20
                 v-if='step && currentStep == i'
21
             )
21
             )
22
             
22
             
23
         footer
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
     article(v-else)
26
     article(v-else)
27
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
27
         SurveyCompleteView(:answers='answered' :surveySteps='survey.steps')
62
         updateAnswers(payload) {
62
         updateAnswers(payload) {
63
             // null payload is passed on splash page
63
             // null payload is passed on splash page
64
             if (payload) {
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
             console.log('this.answered :>> ', this.answered)
70
             console.log('this.answered :>> ', this.answered)
72
             if (this.currentStep > this.survey.steps.length) {
71
             if (this.currentStep > this.survey.steps.length) {

Loading…
Отказ
Запис