Parcourir la source

:recycle: using groupings for individual chat view

tags/0.0.1^2
J il y a 3 ans
Parent
révision
67f9f74816

+ 1
- 1
frontend/src/components/Messages.vue Voir le fichier

1
 <template lang="pug">
1
 <template lang="pug">
2
 .sidebar--messages
2
 .sidebar--messages
3
-  h5.message__title messages from matches
3
+  h5.message__title matches
4
   router-link(
4
   router-link(
5
         :to="`/chats/${match.profile.profile_id}`" 
5
         :to="`/chats/${match.profile.profile_id}`" 
6
         v-for='match in matches' 
6
         v-for='match in matches' 

+ 4
- 4
frontend/src/components/SideBar.vue Voir le fichier

1
 <template lang="pug">
1
 <template lang="pug">
2
-aside.sidebar
3
-    p(v-if="profile.isLoggedIn") chans: {{profile.groupings}}
4
-    .temp-control-box
2
+aside.sidebar.w-flex.column.pa8
3
+    Messages(:matches="matches" :pid="pid")
4
+    .spacer
5
+    nav.temp-control-box
5
         input(v-model="switchToPID" @keyup.enter="$emit('updatePid', switchToPID)")
6
         input(v-model="switchToPID" @keyup.enter="$emit('updatePid', switchToPID)")
6
         button(@click="$emit('updatePid', switchToPID)") switch profile
7
         button(@click="$emit('updatePid', switchToPID)") switch profile
7
     
8
     
8
-    Messages(:matches="matches" :pid="pid")
9
 </template>
9
 </template>
10
 
10
 
11
 <script>
11
 <script>

+ 9
- 8
frontend/src/views/ChatView.vue Voir le fichier

3
     header 
3
     header 
4
         h2 Chat Page
4
         h2 Chat Page
5
  
5
  
6
-    article(v-if="!loading && target && profile.isLoggedIn")
6
+    article(v-if="profile.isLoggedIn && target")
7
         h3 {{ profile.id }} 
7
         h3 {{ profile.id }} 
8
             span chatting with: {{ target.profile_id }}
8
             span chatting with: {{ target.profile_id }}
9
         p subscriptions: {{ profile.chatter.subscriptions }}
9
         p subscriptions: {{ profile.chatter.subscriptions }}
10
+        p target: {{ target }}
10
     
11
     
12
+    p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.tid }} and {{profile.id}}... 
11
     p(v-else) Loading...
13
     p(v-else) Loading...
12
 
14
 
13
     MainNav(@show-sidebar="$emit('show-sidebar')")
15
     MainNav(@show-sidebar="$emit('show-sidebar')")
14
 </template>
16
 </template>
15
 
17
 
16
 <script>
18
 <script>
17
-import { fetchProfileByProfileId, currentProfile } from '../services'
19
+import { currentProfile } from '../services'
18
 
20
 
19
 export default {
21
 export default {
20
     name: 'ProfileView',
22
     name: 'ProfileView',
21
     data: () => ({
23
     data: () => ({
22
-        loading: true,
23
-        target: {},
24
+        target: null,
24
     }),
25
     }),
25
     computed: {
26
     computed: {
26
         profile: () => currentProfile,
27
         profile: () => currentProfile,
36
     },
37
     },
37
     methods: {
38
     methods: {
38
         async loadTargetProfile() {
39
         async loadTargetProfile() {
39
-            this.loading = true
40
             try {
40
             try {
41
-                this.target = await fetchProfileByProfileId(
42
-                    this.$route.params.tid,
41
+                const match = this.profile.groupings.find(
42
+                    grouping =>
43
+                        grouping.profile.profile_id == this.$route.params.tid,
43
                 )
44
                 )
45
+                this.target = match.profile
44
             } catch (err) {
46
             } catch (err) {
45
                 console.error(err)
47
                 console.error(err)
46
             }
48
             }
47
-            this.loading = false
48
         },
49
         },
49
     },
50
     },
50
 }
51
 }

Chargement…
Annuler
Enregistrer