Kaynağa Gözat

:recycle: styling the chat view a little bit

tags/0.0.1^2
j 3 yıl önce
ebeveyn
işleme
a139711acf
1 değiştirilmiş dosya ile 35 ekleme ve 20 silme
  1. 35
    20
      frontend/src/views/ChatView.vue

+ 35
- 20
frontend/src/views/ChatView.vue Dosyayı Görüntüle

@@ -1,33 +1,33 @@
1 1
 <template lang="pug">
2 2
 main.view--chat
3
-    header(v-if='profile')
4
-        p {{ profile.chatter }}
5
-        hr
6
-        p messages: {{ messages }}
7
-        hr
3
+    header.mb6(v-if='profile')
4
+        h3 chatting with: {{ target.profile_id }}
8 5
         p subscriptions: {{ profile.chatter.subscriptions }}
9 6
 
10 7
     article(v-if='profile.isLoggedIn && target')
11
-        h3 {{ profile.id }}&nbsp;
12
-            span chatting with: {{ target.profile_id }}
13
-
14 8
         ul#messages.w-flex.column
15
-            //- li.pa1(v-for='(message, i in messages)')
16
-            //-     w-card.w-flex.row
17
-            //-         article
18
-                //- p {{ message.message }}
19
-        //-             footer
20
-        //-                 p {{ message.publisher }} | {{ message.timetoken }}
21
-        //-                 w-button.my12(@click='openDrawer = i' text) setting
22
-        //-             w-drawer(absolute v-model='openDrawer' width='160px')
23
-        //-                 p some settings things
24
-
25
-        input(@keyup.enter='sendMessage' v-model='toSend')
26
-        button(@click='sendMessage') send
9
+            template(v-for='chatmessage in messages')
10
+                li(
11
+                    :class='[{ me: chatmessage.publisher == profile.id.value }, chatmessage.publisher]'
12
+                    v-if='chatmessage.message.description'
13
+                )
14
+                    .message-wrapper.pa4
15
+                        p.pb1
16
+                            span(
17
+                                v-if='chatmessage.publisher == profile.id.value'
18
+                            ) you
19
+                            span(v-else) {{ chatmessage.publisher }}
20
+                            span @{{ new Date(parseInt(chatmessage.timetoken) / 10000).toLocaleTimeString('en-US') }}
21
+                        p {{ chatmessage.message.description }}
27 22
 
28 23
     p(v-else-if='profile.isLoggedIn && !target') No match found between profile {{ $route.params.pid }} and {{ profile.id }}...
29 24
     w-spinner(bounce v-else)
30 25
 
26
+    footer.w-flex.row
27
+        w-input(@keyup.enter='sendMessage' outline v-model='toSend')
28
+        w-button(@click='sendMessage')
29
+            w-icon mdi mdi-send
30
+
31 31
     MainNav
32 32
 </template>
33 33
 
@@ -92,3 +92,18 @@ export default {
92 92
     },
93 93
 }
94 94
 </script>
95
+
96
+<style lang="sass">
97
+main.view--chat
98
+    article ul
99
+        list-style: none
100
+        > li
101
+            font-family: sans-serif
102
+            background-color: powderblue
103
+            margin: 0 0.5em 1em 2em
104
+            &.me
105
+                margin: 0 2em 1em 0.5em
106
+                background-color: lightgreen
107
+            p:first-of-type
108
+                font-size: 10px
109
+</style>

Loading…
İptal
Kaydet