Sfoglia il codice sorgente

Merge branch 'matchView-template' of fyindr/siimee into dev

tags/0.0.1^2
maeda 3 anni fa
parent
commit
a86a23a852

+ 1
- 1
docs/processes/login.md Vedi File

@@ -52,6 +52,6 @@ flowchart LR
52 52
     a(login form component)-->b{{login service}}
53 53
     b{{login service}}-.->z(storeToken)
54 54
     z(storeToken)--->v{{vue router}}
55
-    v{{vue router}}-.->y(forward to /matches)
55
+    v{{vue router}}-.->y(forward to /pairs)
56 56
     z(storeToken)-.->x(fetch profiles)-->w{{profile service}}-->u(API)
57 57
 ```

+ 1
- 1
docs/processes/match.md Vedi File

@@ -49,5 +49,5 @@ flowchart LR
49 49
 flowchart LR
50 50
     a(profile card component)-->b{{match service}}
51 51
     b{{match service}}-.->z(storeGroupings)
52
-    z(storeGroupings)-.->y(forward to /matches/<profile_id>)
52
+    z(storeGroupings)-.->y(forward to /pairs/<profile_id>)
53 53
 ```

+ 3
- 3
docs/processes/survey.md Vedi File

@@ -35,14 +35,14 @@ flowchart LR
35 35
 flowchart LR
36 36
     h((DB))<-->|schwifty model|g{{backend matchQueue model}}
37 37
     g{{backend matchQueue model}}-->d{{backend machQueue service}}
38
-    d{{backend matchQueue service}}-->c(/<profile_id>/matches route)
38
+    d{{backend matchQueue service}}-->c(/<profile_id>/pairs route)
39 39
 ```
40 40
 
41 41
 ### Frontend
42 42
 
43 43
 ```mermaid
44 44
 flowchart LR
45
-    c(/<profile_id>/matches route)-->API-->b{{match service}}
45
+    c(/<profile_id>/pairs route)-->API-->b{{match service}}
46 46
     b{{match service}}-->a(matches component)
47 47
 ```
48 48
 
@@ -53,5 +53,5 @@ flowchart LR
53 53
 flowchart LR
54 54
     a(matches component)-->b{{survey service}}
55 55
     b{{match service}}-.->z(storeMatchQueue)
56
-    z(storeMatchQueue)-.->y(forward to /matches/<profile_id>)
56
+    z(storeMatchQueue)-.->y(forward to /pairs/<profile_id>)
57 57
 ```

+ 3
- 3
frontend/src/components/MainNav.vue Vedi File

@@ -4,12 +4,12 @@ w-toolbar.mt6.py1(bottom fixed)
4 4
         w-button.pa8(bg-color='primary')
5 5
             w-icon.mr1(xl) mdi mdi-home
6 6
             //- p.text-upper home queue
7
-    router-link.w-flex.column(:to='`/matches`')
7
+    router-link.w-flex.column(:to='`/pairs`')
8 8
         w-button.pa8(bg-color='primary')
9 9
             w-icon.mr1(xl) mdi mdi-tooltip-account
10 10
             //- p.text-upper pending matches
11
-    router-link.w-flex.column(:to='`/chats`')
12
-        w-button.pa8(bg-color='primary' disabled)
11
+    router-link.w-flex.column(:to='`/messages`')
12
+        w-button.pa8(bg-color='primary')
13 13
             w-icon.mr1(xl) mdi mdi-forum
14 14
             //- p.text-upper active chats
15 15
     router-link.w-flex.column(:to='`/onboarding`')

+ 35
- 0
frontend/src/components/PairsList.vue Vedi File

@@ -0,0 +1,35 @@
1
+<template lang="pug">
2
+section.pairs-list
3
+    article(v-if="pairs.length")
4
+        .pair.w-flex.align-center.justify-space-around(
5
+            v-for="p in pairs"
6
+        )
7
+            .dot--icon
8
+            .avatar
9
+            .idCard
10
+                p S.R.
11
+                p Registered Nurse  
12
+    p(v-else) No results.    
13
+</template>
14
+
15
+<script setup>
16
+const props = defineProps({
17
+    pairs: {
18
+        type: [Object, Array],
19
+        default: () => [{}],
20
+    },
21
+})
22
+</script>
23
+<style lang="sass">
24
+.pairs-list
25
+    article
26
+        .dot--icon
27
+            width:3vw
28
+            height:3vw
29
+            border-radius:50%
30
+            background-color:#60C3FF
31
+        .avatar
32
+            width:10vw
33
+            height:10vw
34
+            background-color:#D5D5D5
35
+</style>

