Przeglądaj źródła

:wrench: onboarding component subfolder | overriding guards temporarily

tags/0.0.2
juancarbajal98 3 lat temu
rodzic
commit
d7aa9169da

+ 1
- 1
backend/db/seeds/04-responses.js Wyświetl plik

@@ -23,7 +23,7 @@ exports.seed = async knex => {
23 23
     for (let i = 1; i <= len; i += 1) {
24 24
         responsesToPush.push(responses.shift())
25 25
         if (i % batchSize === 0 || i > responses.length) {
26
-            await knex('responses').insert(responsesToPush)
26
+            // await knex('responses').insert(responsesToPush)
27 27
             responsesToPush = []
28 28
         }
29 29
     }

+ 2
- 5
frontend/src/App.vue Wyświetl plik

@@ -6,10 +6,7 @@ w-app
6 6
         SideBar(@updatePid="setPid" :pid="profile.id.value")
7 7
         
8 8
     RouterView(
9
-        v-if="profile.isLoggedIn"
10
-        :pid="profile.id.value"
11 9
         @updatePid="setPid"
12
-        @show-sidebar="showSidebar = !showSidebar"
13 10
     )
14 11
 </template>
15 12
 
@@ -21,8 +18,8 @@ import TopNav from './components/TopNav.vue'
21 18
 import { currentProfile } from './services'
22 19
 import { surveyFactory } from './utils'
23 20
 
24
-const DEV_MODE = import.meta.env.VITE_DEV == 'true'
25
-// const DEV_MODE = false
21
+// const DEV_MODE = import.meta.env.VITE_DEV == 'true'
22
+const DEV_MODE = false
26 23
 const DEV_PID = 45
27 24
 
28 25
 export default {

+ 2
- 2
frontend/src/components/PairingButton.vue Wyświetl plik

@@ -1,9 +1,9 @@
1 1
 <template lang="pug">
2 2
 .pairing-button.w-flex.row
3 3
     template(v-if='status == "pristine"')
4
-        w-button(:class='status')(@click='pass')
4
+        w-button(:class='status' @click='pass')
5 5
             p.pa4.text-upper pass
6
-        w-button(:class='status')(@click='pair')
6
+        w-button(:class='status' @click='pair')
7 7
             p.pa4.text-upper pair
8 8
     template(v-else-if='status == "pending"')
9 9
         w-button(:class='status')

+ 17
- 0
frontend/src/components/onboarding/AccountType.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+h3 {Name}, let's get started on your profile while we verify your account
3
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") CANDIDATES
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") JOBS
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'AccountType',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 28
- 0
frontend/src/components/onboarding/Aspects.vue Wyświetl plik

@@ -0,0 +1,28 @@
1
+<template lang="pug">
2
+form(@submit.prevent="this.$emit('handle-submit')").questionnaire
3
+    QuestionResponse(v-for="question in aspectQuestions" :question="question")
4
+    w-button.ma1.grow(type="submit" bg-color="success")
5
+        w-icon.mr1 wi-check
6
+        | SUBMIT ANSWERS
7
+</template>
8
+<script>
9
+import QuestionResponse from '../QuestionResponse.vue'
10
+
11
+export default {
12
+    name: 'Aspects',
13
+    components: {
14
+        QuestionResponse
15
+    },
16
+    props: {
17
+        aspectQuestions:{
18
+            required: true,
19
+            type: Array
20
+        },
21
+        currentStep:{
22
+            required: true,
23
+            type: Number,
24
+            default: 0
25
+        }
26
+    },
27
+}
28
+</script>

+ 19
- 0
frontend/src/components/onboarding/CompanyID.vue Wyświetl plik

@@ -0,0 +1,19 @@
1
+<template lang="pug">
2
+h3 Company ID
3
+p PLEASE ENTER YOUR COMPANY ID#:
4
+input(type="text" placeholder="Get this from your admin.")
5
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
6
+</template>
7
+<script>
8
+// todo add v-model to input, pass down answers array from parent
9
+export default {
10
+    name: 'CompanyID',
11
+    props: {
12
+        currentStep:{
13
+            required: true,
14
+            type: Number,
15
+            default: 0
16
+        }
17
+    },
18
+}
19
+</script>

+ 17
- 0
frontend/src/components/onboarding/Interests.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+h3 Interests
3
+p What are some interests you would like in your next candidates?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Interests',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/LicensesAndCertifications.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+h3 Licenses & Certifications
3
+p Are there any licenses and certification requirements?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'LicensesAndCertifications',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/Location.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+h3 Location
3
+p Where would you like to select your candidates from?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Location',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 20
- 0
frontend/src/components/onboarding/Role.vue Wyświetl plik

@@ -0,0 +1,20 @@
1
+<template lang="pug">
2
+h3 ACTIVELY SEARCHING
3
+p What is your role at your company?
4
+w-select.mt4(
5
+    :items="[{label: 'RECRUITER'},{label: 'HIRING MANAGER'}]"
6
+    placeholder="i am")
7
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
8
+</template>
9
+<script>
10
+export default {
11
+    name: 'Role',
12
+    props: {
13
+        currentStep:{
14
+            required: true,
15
+            type: Number,
16
+            default: 0
17
+        }
18
+    },
19
+}
20
+</script>

+ 17
- 0
frontend/src/components/onboarding/Skills.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+h3 RECRUITER
3
+p What are some skills you are looking for at your company?
4
+w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") NEXT
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Skills',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 17
- 0
frontend/src/components/onboarding/Splash.vue Wyświetl plik

@@ -0,0 +1,17 @@
1
+<template lang="pug">
2
+.splash-icon(style="width:347px; height:347px; background-color: red;")
3
+div(style="text-align:center;")
4
+    w-button.ma1.grow(@click="this.$emit('go-to-step', currentStep + 1)") GET STARTED
5
+</template>
6
+<script>
7
+export default {
8
+    name: 'Splash',
9
+    props: {
10
+        currentStep:{
11
+            required: true,
12
+            type: Number,
13
+            default: 0
14
+        }
15
+    },
16
+}
17
+</script>

+ 21
- 0
frontend/src/components/onboarding/index.js Wyświetl plik

@@ -0,0 +1,21 @@
1
+import Splash from './Splash.vue'
2
+import AccountType from './AccountType.vue'
3
+import CompanyID from './CompanyID.vue'
4
+import Role from './Role.vue'
5
+import Skills from './Skills.vue'
6
+import Location from './Location.vue'
7
+import Interests from './Interests.vue'
8
+import LicensesAndCertifications from './LicensesAndCertifications.vue'
9
+import Aspects from './Aspects.vue'
10
+
11
+export default {
12
+    Splash,
13
+    AccountType,
14
+    CompanyID,
15
+    Role,
16
+    Skills,
17
+    Location,
18
+    Interests,
19
+    LicensesAndCertifications,
20
+    Aspects,
21
+}

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

@@ -8,7 +8,8 @@ import components from './wave'
8 8
 import App from './App.vue'
9 9
 import MainNav from './components/MainNav.vue'
10 10
 
11
-const DEV = import.meta.env.VITE_DEV == 'true'
11
+// const DEV = import.meta.env.VITE_DEV == 'true'
12
+const DEV = false
12 13
 
13 14
 /**
14 15
  * Check between route changes for login/timeout

+ 1
- 1
frontend/src/router/guards.js Wyświetl plik

@@ -10,7 +10,7 @@ const checkLoginStatus = (destination, nextCb) => {
10 10
         !currentProfile.isLoggedIn &&
11 11
         !currentProfile.isComplete 
12 12
     ) {
13
-        nextCb('survey')
13
+        nextCb('onboarding')
14 14
     } else if(
15 15
         destination.meta.requiresCompleteProfile &&
16 16
         destination.meta.requiresAuth &&

+ 16
- 0
frontend/src/services/survey.service.js Wyświetl plik

@@ -32,6 +32,22 @@ const updateSurveyByProfileId = async (surveyResponses, profileId) => {
32 32
     })
33 33
 }
34 34
 
35
+// const updateSurveyByProfileId = async (surveyResponses, profileId) => {
36
+//     surveyResponses.forEach(responseKeyIdwithVal => {
37
+//         const keyId = responseKeyIdwithVal.response_key_id
38
+//         const val = responseKeyIdwithVal.val
39
+//         // PATCH
40
+//         db.patch(`/profile/${profileId}/update/${keyId}`, [
41
+//             {
42
+//                 response_id: 2,
43
+//                 profile_id: profileId,
44
+//                 response_key_id: keyId,
45
+//                 val: val,
46
+//             },
47
+//         ])
48
+//     })
49
+// }
50
+
35 51
 const scoreSurveyByProfileId = async (profileId, maxDistance = 99) => {
36 52
     const scoreSurvey = await db.get(
37 53
         `/profile/${profileId}/score?max_distance=${maxDistance}`,

+ 39
- 0
frontend/src/utils/onboardingStepComponents.js Wyświetl plik

@@ -0,0 +1,39 @@
1
+const OnboardingStepComponents = [
2
+    {
3
+        id: 0,
4
+        component:'Splash',
5
+    },
6
+    {
7
+        id: 1,
8
+        component:'AccountType',
9
+    },
10
+    {
11
+        id: 2,
12
+        component:'CompanyID',
13
+    },
14
+    {
15
+        id: 3,
16
+        component:'Role',
17
+    },
18
+    {
19
+        id: 4,
20
+        component:'Skills',
21
+    },
22
+    {
23
+        id: 5,
24
+        component:'Location',
25
+    },
26
+    {
27
+        id: 6,
28
+        component:'Interests',
29
+    },
30
+    {
31
+        id: 7,
32
+        component:'LicensesAndCertifications',
33
+    },
34
+    {
35
+        id: 8,
36
+        component:'Aspects',
37
+    }
38
+]
39
+export default OnboardingStepComponents

+ 42
- 15
frontend/src/views/OnboardingView.vue Wyświetl plik

@@ -1,20 +1,29 @@
1 1
 <template lang="pug">
2 2
 main.view--onboarding
3
-    article
4
-        form(@submit.prevent="onSubmit").questionnaire
5
-            QuestionResponse(v-for="question in questions" :question="question" @updated="onUpdate")
6
-            w-button.ma1.grow(type="submit" bg-color="success")
7
-                w-icon.mr1 wi-check
8
-                | SUBMIT ANSWERS
9
-    MainNav
3
+    article(style="display: flex;flex-direction: column;align-items: center;")
4
+        component(
5
+            :is="onboardingStep.component"
6
+            :currentStep="currentStep"
7
+            :aspectQuestions="onboardingStep.component == 'Aspects'? aspectQuestions : null"
8
+            @go-to-step="goToStep"
9
+            @handle-submit="onboardingStep.component == 'Aspects'? onSubmit : null"
10
+        )
11
+        //- form(@submit.prevent="onSubmit").questionnaire
12
+        //-     QuestionResponse(v-for="question in questions" :question="question" @updated="onUpdate")
13
+        //-     w-button.ma1.grow(type="submit" bg-color="success")
14
+        //-         w-icon.mr1 wi-check
15
+        //-         | SUBMIT ANSWERS
16
+    //- MainNav
10 17
 </template>
11 18
 
12 19
 <script>
13 20
 import { surveyFactory } from '@/utils'
14 21
 import { allSteps, possible } from '@/utils/lang'
22
+import stepViews from '@/components/onboarding'
23
+import OnboardingStepComponents from '../utils/onboardingStepComponents'
15 24
 
16
-import QuestionResponse from '../components/QuestionResponse.vue'
17
-const SCORED = [1, 2, 3, 4, 5, 6]
25
+// import QuestionResponse from '../components/QuestionResponse.vue'
26
+const SCORED = [1, 2, 3, 4, 5, 6] // consider expanding + modifying DB table
18 27
 const _isScored = id => SCORED.includes(id)
19 28
 
20 29
 const _makeCategoryFriendly = responseCategory => {
@@ -26,7 +35,7 @@ const _makeCategoryFriendly = responseCategory => {
26 35
     return labels
27 36
 }
28 37
 
29
-const _formatSteps = steps => {
38
+const _formatAspectQuestions = steps => {
30 39
     return steps
31 40
         .map(q => {
32 41
             if (!_isScored(q.response_key_id)) return null
@@ -39,14 +48,27 @@ const _formatSteps = steps => {
39 48
         .filter(step => step != null)
40 49
 }
41 50
 
51
+// import savesurveybyprfileid - call it on submit
52
+// paginate to save every steps answers
42 53
 export default {
43 54
     name: 'OnboardingView',
44
-    components: { QuestionResponse },
55
+    components: { 
56
+        ...stepViews,
57
+        // QuestionResponse 
58
+        },
45 59
     data: () => {
46 60
         return {
47
-            validSurvey: null,
48
-            questions: [],
49 61
             answered: {},
62
+            aspectQuestions: [],
63
+            currentStep: 0,
64
+            onboardingStepComponents: [],
65
+            validSurvey: null,
66
+        }
67
+    },
68
+    computed : {
69
+        onboardingStep(){
70
+            if(!this.onboardingStepComponents.length) return []
71
+            return this.onboardingStepComponents[this.currentStep]
50 72
         }
51 73
     },
52 74
     async created() {
@@ -54,17 +76,22 @@ export default {
54 76
             allSteps['usa'],
55 77
             possible['usa']['roles'],
56 78
         )
57
-        this.questions = _formatSteps(survey.steps)
79
+        this.aspectQuestions = _formatAspectQuestions(survey.steps)
80
+        this.onboardingStepComponents = OnboardingStepComponents
58 81
     },
59 82
     methods: {
60 83
         onUpdate(payload) {
61
-            this.answered[payload.id] = payload
84
+            console.log('payload: ', payload)
85
+            // this.answered[payload.id] = payload
62 86
         },
63 87
         onSubmit() {
64 88
             Object.values(this.answered).forEach(ans =>
65 89
                 console.log(ans.question, ans.answer),
66 90
             )
67 91
         },
92
+        goToStep(num){
93
+            this.currentStep = num
94
+        },
68 95
     },
69 96
 }
70 97
 </script>

Ładowanie…
Anuluj
Zapisz