ChatMsg funzionanti, da stilizzare

feature_keyboard
reddigriz 2 years ago
parent f48095e150
commit ce0b73fdf9

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

@ -1,7 +1,7 @@
<script setup>
//Fix v-if riga 20
import ChatPreview from "@/components/ChatPreview.vue";
import ChatView from "./ChatView.vue";
import ChatView from "@/components/single_chat/ChatView.vue";
</script>
<template>
@ -17,7 +17,7 @@ import ChatView from "./ChatView.vue";
:chat-new-messages="chat.new_messages"
@click="showChat(chat)"
/>
<ChatView v-if="selected-chat" />
<ChatView v-if="selectedChat" />
</div>
</template>
@ -26,10 +26,13 @@ import demo_chats_json from "../assets/demo_chats.json";
export default {
demo_chats: demo_chats_json,
selectedChat: false,
chatId: Number,
methods: {
showChat(chat) {
console.log(chat);
this.$emit("change-header", [chat.picture, chat.name]);
this.selectedChat = true;
this.chatId = chat.id;
},
},
};

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

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

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

Loading…
Cancel
Save