|
|
@ -1,13 +1,16 @@
|
|
|
|
|
|
|
|
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
//Fix v-if riga 20
|
|
|
|
//Fix v-if riga 20
|
|
|
|
import ChatPreview from "@/components/ChatPreview.vue";
|
|
|
|
import ChatPreview from "@/components/ChatPreview.vue";
|
|
|
|
import ChatView from "@/components/single_chat/ChatView.vue";
|
|
|
|
import ChatView from "./single_chat/ChatView.vue";
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<!-- Fix nested conditions in ChatPreview -->
|
|
|
|
<div id="background chat-list">
|
|
|
|
<div id="background chat-list">
|
|
|
|
<ChatPreview
|
|
|
|
<ChatPreview
|
|
|
|
v-for="chat in $options.demo_chats.history"
|
|
|
|
v-for="chat in $options.demo_chats.history"
|
|
|
|
|
|
|
|
v-if="!selectedChat"
|
|
|
|
:key="chat.id"
|
|
|
|
:key="chat.id"
|
|
|
|
:chat-picture="chat.picture"
|
|
|
|
:chat-picture="chat.picture"
|
|
|
|
:chat-name="chat.name"
|
|
|
|
:chat-name="chat.name"
|
|
|
@ -17,7 +20,7 @@ import ChatView from "@/components/single_chat/ChatView.vue";
|
|
|
|
:chat-new-messages="chat.new_messages"
|
|
|
|
:chat-new-messages="chat.new_messages"
|
|
|
|
@click="showChat(chat)"
|
|
|
|
@click="showChat(chat)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<ChatView v-if="selectedChat" />
|
|
|
|
<ChatView v-if="selectedChat" :chat-id="chatId" @hideChat="hideChat" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
@ -25,15 +28,18 @@ import ChatView from "@/components/single_chat/ChatView.vue";
|
|
|
|
import demo_chats_json from "../assets/demo_chats.json";
|
|
|
|
import demo_chats_json from "../assets/demo_chats.json";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
demo_chats: demo_chats_json,
|
|
|
|
demo_chats: demo_chats_json,
|
|
|
|
selectedChat: false,
|
|
|
|
data() {
|
|
|
|
chatId: Number,
|
|
|
|
return { selectedChat: false, chatId: null };
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
showChat(chat) {
|
|
|
|
showChat(chat) {
|
|
|
|
console.log(chat);
|
|
|
|
|
|
|
|
this.$emit("change-header", [chat.picture, chat.name]);
|
|
|
|
this.$emit("change-header", [chat.picture, chat.name]);
|
|
|
|
this.selectedChat = true;
|
|
|
|
this.selectedChat = !this.selectedChat;
|
|
|
|
this.chatId = chat.id;
|
|
|
|
this.chatId = chat.id;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
hideChat() {
|
|
|
|
|
|
|
|
this.selectedChat = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|