File size: 15,553 Bytes
4a1c18b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>QuickChat Express - Chat</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        .chat-container {
            height: calc(100vh - 140px);
        }
        .messages-container {
            height: calc(100% - 70px);
        }
        .chat-bubble {
            animation: fadeIn 0.3s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .online-indicator {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            position: absolute;
            bottom: 0;
            right: 0;
            border: 2px solid #1f2937;
        }
    </style>
</head>
<body class="bg-gray-900 text-white">
    <div class="flex flex-col h-screen">
        <!-- Header -->
        <header class="bg-gray-800 px-4 py-3 flex justify-between items-center border-b border-gray-700">
            <div class="flex items-center space-x-3">
                <img src="http://static.photos/people/200x200/1" alt="Profile" class="w-10 h-10 rounded-full">
                <div>
                    <h1 class="font-medium">QuickChat Express</h1>
                    <p class="text-xs text-gray-400 flex items-center">
                        <span class="w-2 h-2 bg-green-500 rounded-full mr-1"></span>
                        Online
                    </p>
                </div>
            </div>
            <div class="flex items-center space-x-4">
                <button class="p-2 rounded-full hover:bg-gray-700 transition">
                    <i data-feather="search"></i>
                </button>
                <button class="p-2 rounded-full hover:bg-gray-700 transition">
                    <i data-feather="more-vertical"></i>
                </button>
            </div>
        </header>

        <!-- Main Chat Area -->
        <div class="flex flex-1 overflow-hidden">
            <!-- Sidebar -->
            <aside class="w-80 bg-gray-800 border-r border-gray-700 flex flex-col hidden md:flex">
                <div class="p-4 border-b border-gray-700">
                    <div class="relative">
                        <input type="text" placeholder="Search conversations..." class="w-full bg-gray-700 rounded-lg px-4 py-2 pl-10 focus:outline-none focus:ring-1 focus:ring-blue-500">
                        <i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
                    </div>
                </div>
                <div class="flex-1 overflow-y-auto">
                    <!-- Online Users -->
                    <div class="px-4 py-3">
                        <h3 class="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2">Online Now (3)</h3>
                        <div class="space-y-2">
                            <div class="flex items-center p-2 rounded-lg hover:bg-gray-700 cursor-pointer transition">
                                <div class="relative">
                                    <img src="http://static.photos/people/200x200/2" alt="User" class="w-10 h-10 rounded-full">
                                    <span class="online-indicator bg-green-500"></span>
                                </div>
                                <div class="ml-3">
                                    <p class="font-medium">Alex Johnson</p>
                                    <p class="text-xs text-gray-400">Hi there!</p>
                                </div>
                            </div>
                            <div class="flex items-center p-2 rounded-lg hover:bg-gray-700 cursor-pointer transition">
                                <div class="relative">
                                    <img src="http://static.photos/people/200x200/3" alt="User" class="w-10 h-10 rounded-full">
                                    <span class="online-indicator bg-green-500"></span>
                                </div>
                                <div class="ml-3">
                                    <p class="font-medium">Maria Garcia</p>
                                    <p class="text-xs text-gray-400">Available</p>
                                </div>
                            </div>
                            <div class="flex items-center p-2 rounded-lg hover:bg-gray-700 cursor-pointer transition">
                                <div class="relative">
                                    <img src="http://static.photos/people/200x200/4" alt="User" class="w-10 h-10 rounded-full">
                                    <span class="online-indicator bg-green-500"></span>
                                </div>
                                <div class="ml-3">
                                    <p class="font-medium">Sam Wilson</p>
                                    <p class="text-xs text-gray-400">Let's chat!</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Recent Conversations -->
                    <div class="px-4 py-3 border-t border-gray-700">
                        <h3 class="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2">Recent Chats</h3>
                        <div class="space-y-2">
                            <div class="flex items-center p-2 rounded-lg hover:bg-gray-700 cursor-pointer transition">
                                <img src="http://static.photos/people/200x200/5" alt="User" class="w-10 h-10 rounded-full">
                                <div class="ml-3">
                                    <p class="font-medium">Tech Group</p>
                                    <p class="text-xs text-gray-400">Jordan: Check out this new framework</p>
                                </div>
                            </div>
                            <div class="flex items-center p-2 rounded-lg hover:bg-gray-700 cursor-pointer transition">
                                <img src="http://static.photos/people/200x200/6" alt="User" class="w-10 h-10 rounded-full">
                                <div class="ml-3">
                                    <p class="font-medium">Emma Thompson</p>
                                    <p class="text-xs text-gray-400">See you tomorrow!</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </aside>

            <!-- Chat Area -->
            <main class="flex-1 flex flex-col">
                <!-- Chat header -->
                <div class="bg-gray-800 px-4 py-3 flex items-center border-b border-gray-700">
                    <div class="flex items-center space-x-3">
                        <div class="relative">
                            <img src="http://static.photos/people/200x200/2" alt="User" class="w-10 h-10 rounded-full">
                            <span class="online-indicator bg-green-500"></span>
                        </div>
                        <div>
                            <h2 class="font-medium">Alex Johnson</h2>
                            <p class="text-xs text-gray-400 flex items-center">
                                <span class="w-2 h-2 bg-green-500 rounded-full mr-1"></span>
                                Active now
                            </p>
                        </div>
                    </div>
                    <div class="ml-auto flex items-center space-x-4">
                        <button class="p-2 rounded-full hover:bg-gray-700 transition">
                            <i data-feather="phone"></i>
                        </button>
                        <button class="p-2 rounded-full hover:bg-gray-700 transition">
                            <i data-feather="video"></i>
                        </button>
                        <button class="p-2 rounded-full hover:bg-gray-700 transition">
                            <i data-feather="info"></i>
                        </button>
                    </div>
                </div>

                <!-- Messages -->
                <div class="messages-container overflow-y-auto p-4 space-y-4 flex-1">
                    <!-- Date divider -->
                    <div class="flex items-center my-4">
                        <div class="flex-1 h-px bg-gray-700"></div>
                        <span class="px-3 text-xs text-gray-400">Today</span>
                        <div class="flex-1 h-px bg-gray-700"></div>
                    </div>

                    <!-- Received message -->
                    <div class="flex items-start space-x-2">
                        <img src="http://static.photos/people/200x200/2" alt="User" class="w-8 h-8 rounded-full mt-1">
                        <div class="max-w-xs md:max-w-md">
                            <div class="bg-gray-700 rounded-lg p-3 rounded-tl-none chat-bubble">
                                <p>Hey there! How's it going?</p>
                            </div>
                            <p class="text-xs text-gray-400 mt-1">2:34 PM</p>
                        </div>
                    </div>

                    <!-- Sent message -->
                    <div class="flex justify-end">
                        <div class="max-w-xs md:max-w-md">
                            <div class="bg-blue-600 rounded-lg p-3 rounded-tr-none chat-bubble">
                                <p>I'm doing great! Just finished setting up this new chat app.</p>
                            </div>
                            <p class="text-xs text-gray-400 mt-1 text-right">2:36 PM</p>
                        </div>
                    </div>

                    <!-- Received message -->
                    <div class="flex items-start space-x-2">
                        <img src="http://static.photos/people/200x200/2" alt="User" class="w-8 h-8 rounded-full mt-1">
                        <div class="max-w-xs md:max-w-md">
                            <div class="bg-gray-700 rounded-lg p-3 rounded-tl-none chat-bubble">
                                <p>That's awesome! It looks really clean. What tech did you use?</p>
                            </div>
                            <p class="text-xs text-gray-400 mt-1">2:38 PM</p>
                        </div>
                    </div>

                    <!-- Sent message -->
                    <div class="flex justify-end">
                        <div class="max-w-xs md:max-w-md">
                            <div class="bg-blue-600 rounded-lg p-3 rounded-tr-none chat-bubble">
                                <p>Thanks! Using TailwindCSS for styling and vanilla JS for the interactions. The backend is Node.js with WebSockets.</p>
                            </div>
                            <p class="text-xs text-gray-400 mt-1 text-right">2:40 PM</p>
                        </div>
                    </div>
                </div>

                <!-- Message input -->
                <div class="p-4 border-t border-gray-700">
                    <form class="flex items-center space-x-2">
                        <button type="button" class="p-2 rounded-full hover:bg-gray-700 transition">
                            <i data-feather="plus"></i>
                        </button>
                        <div class="flex-1 relative">
                            <input type="text" placeholder="Type your message here..." class="w-full bg-gray-700 rounded-full px-4 py-2 pl-10 pr-12 focus:outline-none focus:ring-1 focus:ring-blue-500">
                            <i data-feather="smile" class="absolute left-3 top-2.5 text-gray-400"></i>
                        </div>
                        <button type="submit" class="p-2 rounded-full bg-blue-600 hover:bg-blue-700 transition">
                            <i data-feather="send"></i>
                        </button>
                    </form>
                </div>
            </main>
        </div>
    </div>

    <script>
        // In a real app, you would connect to a WebSocket server here
        // and handle real-time messaging functionality

        // For demo purposes, we'll simulate sending a message
        const messageForm = document.querySelector('form');
        const messagesContainer = document.querySelector('.messages-container');

        messageForm.addEventListener('submit', (e) => {
            e.preventDefault();
            const input = messageForm.querySelector('input');
            const message = input.value.trim();
            
            if (message) {
                // Create new message element
                const messageDiv = document.createElement('div');
                messageDiv.className = 'flex justify-end';
                messageDiv.innerHTML = `
                    <div class="max-w-xs md:max-w-md">
                        <div class="bg-blue-600 rounded-lg p-3 rounded-tr-none chat-bubble">
                            <p>${message}</p>
                        </div>
                        <p class="text-xs text-gray-400 mt-1 text-right">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</p>
                    </div>
                `;
                
                // Add to messages container and scroll to bottom
                messagesContainer.appendChild(messageDiv);
                messagesContainer.scrollTop = messagesContainer.scrollHeight;
                
                // Clear input
                input.value = '';
                
                // Simulate reply after 1-3 seconds
                setTimeout(() => {
                    const replies = [
                        "That's interesting!",
                        "I see what you mean.",
                        "Tell me more about that.",
                        "Nice! How did you do that?",
                        "I'll have to try that myself."
                    ];
                    const randomReply = replies[Math.floor(Math.random() * replies.length)];
                    
                    const replyDiv = document.createElement('div');
                    replyDiv.className = 'flex items-start space-x-2';
                    replyDiv.innerHTML = `
                        <img src="http://static.photos/people/200x200/2" alt="User" class="w-8 h-8 rounded-full mt-1">
                        <div class="max-w-xs md:max-w-md">
                            <div class="bg-gray-700 rounded-lg p-3 rounded-tl-none chat-bubble">
                                <p>${randomReply}</p>
                            </div>
                            <p class="text-xs text-gray-400 mt-1">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</p>
                        </div>
                    `;
                    
                    messagesContainer.appendChild(replyDiv);
                    messagesContainer.scrollTop = messagesContainer.scrollHeight;
                }, 1000 + Math.random() * 2000);
            }
        });

        // Initialize feather icons
        feather.replace();
    </script>
</body>
</html>