Преглед изворни кода

:wrench: renaming matches to pairview and created messagesview

tags/0.0.1^2
juancarbajal98 пре 3 година
родитељ
комит
3ba06c28eb

+ 1
- 1
docs/processes/login.md Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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`')

+ 22
- 5
frontend/src/components/PairsList.vue Прегледај датотеку

@@ -1,11 +1,15 @@
1 1
 <template lang="pug">
2 2
 section.pairs-list
3
-    article
4
-        .pair(
3
+    article(v-if="pairs.length")
4
+        .pair.w-flex.align-center.justify-space-around(
5 5
             v-for="p in pairs"
6 6
         )
7
-            h3 {{p.name}}
8
-    
7
+            .dot--icon
8
+            .avatar
9
+            .idCard
10
+                p S.R.
11
+                p Registered Nurse  
12
+    p(v-else) No results.    
9 13
 </template>
10 14
 
11 15
 <script setup>
@@ -15,4 +19,17 @@ const props = defineProps({
15 19
         default: () => [{}],
16 20
     },
17 21
 })
18
-</script>
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 Прегледај датотеку

@@ -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,

+ 36
- 0
frontend/src/views/MessagesView.vue Прегледај датотеку

@@ -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>

frontend/src/views/MatchesView.vue → frontend/src/views/PairsView.vue Прегледај датотеку

@@ -1,22 +1,18 @@
1 1
 <template lang="pug">
2 2
 main.view--matches
3
-    .select--matches
4
-        .matches--pending(:class="currentTab =='pending' ? 'active':'idle'" @click="switchTab('pending')") Pending
5
-        .matches--paired(:class="currentTab =='paired' ? 'active':'idle'" @click="switchTab('paired')") Paired
3
+    article(v-if="!loading")
6 4
 
7
-    article.pa12
8
-        //- TODO add and render appropriate lists for both tabs
9
-        template(v-if="currentTab=='pending'")
10
-            PairsList(:list='pendingList')
11
-        template(v-else)
12
-            PairsList(:list='pairedList')
13
-        //- template(v-if='matches.length && !loading')
14
-        //-     h2 atches
15
-        //-     ProfileCardList(:pid='pid' :profiles='matches' @reload='getCards')
16
-
17
-        //- p(v-else-if='matches.length === 0') No matches.
18
-        //- w-spinner(v-else bounce)
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")
19 14
 
15
+    w-spinner(v-else bounce)
20 16
     MainNav
21 17
 </template>
22 18
 
@@ -56,11 +52,16 @@ const converGroupingToCard = grouping => {
56 52
 }
57 53
 
58 54
 export default {
59
-    name: 'MatchView',
55
+    name: 'PairsView',
60 56
     components: { PairsList },
61 57
     mixins: [mixins.pidMixin, mixins.cardMixin],
62 58
     data: () => ({
63
-        currentTab: 'pending'
59
+        tabs: [
60
+          { title: 'Pending',},
61
+          { title: 'Paired',},
62
+        ],
63
+        paired: ['x'],
64
+        pending: ['f'],
64 65
     }),
65 66
     methods: {
66 67
         /** Gets called from cardMixin */
@@ -68,18 +69,14 @@ export default {
68 69
             this.loading = true
69 70
             try {
70 71
                 const pending = await fetchQueueByProfileId(this.pid)
71
-                this.pendingList = this._reformat(pending,converGroupingToCard)
72
+                this.pending = this._reformat(pending,converGroupingToCard)
72 73
                 const paired = await fetchMembershipsByProfileId(this.pid)
73
-                this.PairedList = this._reformat(paired,convertToCard)
74
+                this.paired = this._reformat(paired,convertToCard)
74 75
             } catch (err) {
75 76
                 console.error(err)
76 77
             }
77 78
             this.loading = false
78 79
         },
79
-        switchTab(tab){
80
-            if(this.currentTab === tab) return
81
-            this.currentTab = tab
82
-        }
83 80
     },
84 81
 }
85 82
 </script>

Loading…
Откажи
Сачувај