|
@@ -0,0 +1,130 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="container">
|
|
|
|
+ <aside class="sidebar">
|
|
|
|
+ <header>Application Title</header>
|
|
|
|
+ <ul class="contact-list">
|
|
|
|
+ <li v-for="contact in contacts" :key="contact.id" @click="selectContact(contact)">
|
|
|
|
+ {{ contact.name }}
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ </aside>
|
|
|
|
+ <main class="chat-area">
|
|
|
|
+ <div class="message-bubble" v-for="message in messages" :key="message.id">
|
|
|
|
+ <div :class="['bubble', {'sent': message.sent}, {'received': !message.sent}]">
|
|
|
|
+ {{ message.text }}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <footer>
|
|
|
|
+ <input v-model="newMessageText" @keyup.enter="sendMessage" placeholder="Type a message...">
|
|
|
|
+ <button @click="sendMessage">Send</button>
|
|
|
|
+ <input type="file" @change="handleFileUpload">
|
|
|
|
+ </footer>
|
|
|
|
+ </main>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ contacts: [
|
|
|
|
+ { id: 1, name: 'Alice' },
|
|
|
|
+ { id: 2, name: 'Bob' },
|
|
|
|
+ { id: 3, name: 'Charlie' },
|
|
|
|
+ ],
|
|
|
|
+ selectedContact: null,
|
|
|
|
+ messages: [],
|
|
|
|
+ newMessageText: '',
|
|
|
|
+ newFile: null,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ selectContact(contact) {
|
|
|
|
+ this.selectedContact = contact;
|
|
|
|
+ // Fetch messages for the selected contact
|
|
|
|
+ this.messages = [
|
|
|
|
+ { id: 1, text: 'Hello!', sent: true },
|
|
|
|
+ { id: 2, text: 'Hi there!', sent: false },
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
+ sendMessage() {
|
|
|
|
+ if (this.newMessageText.trim()) {
|
|
|
|
+ this.messages.push({ id: this.messages.length + 1, text: this.newMessageText, sent: true });
|
|
|
|
+ this.newMessageText = '';
|
|
|
|
+ }
|
|
|
|
+ if (this.newFile) {
|
|
|
|
+ // Handle file upload logic
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleFileUpload(event) {
|
|
|
|
+ this.newFile = event.target.files[0];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.container {
|
|
|
|
+ display: flex;
|
|
|
|
+ height: 100vh;
|
|
|
|
+}
|
|
|
|
+.sidebar {
|
|
|
|
+ width: 250px;
|
|
|
|
+ background-color: #f0f2f5;
|
|
|
|
+ color: white;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+}
|
|
|
|
+.contact-list {
|
|
|
|
+ list-style-type: none;
|
|
|
|
+ padding: 0;
|
|
|
|
+}
|
|
|
|
+.contact-list li {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ border-bottom: 1px solid #ddd;
|
|
|
|
+}
|
|
|
|
+.chat-area {
|
|
|
|
+ flex-grow: 1;
|
|
|
|
+ background-image: url('/assets/img/project_view.png');
|
|
|
|
+ background-size: cover;
|
|
|
|
+ color: black;
|
|
|
|
+}
|
|
|
|
+.message-bubble .bubble {
|
|
|
|
+ margin: 10px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ word-wrap: break-word;
|
|
|
|
+}
|
|
|
|
+.message-bubble.sent {
|
|
|
|
+ background-color: purple;
|
|
|
|
+ color: white;
|
|
|
|
+}
|
|
|
|
+.message-bubble.received {
|
|
|
|
+ background-color: lightgray;
|
|
|
|
+}
|
|
|
|
+footer {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 10px;
|
|
|
|
+}
|
|
|
|
+footer input[type="text"] {
|
|
|
|
+ flex-grow: 1;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 5px;
|
|
|
|
+}
|
|
|
|
+footer button {
|
|
|
|
+ margin-left: 10px;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ background-color: purple;
|
|
|
|
+ color: white;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ padding: 5px 10px;
|
|
|
|
+}
|
|
|
|
+footer input[type="file"] {
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ background-color: purple;
|
|
|
|
+ color: white;
|
|
|
|
+ padding: 5px;
|
|
|
|
+ margin-left: 10px;
|
|
|
|
+}
|
|
|
|
+</style>
|