From fbee80474baf3bfc41656268e22395983811f2f7 Mon Sep 17 00:00:00 2001
From: Roger Braun <rbraun@Bobble.local>
Date: Mon, 4 Dec 2017 19:08:33 +0100
Subject: Basic frontend changes for chat.

---
 src/components/nav_panel/nav_panel.vue | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/components/nav_panel/nav_panel.vue')

diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
index aea841e9..fa4000b0 100644
--- a/src/components/nav_panel/nav_panel.vue
+++ b/src/components/nav_panel/nav_panel.vue
@@ -7,6 +7,11 @@
             {{ $t("nav.timeline") }}
           </router-link>
         </li>
+        <li v-if='currentUser'>
+          <router-link class="base00-background" to='/chat'>
+            {{ $t("nav.chat") }}
+          </router-link>
+        </li>
         <li v-if='currentUser'>
           <router-link class="base00-background" :to="{ name: 'mentions', params: { username: currentUser.screen_name } }">
             {{ $t("nav.mentions") }}
-- 
cgit v1.2.3-70-g09d2


From 6c4e3a509a23a4f683aee02fcd0b186813ae3de0 Mon Sep 17 00:00:00 2001
From: Roger Braun <rbraun@Bobble.local>
Date: Tue, 5 Dec 2017 14:20:34 +0100
Subject: Don't display if we don't have a chat.

---
 src/components/chat/chat.vue           | 2 +-
 src/components/nav_panel/nav_panel.js  | 3 +++
 src/components/nav_panel/nav_panel.vue | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/components/nav_panel/nav_panel.vue')

diff --git a/src/components/chat/chat.vue b/src/components/chat/chat.vue
index 0c397472..488faf9a 100644
--- a/src/components/chat/chat.vue
+++ b/src/components/chat/chat.vue
@@ -7,7 +7,7 @@
     </div>
     <div class="panel-body base01-background">
       <div class="chat-window">
-        <div class="chat-message" v-for="message in messages">
+        <div class="chat-message" v-for="message in messages" :key="message.id">
           <span class="chat-avatar">
             <img :src="message.author.avatar" />
             {{message.author.username}}:
diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js
index baeaaede..ea5d7ea4 100644
--- a/src/components/nav_panel/nav_panel.js
+++ b/src/components/nav_panel/nav_panel.js
@@ -2,6 +2,9 @@ const NavPanel = {
   computed: {
     currentUser () {
       return this.$store.state.users.currentUser
+    },
+    chat () {
+      return this.$store.state.chat.channel
     }
   }
 }
diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
index fa4000b0..ccc772a8 100644
--- a/src/components/nav_panel/nav_panel.vue
+++ b/src/components/nav_panel/nav_panel.vue
@@ -7,7 +7,7 @@
             {{ $t("nav.timeline") }}
           </router-link>
         </li>
-        <li v-if='currentUser'>
+        <li v-if='chat && currentUser'>
           <router-link class="base00-background" to='/chat'>
             {{ $t("nav.chat") }}
           </router-link>
-- 
cgit v1.2.3-70-g09d2