+ 15
- 5
frontend/src/router/index.js Vedi File

@@ -3,10 +3,11 @@ import { createRouter, createWebHistory } from 'vue-router'
3 3
 import HomeView from '../views/HomeView.vue'
4 4
 import ProfileView from '../views/ProfileView.vue'
5 5
 import ChatView from '../views/ChatView.vue'
6
-import MatchesView from '../views/MatchesView.vue'
6
+import PairsView from '../views/PairsView.vue'
7 7
 import LoginView from '../views/LoginView.vue'
8 8
 import SurveyView from '../views/SurveyView.vue'
9 9
 import OnboardingView from '../views/OnboardingView.vue'
10
+import MessagesView from '../views/MessagesView.vue'
10 11
 
11 12
 const routes = [
12 13
     {
@@ -22,16 +23,25 @@ const routes = [
22 23
         meta: { requiresAuth: true, requiresCompleteProfile: true },
23 24
     },
24 25
     {
25
-        path: '/matches',
26
-        component: MatchesView,
27
-        name: 'MatchesView',
26
+        path: '/pairs',
27
+        component: PairsView,
28
+        name: 'PairsView',
28 29
         meta: { requiresAuth: true, requiresCompleteProfile: true },
29 30
     },
30 31
     {
31
-        path: '/matches/:pid',
32
+        path: '/pairs/:pid',
32 33
         component: ProfileView,
33 34
         meta: { requiresAuth: true, requiresCompleteProfile: true },
34 35
     },
36
+    {
37
+        path: '/messages',
38
+        component: MessagesView,
39
+        meta: {
40
+            requiresAuth: true,
41
+            requiresCompleteProfile: true,
42
+            props: true,
43
+        },
44
+    },
35 45
     {
36 46
         path: '/chat/:pid',
37 47
         component: ChatView,

+ 0
- 38
frontend/src/views/MatchesView.vue Vedi File

@@ -1,38 +0,0 @@
1
-<template lang="pug">
2
-main.view--matches
3
-
4
-    article.pa12
5
-        template(v-if='matches.length && !loading')
6
-            h2 atches
7
-            ProfileCardList(:pid='pid' :profiles='matches' @reload='getCards')
8
-
9
-        p(v-else-if='matches.length === 0') No matches.
10
-        w-spinner(v-else bounce)
11
-
12
-    MainNav
13
-</template>
14
-
15
-<script>
16
-import ProfileCardList from '../components/ProfileCardList.vue'
17
-
18
-import { fetchMembershipsByProfileId } from '../services'
19
-import { mixins } from '../utils'
20
-
21
-export default {
22
-    name: 'MatchView',
23
-    components: { ProfileCardList },
24
-    mixins: [mixins.pidMixin, mixins.cardMixin],
25
-    methods: {
26
-        /** Gets called from cardMixin */
27
-        async getCards() {
28
-            this.loading = true
29
-            try {
30
-                this.cards = await fetchMembershipsByProfileId(this.pid)
31
-            } catch (err) {
32
-                console.error(err)
33
-            }
34
-            this.loading = false
35
-        },
36
-    },
37
-}
38
-</script>

+ 36
- 0
frontend/src/views/MessagesView.vue Vedi File

@@ -0,0 +1,36 @@
1
+<template lang="pug">
2
+main.view--messages
3
+    article(v-if="!loading")
4
+        PairsList(:pairs="inboxes")
5
+
6
+    w-spinner(v-else bounce)
7
+    MainNav
8
+</template>
9
+
10
+<script>
11
+import PairsList from '../components/PairsList.vue'
12
+
13
+import { fetchMembershipsByProfileId } from '../services'
14
+import { mixins } from '../utils'
15
+
16
+export default {
17
+    name: 'MessagesView',
18
+    components: { PairsList },
19
+    mixins: [mixins.pidMixin, mixins.cardMixin],
20
+    data: () => ({
21
+        inboxes: ['x'],
22
+    }),
23
+    methods: {
24
+        /** Gets called from cardMixin */
25
+        async getCards() {
26
+            this.loading = true
27
+            try {
28
+                this.inboxes = await fetchMembershipsByProfileId(this.pid)
29
+            } catch (err) {
30
+                console.error(err)
31
+            }
32
+            this.loading = false
33
+        },
34
+    },
35
+}
36
+</script>

+ 103
- 0
frontend/src/views/PairsView.vue Vedi File

@@ -0,0 +1,103 @@
1
+<template lang="pug">
2
+main.view--matches
3
+    article(v-if="!loading")
4
+
5
+        w-tabs(:items="tabs" fill-bar)
6
+            template(#item-title="{ item }")
7
+               span.green {{ item.title }}
8
+            //- pending tab
9
+            template(#item-content.1="{ item }")
10
+                PairsList(:pairs="pending")
11
+            //- paired tab 
12
+            template(#item-content.2="{ item }")
13
+                PairsList(:pairs="paired")
14
+
15
+    w-spinner(v-else bounce)
16
+    MainNav
17
+</template>
18
+
19
+<script>
20
+// import ProfileCardList from '../components/ProfileCardList.vue'
21
+import PairsList from '../components/PairsList.vue'
22
+
23
+import { fetchMembershipsByProfileId, fetchQueueByProfileId } from '../services'
24
+import { mixins } from '../utils'
25
+
26
+const convertToCard = profile => {
27
+    if (profile.type !== 'profile') {
28
+        console.error(`Cannot convert ${profile} to Card. Invalid entity.`)
29
+    }
30
+    if (!profile.isValid()) {
31
+        console.warn(`Profile ${profile.profile_id} is not a valid profile.`)
32
+    }
33
+    return new Card({
34
+        pid: profile.profile_id,
35
+        name: profile.user_name,
36
+        avatar: profile.profile_media[0],
37
+    })
38
+}
39
+
40
+const converGroupingToCard = grouping => {
41
+    if (grouping.type !== 'grouping') {
42
+        console.error(`Cannot convert ${grouping} to Card. Invalid entity.`)
43
+    }
44
+    if (!grouping.profile.isValid()) {
45
+        console.warn(`Profile in ${grouping} is not a valid profile.`)
46
+    }
47
+    return new Card({
48
+        pid: grouping.profile.profile_id,
49
+        name: grouping.profile.user_name,
50
+        avatar: grouping.profile.profile_media[0],
51
+    })
52
+}
53
+
54
+export default {
55
+    name: 'PairsView',
56
+    components: { PairsList },
57
+    mixins: [mixins.pidMixin, mixins.cardMixin],
58
+    data: () => ({
59
+        tabs: [
60
+          { title: 'Pending',},
61
+          { title: 'Paired',},
62
+        ],
63
+        paired: ['x'],
64
+        pending: ['f'],
65
+    }),
66
+    methods: {
67
+        /** Gets called from cardMixin */
68
+        async getCards() {
69
+            this.loading = true
70
+            try {
71
+                const pending = await fetchQueueByProfileId(this.pid)
72
+                this.pending = this._reformat(pending,converGroupingToCard)
73
+                const paired = await fetchMembershipsByProfileId(this.pid)
74
+                this.paired = this._reformat(paired,convertToCard)
75
+            } catch (err) {
76
+                console.error(err)
77
+            }
78
+            this.loading = false
79
+        },
80
+    },
81
+}
82
+</script>
83
+<style>
84
+.select--matches{
85
+    display: flex;
86
+    justify-content: space-between;
87
+    margin: 0 25px;
88
+}
89
+.select--matches > div{
90
+    width: 100%;
91
+    text-align: center;
92
+    font-size: 16px;
93
+    line-height: 40px;
94
+}
95
+.active{
96
+    border-bottom: 3px solid #F2CD5C;
97
+    color: #F2CD5C;
98
+}
99
+.idle{
100
+    color: #BCC5D3;
101
+}
102
+
103
+</style>

Loading…
Annulla
Salva