Ver código fonte

Merge branch 'more-skeleton' of fyindr/siimee into dev

tags/0.0.1^2
maeda 3 anos atrás
pai
commit
819293b2d6

+ 1
- 0
frontend/.eslintrc Ver arquivo

@@ -8,5 +8,6 @@
8 8
         "prettier"
9 9
     ],
10 10
     "parser": "vue-eslint-parser",
11
+    "parserOptions": { "ecmaVersion": 2020 },
11 12
     "rules": {}
12 13
 }

+ 1
- 1
frontend/index.html Ver arquivo

@@ -6,7 +6,7 @@
6 6
         <title>Vite App</title>
7 7
     </head>
8 8
     <body>
9
-        <div id="app" style="width:90%;margin:15px auto;"></div>
9
+        <div id="app"></div>
10 10
         <script>
11 11
             // DUMB shim
12 12
             var global = window

+ 10
- 1
frontend/src/App.vue Ver arquivo

@@ -1,5 +1,7 @@
1 1
 <template lang="pug">
2 2
 w-app
3
+    TopNav(@on-open="openDrawer = !openDrawer")
4
+
3 5
     w-drawer(v-model="openDrawer")
4 6
         SideBar(@updatePid="setPid" :pid="profile.id.value")
5 7
         
@@ -14,6 +16,7 @@ w-app
14 16
 <script>
15 17
 import 'wave-ui/dist/wave-ui.css'
16 18
 import SideBar from './components/SideBar.vue'
19
+import TopNav from './components/TopNav.vue'
17 20
 
18 21
 import { currentProfile } from './services'
19 22
 import { surveyFactory } from './utils'
@@ -22,7 +25,7 @@ const DEV_MODE = import.meta.env.VITE_DEV == 'true'
22 25
 const DEV_PID = 45
23 26
 
