ChatMsg funzionanti, da stilizzare

feature_keyboard
reddigriz 2 years ago
parent f48095e150
commit ce0b73fdf9

@ -2,63 +2,45 @@
"history": [ "history": [
{ {
"id": 1, "id": 1,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name1", "is_user": false,
"last_message": "🐱⛸️➡️?",
"seen": false, "seen": false,
"date": "25/08/22", "date": "22/09 12:12"
"new_messages": 1,
"is_user": false
}, },
{ {
"id": 2, "id": 2,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name2", "is_user": true,
"last_message": "🐱⛸️➡️?", "seen": true,
"seen": false, "date": "22/09 12:12"
"date": "25/08/22",
"new_messages": 1,
"is_user": true
}, },
{ {
"id": 3, "id": 3,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name3", "is_user": false,
"last_message": "🐱⛸️➡️?", "seen": true,
"seen": false, "date": "22/09 12:12"
"date": "25/08/22",
"new_messages": 1,
"is_user": false
}, },
{ {
"id": 4, "id": 4,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name4", "is_user": true,
"last_message": "🐱⛸️➡️?", "seen": true,
"seen": false, "date": "22/09 12:12"
"date": "25/08/22",
"new_messages": 1,
"is_user": true
}, },
{ {
"id": 5, "id": 5,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name5", "is_user": false,
"last_message": "🐱⛸️➡️?",
"seen": false, "seen": false,
"date": "25/08/22", "date": "22/09 12:12"
"new_messages": 1,
"is_user": false
}, },
{ {
"id": 6, "id": 6,
"picture": "../assets/cat_skate.png", "text": "🐱⛸️➡️?",
"name": "test-name6", "is_user": true,
"last_message": "🐱⛸️➡️?", "seen": true,
"seen": false, "date": "22/09 12:12"
"date": "25/08/22",
"new_messages": 1,
"is_user": true
} }
] ]
} }

@ -1,7 +1,7 @@
<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 "./ChatView.vue"; import ChatView from "@/components/single_chat/ChatView.vue";
</script> </script>
<template> <template>
@ -17,7 +17,7 @@ import ChatView from "./ChatView.vue";
:chat-new-messages="chat.new_messages" :chat-new-messages="chat.new_messages"
@click="showChat(chat)" @click="showChat(chat)"
/> />
<ChatView v-if="selected-chat" /> <ChatView v-if="selectedChat" />
</div> </div>
</template> </template>
@ -26,10 +26,13 @@ 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, selectedChat: false,
chatId: Number,
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 = true;
this.chatId = chat.id;
}, },
}, },
}; };

@ -1,5 +1,5 @@
<template> <template>
<div class="msg-composition"></div> <div class="msg-composition"><p>I'm writing hereee</p></div>
</template> </template>
<style scoped></style> <style scoped></style>

@ -7,18 +7,22 @@ import ChatMsg from "./ChatMsg.vue";
per permettero lo scrolling e una dimensione fissa --> per permettero lo scrolling e una dimensione fissa -->
<div id="ChatHistory"> <div id="ChatHistory">
<ChatMsg v-for="message in $options.demo_messages.history" :key="message.id" <ChatMsg
:messageText="message.text" v-for="message in $options.demo_messages.history"
:isUser="message.user" :key="message.id"
:message-text="message.text"
:is-user="message.is_user"
:message-seen="message.seen"
:message-date="message.date"
/> />
</div> </div>
</template> </template>
<script> <script>
import demo_messages_json from "@/assets/demo_messages.json";
export default { export default {
components: {}, demo_messages: demo_messages_json,
setup() {},
}; };
</script> </script>

@ -4,15 +4,23 @@
class="bubble bubble-bottom-left" class="bubble bubble-bottom-left"
> >
<p>{{ messageText }}</p> <p>{{ messageText }}</p>
<div class="message-seen" color="green">
<p v-if="messageSeen"></p>
<p v-else></p>
<p>{{messageDate}}</p>
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
// Change messageDate type to Date
setup() {}, setup() {},
props: { props: {
messageText: String, messageText: String,
isUser: Boolean, isUser: Boolean,
messageSeen: Boolean,
messageDate: String,
}, },
}; };
</script> </script>

Loading…
Cancel
Save