File size: 17,374 Bytes
1aea2a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ChatterBox - Online Messaging App</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* Custom scrollbar */
        .custom-scrollbar::-webkit-scrollbar {
            width: 6px;
        }
        .custom-scrollbar::-webkit-scrollbar-track {
            background: #f1f1f1;
        }
        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 3px;
        }
        .custom-scrollbar::-webkit-scrollbar-thumb:hover {
            background: #555;
        }
        
        /* Message typing animation */
        @keyframes typing {
            from { width: 0 }
            to { width: 100% }
        }
        
        .typing-indicator::after {
            content: '...';
            display: inline-block;
            width: 0;
            animation: typing 1.5s steps(3, end) infinite;
            overflow: hidden;
            vertical-align: bottom;
        }
        
        /* Message bubble animation */
        @keyframes messageAppear {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .message-animation {
            animation: messageAppear 0.3s ease-out forwards;
        }
    </style>
</head>
<body class="bg-gray-100 h-screen flex items-center justify-center">
    <div class="w-full max-w-4xl h-[90vh] bg-white rounded-2xl shadow-xl overflow-hidden flex flex-col">
        <!-- Header -->
        <div class="bg-indigo-600 text-white p-4 flex items-center justify-between">
            <div class="flex items-center space-x-3">
                <div class="w-10 h-10 rounded-full bg-indigo-500 flex items-center justify-center">
                    <i class="fas fa-comments text-xl"></i>
                </div>
                <h1 class="text-xl font-bold">ChatterBox</h1>
            </div>
            <div class="flex items-center space-x-4">
                <button class="p-2 rounded-full hover:bg-indigo-500 transition">
                    <i class="fas fa-search"></i>
                </button>
                <button class="p-2 rounded-full hover:bg-indigo-500 transition">
                    <i class="fas fa-ellipsis-v"></i>
                </button>
            </div>
        </div>
        
        <!-- Chat area -->
        <div class="flex-1 flex overflow-hidden">
            <!-- Sidebar -->
            <div class="w-1/3 border-r border-gray-200 bg-gray-50 flex flex-col">
                <div class="p-3 border-b border-gray-200">
                    <div class="relative">
                        <input type="text" placeholder="Search conversations..." 
                               class="w-full bg-gray-100 rounded-full py-2 px-4 pl-10 focus:outline-none focus:ring-2 focus:ring-indigo-300">
                        <i class="fas fa-search absolute left-3 top-2.5 text-gray-500"></i>
                    </div>
                </div>
                
                <div class="flex-1 overflow-y-auto custom-scrollbar">
                    <!-- Conversation list -->
                    <div class="space-y-1 p-2">
                        <!-- Active conversation -->
                        <div class="bg-indigo-100 rounded-lg p-3 cursor-pointer flex items-center space-x-3">
                            <div class="relative">
                                <div class="w-10 h-10 rounded-full bg-indigo-300 flex items-center justify-center">
                                    <i class="fas fa-user text-indigo-700"></i>
                                </div>
                                <span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>
                            </div>
                            <div class="flex-1 min-w-0">
                                <h3 class="font-semibold text-indigo-900 truncate">John Doe</h3>
                                <p class="text-sm text-gray-600 truncate">Hey, how are you doing?</p>
                            </div>
                            <div class="text-xs text-gray-500">2 min</div>
                        </div>
                        
                        <!-- Other conversations -->
                        <div class="hover:bg-gray-100 rounded-lg p-3 cursor-pointer flex items-center space-x-3">
                            <div class="w-10 h-10 rounded-full bg-pink-200 flex items-center justify-center">
                                <i class="fas fa-user text-pink-600"></i>
                            </div>
                            <div class="flex-1 min-w-0">
                                <h3 class="font-semibold truncate">Jane Smith</h3>
                                <p class="text-sm text-gray-600 truncate">Meeting at 3pm tomorrow</p>
                            </div>
                            <div class="text-xs text-gray-500">1h</div>
                        </div>
                        
                        <div class="hover:bg-gray-100 rounded-lg p-3 cursor-pointer flex items-center space-x-3">
                            <div class="w-10 h-10 rounded-full bg-blue-200 flex items-center justify-center">
                                <i class="fas fa-user text-blue-600"></i>
                            </div>
                            <div class="flex-1 min-w-0">
                                <h3 class="font-semibold truncate">Team Group</h3>
                                <p class="text-sm text-gray-600 truncate">Alex: I'll send the files</p>
                            </div>
                            <div class="text-xs text-gray-500">5h</div>
                        </div>
                        
                        <!-- More conversations -->
                        <div class="hover:bg-gray-100 rounded-lg p-3 cursor-pointer flex items-center space-x-3">
                            <div class="w-10 h-10 rounded-full bg-green-200 flex items-center justify-center">
                                <i class="fas fa-user text-green-600"></i>
                            </div>
                            <div class="flex-1 min-w-0">
                                <h3 class="font-semibold truncate">Mom</h3>
                                <p class="text-sm text-gray-600 truncate">Call me when you're free</p>
                            </div>
                            <div class="text-xs text-gray-500">Yesterday</div>
                        </div>
                    </div>
                </div>
                
                <!-- User profile -->
                <div class="p-3 border-t border-gray-200 flex items-center space-x-3 bg-white">
                    <div class="w-10 h-10 rounded-full bg-purple-200 flex items-center justify-center">
                        <i class="fas fa-user text-purple-600"></i>
                    </div>
                    <div class="flex-1 min-w-0">
                        <h3 class="font-semibold truncate">You</h3>
                        <p class="text-xs text-gray-500 truncate">Online</p>
                    </div>
                    <button class="p-2 rounded-full hover:bg-gray-100">
                        <i class="fas fa-cog text-gray-500"></i>
                    </button>
                </div>
            </div>
            
            <!-- Main chat -->
            <div class="flex-1 flex flex-col">
                <!-- Chat header -->
                <div class="p-3 border-b border-gray-200 flex items-center space-x-3">
                    <div class="relative">
                        <div class="w-10 h-10 rounded-full bg-indigo-300 flex items-center justify-center">
                            <i class="fas fa-user text-indigo-700"></i>
                        </div>
                        <span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>
                    </div>
                    <div class="flex-1">
                        <h3 class="font-semibold">John Doe</h3>
                        <p class="text-xs text-gray-500">Online</p>
                    </div>
                    <div class="flex space-x-2">
                        <button class="p-2 rounded-full hover:bg-gray-100">
                            <i class="fas fa-phone text-gray-600"></i>
                        </button>
                        <button class="p-2 rounded-full hover:bg-gray-100">
                            <i class="fas fa-video text-gray-600"></i>
                        </button>
                        <button class="p-2 rounded-full hover:bg-gray-100">
                            <i class="fas fa-info-circle text-gray-600"></i>
                        </button>
                    </div>
                </div>
                
                <!-- Messages -->
                <div class="flex-1 p-4 overflow-y-auto custom-scrollbar bg-gray-50" id="messagesContainer">
                    <!-- Date divider -->
                    <div class="flex items-center my-4">
                        <div class="flex-1 border-t border-gray-300"></div>
                        <span class="px-3 text-sm text-gray-500">Today</span>
                        <div class="flex-1 border-t border-gray-300"></div>
                    </div>
                    
                    <!-- Messages will be added here by JavaScript -->
                </div>
                
                <!-- Message input -->
                <div class="p-3 border-t border-gray-200 bg-white">
                    <div class="flex items-center space-x-2">
                        <button class="p-2 rounded-full hover:bg-gray-100 text-gray-600">
                            <i class="fas fa-paperclip"></i>
                        </button>
                        <button class="p-2 rounded-full hover:bg-gray-100 text-gray-600">
                            <i class="fas fa-image"></i>
                        </button>
                        <div class="flex-1 relative">
                            <input type="text" id="messageInput" placeholder="Type a message..." 
                                   class="w-full bg-gray-100 rounded-full py-2 px-4 pr-10 focus:outline-none focus:ring-2 focus:ring-indigo-300">
                            <button class="absolute right-2 top-1.5 text-gray-500 hover:text-indigo-600">
                                <i class="far fa-smile"></i>
                            </button>
                        </div>
                        <button id="sendButton" class="p-2 rounded-full bg-indigo-600 text-white hover:bg-indigo-700">
                            <i class="fas fa-paper-plane"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const messagesContainer = document.getElementById('messagesContainer');
            const messageInput = document.getElementById('messageInput');
            const sendButton = document.getElementById('sendButton');
            
            // Sample messages data
            const messages = [
                {
                    sender: 'other',
                    text: 'Hey there! How are you doing?',
                    time: '10:30 AM'
                },
                {
                    sender: 'me',
                    text: 'I\'m good, thanks! Just working on some projects.',
                    time: '10:32 AM'
                },
                {
                    sender: 'other',
                    text: 'That sounds interesting. What kind of projects?',
                    time: '10:33 AM'
                },
                {
                    sender: 'other',
                    text: 'I was thinking we could collaborate on something if you\'re interested.',
                    time: '10:33 AM'
                }
            ];
            
            // Display initial messages
            messages.forEach((message, index) => {
                addMessage(message.sender, message.text, message.time, index * 100);
            });
            
            // Send message function
            function sendMessage() {
                const text = messageInput.value.trim();
                if (text) {
                    addMessage('me', text, getCurrentTime(), 0);
                    messageInput.value = '';
                    
                    // Simulate reply after 1-3 seconds
                    setTimeout(() => {
                        const replies = [
                            "That's interesting!",
                            "I see what you mean.",
                            "Let me think about that...",
                            "Sounds good to me!",
                            "What else is on your mind?"
                        ];
                        const randomReply = replies[Math.floor(Math.random() * replies.length)];
                        addMessage('other', randomReply, getCurrentTime(), 0);
                    }, 1000 + Math.random() * 2000);
                }
            }
            
            // Add message to the chat
            function addMessage(sender, text, time, delay) {
                const messageDiv = document.createElement('div');
                messageDiv.className = `flex ${sender === 'me' ? 'justify-end' : 'justify-start'} mb-3 opacity-0 message-animation`;
                messageDiv.style.animationDelay = `${delay}ms`;
                
                messageDiv.innerHTML = `
                    <div class="max-w-xs lg:max-w-md px-4 py-2 rounded-lg ${sender === 'me' ? 'bg-indigo-600 text-white rounded-tr-none' : 'bg-white text-gray-800 rounded-tl-none shadow'}">
                        <div class="text-sm">${text}</div>
                        <div class="text-right mt-1">
                            <span class="text-xs ${sender === 'me' ? 'text-indigo-200' : 'text-gray-500'}">${time}</span>
                            ${sender === 'me' ? '<i class="fas fa-check-double ml-1 text-xs text-indigo-200"></i>' : ''}
                        </div>
                    </div>
                `;
                
                messagesContainer.appendChild(messageDiv);
                messagesContainer.scrollTop = messagesContainer.scrollHeight;
            }
            
            // Get current time in HH:MM AM/PM format
            function getCurrentTime() {
                const now = new Date();
                let hours = now.getHours();
                const minutes = now.getMinutes().toString().padStart(2, '0');
                const ampm = hours >= 12 ? 'PM' : 'AM';
                hours = hours % 12;
                hours = hours ? hours : 12; // the hour '0' should be '12'
                return `${hours}:${minutes} ${ampm}`;
            }
            
            // Event listeners
            sendButton.addEventListener('click', sendMessage);
            messageInput.addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    sendMessage();
                }
            });
            
            // Simulate typing indicator
            function showTypingIndicator() {
                const typingDiv = document.createElement('div');
                typingDiv.className = 'flex justify-start mb-3';
                typingDiv.innerHTML = `
                    <div class="px-4 py-2 rounded-lg bg-white text-gray-800 rounded-tl-none shadow">
                        <div class="text-sm typing-indicator">Typing</div>
                    </div>
                `;
                messagesContainer.appendChild(typingDiv);
                messagesContainer.scrollTop = messagesContainer.scrollHeight;
                
                // Remove after 2 seconds
                setTimeout(() => {
                    typingDiv.remove();
                }, 2000);
            }
            
            // Randomly show typing indicator every 10-20 seconds
            setInterval(() => {
                if (Math.random() > 0.7) { // 30% chance to show typing
                    showTypingIndicator();
                }
            }, 10000 + Math.random() * 10000);
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=PrometheusGroup/my-chat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>