24 27
 export default {
25
-    components: { SideBar },
28
+    components: { TopNav, SideBar },
26 29
     data: () => ({
27 30
         sliderVal: 1,
28 31
         openDrawer: false,
@@ -60,3 +63,9 @@ export default {
60 63
     },
61 64
 }
62 65
 </script>
66
+
67
+<style lang="sass">
68
+#app > .w-app > main
69
+    position: relative
70
+    top: 50px
71
+</style>

+ 16
- 16
frontend/src/components/MainNav.vue Ver arquivo

@@ -1,25 +1,25 @@
1 1
 <template lang="pug">
2
-w-toolbar.mt6.py1.no-grow(bottom)
3
-    router-link.w-flex.column(:to='`/chats`')
4
-        w-button.pa5.bdrsr.bd1.sh1(bg-color='primary' disabled)
5
-            w-icon.mr1(xl) mdi mdi-forum
6
-            p.text-upper active chats
7
-    router-link.w-flex.column(:to='`/matches`')
8
-        w-button.pa5.bdrsr.bd1.sh1(bg-color='primary')
9
-            w-icon.mr1(xl) mdi mdi-tooltip-account
10
-            p.text-upper pending matches
2
+w-toolbar.mt6.py1(bottom fixed)
11 3
     router-link.w-flex.column(:to='`/`')
12
-        w-button.pa5.bdrsr.bd1.sh1(bg-color='primary')
4
+        w-button.pa8(bg-color='primary')
13 5
             w-icon.mr1(xl) mdi mdi-home
14
-            p.text-upper home queue
15
-    router-link.w-flex.column(:to='`/survey`')
16
-        w-button.pa5.bdrsr.bd1.sh1(bg-color='primary')
6
+            //- p.text-upper home queue
7
+    router-link.w-flex.column(:to='`/matches`')
8
+        w-button.pa8(bg-color='primary')
9
+            w-icon.mr1(xl) mdi mdi-tooltip-account
10
+            //- p.text-upper pending matches
11
+    router-link.w-flex.column(:to='`/chats`')
12
+        w-button.pa8(bg-color='primary' disabled)
13
+            w-icon.mr1(xl) mdi mdi-forum
14
+            //- p.text-upper active chats
15
+    router-link.w-flex.column(:to='`/onboarding`')
16
+        w-button.pa8(bg-color='primary')
17 17
             w-icon.mr1(xl) mdi mdi-account-check
18
-            p.text-upper survey
18
+            //- p.text-upper survey
19 19
     router-link.w-flex.column(:to='`/settings`')
20
-        w-button.pa5.bdrsr.bd1.sh1(bg-color='primary' disabled)
20
+        w-button.pa8(bg-color='primary' disabled)
21 21
             w-icon.mr1(xl) mdi mdi-cog
22
-            p.text-upper settings
22
+            //- p.text-upper settings
23 23
 </template>
24 24
 
25 25
 <script>

+ 11
- 5
frontend/src/components/ProfileCard.vue Ver arquivo

@@ -1,13 +1,16 @@
1 1
 <template lang="pug">
2 2
 w-card.profile-card-list--card.xs12.pa12
3 3
     header.xs12.w-flex.column.center
4
-        NamePlate(:pid="card.pid" :name="card.name" :role="card.role" :is-list="isList")
4
+        NamePlate(:pid="card.pid" :name="card.name" :role="card.role" :is-list="isList" :is-paired="isPaired")
5
+        h1(v-if="isPaired && !isList") some other field
6
+        
5 7
         template(v-if="!isList")
6
-            SummaryBar
7
-            TagList
8
+            SummaryBar(:is-paired="isPaired" :show-about="isPaired")
9
+            TagList(v-if="!isPaired || isList")
8 10
 
9 11
     article.xs12.w-flex.column.justify-space-between
10 12
         AspectBar(
13
+            v-if="!isPaired || isList"
11 14
             v-for="aspect in aspects"
12 15
             :labels="aspect.labels"
13 16
             :percentage="aspect.percentage"
@@ -17,17 +20,20 @@ w-card.profile-card-list--card.xs12.pa12
17 20
     footer(v-if="!isList")
18 21
         .pa12
19 22
             p {{ bio }}
20
-        PairingButton
23
+        PairingButton(v-if="!isPaired")
21 24
 </template>
22 25
 
23 26
 <script setup>
24
-import { computed } from 'vue'
27
+import { ref } from 'vue'
25 28
 import NamePlate from './NamePlate.vue'
26 29
 import AspectBar from './AspectBar.vue'
27 30
 import SummaryBar from './SummaryBar.vue'
28 31
 import TagList from './TagList.vue'
29 32
 import PairingButton from './PairingButton.vue'
30 33
 
34
+// const isPaired = ref(false)
35
+const isPaired = ref(true)
36
+
31 37
 const props = defineProps({
32 38
     card: {
33 39
         type: Object,

+ 6
- 0
frontend/src/components/ProfileCardList.vue Ver arquivo

@@ -114,3 +114,9 @@ const pass = targetId => {
114 114
     emit('reload')
115 115
 }
116 116
 </script>
117
+
118
+<style lang="sass">
119
+.profile-card-list
120
+    > header > .w-select >.primary
121
+        margin-top: 0
122
+</style>

+ 34
- 0
frontend/src/components/QuestionResponse.vue Ver arquivo

@@ -0,0 +1,34 @@
1
+<template lang="pug">
2
+.question.pa12
3
+    header.w-flex.row.justify-space-between.pb6
4
+        label {{question.question}}
5
+    section.radio-buttons.w-flex.row.justify-space-between
6
+        h3(v-for="label in question.labels") {{label}}
7
+    w-radios.w-flex.row.justify-space-between(@update:model-value="onUpdate" :items="radioItems")
8
+</template>
9
+
10
+<script>
11
+export default {
12
+    props: {
13
+        question: {
14
+            type: Object,
15
+            required: true,
16
+        },
17
+    },
18
+    emits: ['updated'],
19
+    data: () => ({
20
+        radioItems: [
21
+            { answer: 1 },
22
+            { answer: 2 },
23
+            { answer: 3 },
24
+            { answer: 4 },
25
+            { answer: 5 },
26
+        ],
27
+    }),
28
+    methods: {
29
+        onUpdate(e) {
30
+            this.$emit('updated', { ...this.question, answer: e + 1 })
31
+        },
32
+    },
33
+}
34
+</script>

+ 2
- 2
frontend/src/components/SummaryBar.vue Ver arquivo

@@ -1,8 +1,8 @@
1 1
 <template lang="pug">
2 2
 section.w-flex.column.pb5
3
-    nav.xs12
3
+    nav.fill-width.w-flex.row
4
+        h1(v-if="showAbout") about
4 5
         ul.xs12.w-flex.row
5
-            li(v-if="showAbout") about
6 6
             li(v-for="[label, percentage] in summary" :key="label").w-flex.row
7 7
                 w-icon(xl).mr1 mdi mdi-heart
8 8
                 .w-flex.column.justify-start

+ 28
- 0
frontend/src/components/TopNav.vue Ver arquivo

@@ -0,0 +1,28 @@
1
+<template lang="pug">
2
+w-toolbar.top-nav.w-flex.align-center.justify-between(top fixed)
3
+    router-link.w-flex.column.no-grow(v-if="$route.params.pid" :to='`/`')
4
+        w-button.pa4(bg-color='transparent')
5
+            w-icon.mr1(md) mdi mdi-arrow-left
6
+    
7
+    w-button.pa4(v-if="!$route.params.pid" bg-color='transparent' @click="$emit('on-open')")
8
+        w-icon.mr1(md) mdi mdi-cog
9
+
10
+    router-link.w-flex.column(:to='`/`')
11
+        p.text-upper.text-center {{$route.path}} {{$route.params}}
12
+
13
+    router-link.w-flex.column.no-grow(v-if="!$route.params.pid" :to='`/search`')
14
+        w-button.pa4(bg-color='transparent' disabled)
15
+            w-icon.mr1(md) mdi mdi-magnify
16
+                //- p.text-upper settings
17
+</template>
18
+
19
+<script>
20
+export default {
21
+    name: 'TopNav',
22
+}
23
+</script>
24
+
25
+<style lang="sass">
26
+.w-toolbar.top-nav
27
+    height: 50px
28
+</style>

+ 1
- 1
frontend/src/router/index.js Ver arquivo

@@ -33,7 +33,7 @@ const routes = [
33 33
         meta: { requiresAuth: true, requiresCompleteProfile: true },
34 34
     },
35 35
     {
36
-        path: '/chat/:tid',
36
+        path: '/chat/:pid',
37 37
         component: ChatView,
38 38
         meta: {
39 39
             requiresAuth: true,

+ 1
- 1
frontend/src/views/ChatView.vue Ver arquivo

@@ -22,7 +22,7 @@ main.view--chat
22 22
         input(v-model="toSend" @keyup.enter="sendMessage")
23 23
         button(@click="sendMessage") send
24 24
 
25
-    p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.tid }} and {{profile.id}}... 
25
+    p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.pid }} and {{profile.id}}... 
26 26
     p(v-else) Loading...
27 27
 
28 28
     MainNav

+ 0
- 5
frontend/src/views/HomeView.vue Ver arquivo

@@ -29,11 +29,6 @@ main.view--home
29 29
                 type='password'
30 30
             )
31 31
 
32
-        SummaryBar
33
-        TagList(:icon='{ family: "mdi", shape: "heart" }')
34
-        AspectBar
35
-        PairingButton
36
-
37 32
     MainNav
38 33
 </template>
39 34
 

+ 1
- 1
frontend/src/views/LoginView.vue Ver arquivo

@@ -1,5 +1,5 @@
1 1
 <template lang="pug">
2
-main.view--login.w-full.f-col
2
+main.view--login
3 3
     header
4 4
         h2 Login
5 5
 

+ 7
- 7
frontend/src/views/MatchesView.vue Ver arquivo

@@ -1,13 +1,13 @@
1 1
 <template lang="pug">
2
-main.view--matches.f-col.start.w-full
3
-    header
4
-        h2 Matches
2
+main.view--matches
5 3
 
6
-    article(v-if='matches.length && !loading')
7
-        ProfileCardList(:pid='pid' :profiles='matches' @reload='getCards')
4
+    article.pa12
5
+        template(v-if='matches.length && !loading')
6
+            h2 atches
7
+            ProfileCardList(:pid='pid' :profiles='matches' @reload='getCards')
8 8
 
9
-    p(v-else-if='matches.length === 0') No matches.
10
-    p(v-else) Loading...
9
+        p(v-else-if='matches.length === 0') No matches.
10
+        p(v-else) Loading...
11 11
 
12 12
     MainNav
13 13
 </template>

+ 45
- 132
frontend/src/views/OnboardingView.vue Ver arquivo

@@ -1,157 +1,70 @@
1 1
 <template lang="pug">
2
-article
3
-    form(@submit.prevent="onSubmit")
4
-        .questionnaire
5
-            .question(
6
-                v-for="q in questionnaireQuestions"
7
-            )
8
-                label {{q.question}}
9
-                .question--response
10
-                    .question--answers 
11
-                        h3 {{q.answers[0].charAt(0).toUpperCase() + q.answers[0].slice(1)}}
12
-                        h3 {{q.answers[1].charAt(0).toUpperCase() + q.answers[1].slice(1)}}
13
-                    .question--radio-buttons
14
-                        input(type='radio' :id="'q'+(q.id)+'_a1'" :name="'q'+(q.id)" value="a1" v-model="questionnaireAnswers[q.id-1]") 
15
-                        input(type='radio' :id="'q'+(q.id)+'_a2'" :name="'q'+(q.id)" value="a2" v-model="questionnaireAnswers[q.id-1]") 
16
-                        input(type='radio' :id="'q'+(q.id)+'_a3'" :name="'q'+(q.id)" value="a3" v-model="questionnaireAnswers[q.id-1]") 
17
-                        input(type='radio' :id="'q'+(q.id)+'_a4'" :name="'q'+(q.id)" value="a4" v-model="questionnaireAnswers[q.id-1]") 
18
-                        input(type='radio' :id="'q'+(q.id)+'_a5'" :name="'q'+(q.id)" value="a5" v-model="questionnaireAnswers[q.id-1]") 
19
-        br
20
-        w-flex
2
+main.view--onboarding
3
+    article
4
+        form(@submit.prevent="onSubmit").questionnaire
5
+            QuestionResponse(v-for="question in questions" :question="question" @updated="onUpdate")
21 6
             w-button.ma1.grow(type="submit" bg-color="success")
22 7
                 w-icon.mr1 wi-check
23 8
                 | SUBMIT ANSWERS
24
-//- br
25
-//- h3 Current Step: {{currentStep}}
26
-//- br
27
-//- ul
28
-//-     li(v-for="question in onboardingStep")
29
-//-         p {{question}}
30
-//- br
31
-//- button(@click="goToStep(currentStep - 1)") previous
32
-//- br
33
-//- button(@click="goToStep(currentStep + 1)") next
34
-//- br
35
-//- br
9
+    MainNav
36 10
 </template>
37
-<script>    
11
+
12
+<script>
38 13
 import { surveyFactory } from '@/utils'
39 14
 import { allSteps, possible } from '@/utils/lang'
40 15
 
16
+import QuestionResponse from '../components/QuestionResponse.vue'
17
+const SCORED = [1, 2, 3, 4, 5, 6]
18
+const _isScored = id => SCORED.includes(id)
19
+
20
+const _makeCategoryFriendly = responseCategory => {
21
+    const labels = responseCategory.split('_vs_')
22
+    labels.forEach((a, i) => {
23
+        if (a.indexOf('_') == -1) return
24
+        labels[i] = a.split('_').join(' ')
25
+    })
26
+    return labels
27
+}
28
+
29
+const _formatSteps = steps => {
30
+    return steps
31
+        .map(q => {
32
+            if (!_isScored(q.response_key_id)) return null
33
+            return {
34
+                id: q.response_key_id,
35
+                question: q.response_key_prompt,
36
+                labels: _makeCategoryFriendly(q.response_key_category),
37
+            }
38
+        })
39
+        .filter(step => step != null)
40
+}
41 41
 
42 42
 export default {
43
-    name:'OnboardingView',
43
+    name: 'OnboardingView',
44
+    components: { QuestionResponse },
44 45
     data: () => {
45 46
         return {
46
-            // onboardingQuestions: [],
47
-            // currentStep: 0,
48
-            // onboardingAnswers: [],
49 47
             validSurvey: null,
50
-            questionnaireQuestions:[],
51
-            questionnaireAnswers: Array(6).join(".").split(".") 
48
+            questions: [],
49
+            answered: {},
52 50
         }
53 51
     },
54
-    computed:{
55
-        // onboardingStep(){
56
-        //     if(!this.onboardingQuestions.length) return []
57
-        //     return this.onboardingQuestions[this.currentStep]
58
-        // },
59
-        // questionnaireAnswers(){
60
-        //     let num_of_ans = 6 // TODO make dynamic once we know which questions we will be asking
61
-        //     return Array(num_of_ans).join(".").split(".") 
62
-        // }
63
-    },
64
-    async created(){
65
-        this.validSurvey = await surveyFactory.createSurvey(
52
+    async created() {
53
+        const survey = await surveyFactory.createSurvey(
66 54
             allSteps['usa'],
67 55
             possible['usa']['roles'],
68 56
         )
69
-        // gather questionnaire questions
70
-        this.validSurvey.steps.forEach(q => {
71
-            if(q.response_key_id  && q.response_key_id  < 7) {
72
-                let id = q.response_key_id
73
-                let question = q.response_key_prompt
74
-                let answers = q.response_key_category.split('_vs_')
75
-                answers.forEach((a,i) => {
76
-                    if(a.indexOf('_') !== -1){
77
-                        answers[i] = a.split('_').join(' ')
78
-                    }
79
-                })
80
-                this.questionnaireQuestions.push({
81
-                    id,
82
-                    question,
83
-                    answers
84
-                })
85
-            }
86
-        })
87
-        // var step = []
88
-        // var fooSteps = [...this.validSurvey.steps]
89
-        // while(fooSteps.length > (this.validSurvey.steps.length % 3)){
90
-        //     var q = fooSteps.shift()
91
-        //     step.push(q)
92
-        //     if(step.length == 3){
93
-        //         this.onboardingQuestions.push(step)
94
-        //         step = []
95
-        //     }
96
-        // }
97
-        // var last_step = [...fooSteps]
98
-        // this.onboardingQuestions.push(last_step)
57
+        this.questions = _formatSteps(survey.steps)
99 58
     },
100 59
     methods: {
60
+        onUpdate(payload) {
61
+            this.answered[payload.id] = payload
62
+        },
101 63
         onSubmit() {
102
-            this.questionnaireAnswers.forEach((ans,ind)=>{
103
-                console.log(`Question ${ind+1} was ${ans==''? 'left blank.' : `answered ${ans}`}`)
104
-            })
64
+            Object.values(this.answered).forEach(ans =>
65
+                console.log(ans.question, ans.answer),
66
+            )
105 67
         },
106
-        // goToStep(num){
107
-        //     if(num < 0){
108
-        //         this.currentStep = this.onboardingQuestions.length-1
109
-        //     }
110
-        //     else if(num >= this.onboardingQuestions.length) {
111
-        //         this.currentStep = 0
112
-        //     }
113
-        //     else 
114
-        //         this.currentStep = num
115
-        // },
116 68
     },
117 69
 }
118 70
 </script>
119
-<style>
120
-body{
121
-    background-color: #1F2024;
122
-}
123
-article{
124
-    color: #FFFFFF;
125
-}
126
-.questionnaire{
127
-    display: flex;
128
-    flex-direction:column;
129
-}
130
-.question{
131
-    margin-top: 44px;
132
-}
133
-.question > label{
134
-    font-size: 18px; 
135
-    line-height: 23px;
136
-}
137
-.question--response{
138
-    margin-top: 22px;
139
-    margin-inline: 19px;
140
-}
141
-.question--answers{
142
-    display: flex;
143
-    flex-direction: row;
144
-    justify-content: space-between;
145
-}
146
-.question--radio-buttons{
147
-    padding: 0 25px;
148
-    margin: 16px auto auto auto;
149
-    display: flex;
150
-    flex-direction: row;
151
-    justify-content: space-between;
152
-}
153
-.question--radio-buttons > input {
154
-    width: 24px;
155
-    height: 24px;
156
-}
157
-</style>

+ 0
- 31
frontend/src/views/ProfileView.vue Ver arquivo

@@ -1,7 +1,5 @@
1 1
 <template lang="pug">
2 2
 main.view--profile
3
-    header 
4
-        button(@click='$router.go(-1)') back
5 3
 
6 4
     article(v-if='!loading')
7 5
         ProfileCard(
@@ -10,35 +8,6 @@ main.view--profile
10 8
             :is-list='false'
11 9
             :card='card'
12 10
         )
13
-        //- h3 name: {{ profile.user_name }}
14
-        //-     span(v-if='profile.profile_prefs?.pronouns') &nbsp;({{ profile.profile_prefs?.pronouns.val }})
15
-        //- p(v-if='profile.user_email') {{ profile.user_email }}
16
-
17
-        //- p I am looking for a&nbsp;
18
-        //-     span {{ profile.profile_prefs?.presence?.val }}&nbsp;
19
-        //-     span {{ profile.profile_prefs?.role?.val }}&nbsp;
20
-        //-     span role&nbsp;
21
-        //-     span no further than {{ profile.profile_prefs?.distance?.val }} miles away&nbsp;
22
-        //-     span from {{ profile.profile_prefs?.zipcode?.val }}
23
-
24
-        //- p I am {{ profile.profile_prefs?.urgency?.val.split('_').join(' ') }}.
25
-
26
-        //- img(
27
-        //-     :src='profile.profile_media[0]'
28
-        //-     alt='profile-avatar'
29
-        //-     style='max-height: 200px; width: auto'
30
-        //-     v-if='profile.reveal.map(t => t.description).includes("image")'
31
-        //- )
32
-        //- h3(v-else) image not revealed
33
-
34
-        //- p About: {{ profile.profile_description }}
35
-
36
-        //- p reveal: {{ profile.reveal.map(t => t.description) }}
37
-        //- p tags: {{ profile.tags.map(t => t.description) }}
38
-        //- p images: {{ profile.profile_media }}
39
-        //- p responses: {{ profile.responses.length }}
40
-        //- button(@click='$router.go(-1)') back
41
-
42 11
     p(v-else) Loading...
43 12
 
44 13
     MainNav

+ 6
- 0
frontend/src/wave.js Ver arquivo

@@ -14,9 +14,12 @@ import {
14 14
     WIcon,
15 15
     WImage,
16 16
     WInput,
17
+    WList,
17 18
     WMenu,
18 19
     WProgress,
19 20
     WOverlay,
21
+    WRadio,
22
+    WRadios,
20 23
     WSelect,
21 24
     WSlider,
22 25
     WSpinner,
@@ -38,9 +41,12 @@ export default {
38 41
     WIcon,
39 42
     WImage,
40 43
     WInput,
44
+    WList,
41 45
     WMenu,
42 46
     WProgress,
43 47
     WOverlay,
48
+    WRadio,
49
+    WRadios,
44 50
     WSelect,
45 51
     WSlider,
46 52
     WSpinner,

Carregando…
Cancelar
Salvar