Waternoose commited on
Commit
0125981
·
verified ·
1 Parent(s): a8ac96b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +574 -19
index.html CHANGED
@@ -1,19 +1,574 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>SecureChat - Private Chatroom</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ :root {
10
+ --primary: #6366f1;
11
+ --primary-dark: #4f46e5;
12
+ --secondary: #10b981;
13
+ --dark: #1f2937;
14
+ --light: #f9fafb;
15
+ --gray: #6b7280;
16
+ --danger: #ef4444;
17
+ --success: #10b981;
18
+ }
19
+
20
+ * {
21
+ margin: 0;
22
+ padding: 0;
23
+ box-sizing: border-box;
24
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
25
+ }
26
+
27
+ body {
28
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
29
+ min-height: 100vh;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ padding: 20px;
34
+ }
35
+
36
+ .container {
37
+ display: flex;
38
+ width: 100%;
39
+ max-width: 1200px;
40
+ height: 90vh;
41
+ background: white;
42
+ border-radius: 20px;
43
+ overflow: hidden;
44
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
45
+ }
46
+
47
+ .login-section {
48
+ flex: 1;
49
+ background: white;
50
+ display: flex;
51
+ flex-direction: column;
52
+ justify-content: center;
53
+ align-items: center;
54
+ padding: 40px;
55
+ position: relative;
56
+ }
57
+
58
+ .chat-section {
59
+ flex: 2;
60
+ background: #f8fafc;
61
+ display: none;
62
+ flex-direction: column;
63
+ position: relative;
64
+ }
65
+
66
+ .logo {
67
+ display: flex;
68
+ align-items: center;
69
+ gap: 12px;
70
+ margin-bottom: 40px;
71
+ }
72
+
73
+ .logo i {
74
+ font-size: 2.5rem;
75
+ color: var(--primary);
76
+ }
77
+
78
+ .logo h1 {
79
+ font-size: 2rem;
80
+ color: var(--dark);
81
+ font-weight: 700;
82
+ }
83
+
84
+ .login-form {
85
+ width: 100%;
86
+ max-width: 400px;
87
+ }
88
+
89
+ .form-group {
90
+ margin-bottom: 24px;
91
+ }
92
+
93
+ .form-group label {
94
+ display: block;
95
+ margin-bottom: 8px;
96
+ font-weight: 600;
97
+ color: var(--dark);
98
+ }
99
+
100
+ .form-control {
101
+ width: 100%;
102
+ padding: 14px 16px;
103
+ border: 2px solid #e5e7eb;
104
+ border-radius: 12px;
105
+ font-size: 1rem;
106
+ transition: all 0.3s ease;
107
+ }
108
+
109
+ .form-control:focus {
110
+ border-color: var(--primary);
111
+ outline: none;
112
+ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
113
+ }
114
+
115
+ .btn {
116
+ padding: 14px 24px;
117
+ border: none;
118
+ border-radius: 12px;
119
+ font-size: 1rem;
120
+ font-weight: 600;
121
+ cursor: pointer;
122
+ transition: all 0.3s ease;
123
+ width: 100%;
124
+ }
125
+
126
+ .btn-primary {
127
+ background: var(--primary);
128
+ color: white;
129
+ }
130
+
131
+ .btn-primary:hover {
132
+ background: var(--primary-dark);
133
+ transform: translateY(-2px);
134
+ }
135
+
136
+ .btn-secondary {
137
+ background: var(--secondary);
138
+ color: white;
139
+ margin-top: 12px;
140
+ }
141
+
142
+ .btn-secondary:hover {
143
+ background: #0da271;
144
+ transform: translateY(-2px);
145
+ }
146
+
147
+ .chat-header {
148
+ background: white;
149
+ padding: 20px 30px;
150
+ display: flex;
151
+ justify-content: space-between;
152
+ align-items: center;
153
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
154
+ border-bottom: 1px solid #e5e7eb;
155
+ }
156
+
157
+ .chat-header h2 {
158
+ color: var(--dark);
159
+ font-size: 1.5rem;
160
+ }
161
+
162
+ .user-info {
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 12px;
166
+ }
167
+
168
+ .user-avatar {
169
+ width: 40px;
170
+ height: 40px;
171
+ border-radius: 50%;
172
+ background: var(--primary);
173
+ color: white;
174
+ display: flex;
175
+ align-items: center;
176
+ justify-content: center;
177
+ font-weight: 600;
178
+ }
179
+
180
+ .chat-messages {
181
+ flex: 1;
182
+ padding: 20px;
183
+ overflow-y: auto;
184
+ display: flex;
185
+ flex-direction: column;
186
+ gap: 16px;
187
+ }
188
+
189
+ .message {
190
+ max-width: 70%;
191
+ padding: 14px 18px;
192
+ border-radius: 18px;
193
+ position: relative;
194
+ animation: fadeIn 0.3s ease;
195
+ }
196
+
197
+ .message.sent {
198
+ align-self: flex-end;
199
+ background: var(--primary);
200
+ color: white;
201
+ border-bottom-right-radius: 6px;
202
+ }
203
+
204
+ .message.received {
205
+ align-self: flex-start;
206
+ background: white;
207
+ color: var(--dark);
208
+ border-bottom-left-radius: 6px;
209
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
210
+ }
211
+
212
+ .message-time {
213
+ font-size: 0.75rem;
214
+ opacity: 0.8;
215
+ margin-top: 4px;
216
+ text-align: right;
217
+ }
218
+
219
+ .message-input {
220
+ padding: 20px 30px;
221
+ background: white;
222
+ border-top: 1px solid #e5e7eb;
223
+ display: flex;
224
+ gap: 12px;
225
+ }
226
+
227
+ .message-input input {
228
+ flex: 1;
229
+ padding: 14px 16px;
230
+ border: 2px solid #e5e7eb;
231
+ border-radius: 24px;
232
+ font-size: 1rem;
233
+ outline: none;
234
+ transition: all 0.3s ease;
235
+ }
236
+
237
+ .message-input input:focus {
238
+ border-color: var(--primary);
239
+ }
240
+
241
+ .message-input button {
242
+ background: var(--primary);
243
+ color: white;
244
+ border: none;
245
+ width: 50px;
246
+ height: 50px;
247
+ border-radius: 50%;
248
+ cursor: pointer;
249
+ transition: all 0.3s ease;
250
+ display: flex;
251
+ align-items: center;
252
+ justify-content: center;
253
+ }
254
+
255
+ .message-input button:hover {
256
+ background: var(--primary-dark);
257
+ transform: scale(1.05);
258
+ }
259
+
260
+ .login-tabs {
261
+ display: flex;
262
+ gap: 20px;
263
+ margin-bottom: 30px;
264
+ }
265
+
266
+ .tab {
267
+ padding: 12px 24px;
268
+ border-radius: 12px;
269
+ font-weight: 600;
270
+ cursor: pointer;
271
+ transition: all 0.3s ease;
272
+ }
273
+
274
+ .tab.active {
275
+ background: var(--primary);
276
+ color: white;
277
+ }
278
+
279
+ .tab:not(.active) {
280
+ color: var(--gray);
281
+ }
282
+
283
+ .tab:not(.active):hover {
284
+ color: var(--dark);
285
+ }
286
+
287
+ .signup-form {
288
+ display: none;
289
+ }
290
+
291
+ .built-with {
292
+ position: absolute;
293
+ bottom: 20px;
294
+ left: 0;
295
+ right: 0;
296
+ text-align: center;
297
+ color: var(--gray);
298
+ font-size: 0.9rem;
299
+ }
300
+
301
+ .built-with a {
302
+ color: var(--primary);
303
+ text-decoration: none;
304
+ font-weight: 600;
305
+ }
306
+
307
+ .built-with a:hover {
308
+ text-decoration: underline;
309
+ }
310
+
311
+ @keyframes fadeIn {
312
+ from { opacity: 0; transform: translateY(10px); }
313
+ to { opacity: 1; transform: translateY(0); }
314
+ }
315
+
316
+ @media (max-width: 768px) {
317
+ .container {
318
+ flex-direction: column;
319
+ height: auto;
320
+ }
321
+
322
+ .login-section, .chat-section {
323
+ flex: none;
324
+ width: 100%;
325
+ }
326
+
327
+ .message {
328
+ max-width: 85%;
329
+ }
330
+ }
331
+ </style>
332
+ </head>
333
+ <body>
334
+ <div class="container">
335
+ <!-- Login Section -->
336
+ <div class="login-section" id="loginSection">
337
+ <div class="logo">
338
+ <i class="fas fa-comment-dots"></i>
339
+ <h1>SecureChat</h1>
340
+ </div>
341
+
342
+ <div class="login-tabs">
343
+ <div class="tab active" id="loginTab">Login</div>
344
+ <div class="tab" id="signupTab">Sign Up</div>
345
+ </div>
346
+
347
+ <form class="login-form" id="loginForm">
348
+ <div class="form-group">
349
+ <label for="loginUsername">Username</label>
350
+ <input type="text" id="loginUsername" class="form-control" placeholder="Enter your username" required>
351
+ </div>
352
+
353
+ <div class="form-group">
354
+ <label for="loginPassword">Password</label>
355
+ <input type="password" id="loginPassword" class="form-control" placeholder="Enter your password" required>
356
+ </div>
357
+
358
+ <button type="submit" class="btn btn-primary">Login to Chatroom</button>
359
+ </form>
360
+
361
+ <form class="signup-form" id="signupForm">
362
+ <div class="form-group">
363
+ <label for="signupUsername">Username</label>
364
+ <input type="text" id="signupUsername" class="form-control" placeholder="Choose a username" required>
365
+ </div>
366
+
367
+ <div class="form-group">
368
+ <label for="signupEmail">Email</label>
369
+ <input type="email" id="signupEmail" class="form-control" placeholder="Enter your email" required>
370
+ </div>
371
+
372
+ <div class="form-group">
373
+ <label for="signupPassword">Password</label>
374
+ <input type="password" id="signupPassword" class="form-control" placeholder="Create a password" required>
375
+ </div>
376
+
377
+ <div class="form-group">
378
+ <label for="confirmPassword">Confirm Password</label>
379
+ <input type="password" id="confirmPassword" class="form-control" placeholder="Confirm your password" required>
380
+ </div>
381
+
382
+ <button type="submit" class="btn btn-secondary">Create Account</button>
383
+ </form>
384
+
385
+ <div class="built-with">
386
+ Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a>
387
+ </div>
388
+ </div>
389
+
390
+ <!-- Chat Section -->
391
+ <div class="chat-section" id="chatSection">
392
+ <div class="chat-header">
393
+ <h2>Private Chatroom</h2>
394
+ <div class="user-info">
395
+ <div class="user-avatar" id="userAvatar">U</div>
396
+ <div>
397
+ <div id="usernameDisplay">User</div>
398
+ <div style="font-size: 0.75rem; color: var(--gray);">Online</div>
399
+ </div>
400
+ <button class="btn" id="logoutBtn" style="background: var(--danger); color: white; padding: 8px 16px; border-radius: 8px;">Logout</button>
401
+ </div>
402
+ </div>
403
+
404
+ <div class="chat-messages" id="chatMessages">
405
+ <!-- Messages will be added here dynamically -->
406
+ </div>
407
+
408
+ <div class="message-input">
409
+ <input type="text" id="messageInput" placeholder="Type your message...">
410
+ <button type="button" id="sendMessageBtn">
411
+ <i class="fas fa-paper-plane"></i>
412
+ </button>
413
+ </div>
414
+ </div>
415
+ </div>
416
+
417
+ <script>
418
+ // DOM Elements
419
+ const loginSection = document.getElementById('loginSection');
420
+ const chatSection = document.getElementById('chatSection');
421
+ const loginForm = document.getElementById('loginForm');
422
+ const signupForm = document.getElementById('signupForm');
423
+ const loginTab = document.getElementById('loginTab');
424
+ const signupTab = document.getElementById('signupTab');
425
+ const chatMessages = document.getElementById('chatMessages');
426
+ const messageInput = document.getElementById('messageInput');
427
+ const sendMessageBtn = document.getElementById('sendMessageBtn');
428
+ const usernameDisplay = document.getElementById('usernameDisplay');
429
+ const userAvatar = document.getElementById('userAvatar');
430
+ const logoutBtn = document.getElementById('logoutBtn');
431
+
432
+ // Tab switching
433
+ loginTab.addEventListener('click', () => {
434
+ loginTab.classList.add('active');
435
+ signupTab.classList.remove('active');
436
+ loginForm.style.display = 'block';
437
+ signupForm.style.display = 'none';
438
+ });
439
+
440
+ signupTab.addEventListener('click', () => {
441
+ signupTab.classList.add('active');
442
+ loginTab.classList.remove('active');
443
+ signupForm.style.display = 'block';
444
+ loginForm.style.display = 'none';
445
+ });
446
+
447
+ // Login functionality
448
+ loginForm.addEventListener('submit', (e) => {
449
+ e.preventDefault();
450
+ const username = document.getElementById('loginUsername').value;
451
+ const password = document.getElementById('loginPassword').value;
452
+
453
+ // Simple validation (in a real app, this would connect to a backend)
454
+ if (username && password) {
455
+ // Simulate successful login
456
+ handleSuccessfulLogin(username);
457
+ } else {
458
+ alert('Please enter both username and password');
459
+ }
460
+ });
461
+
462
+ // Signup functionality
463
+ signupForm.addEventListener('submit', (e) => {
464
+ e.preventDefault();
465
+ const username = document.getElementById('signupUsername').value;
466
+ const email = document.getElementById('signupEmail').value;
467
+ const password = document.getElementById('signupPassword').value;
468
+ const confirmPassword = document.getElementById('confirmPassword').value;
469
+
470
+ // Simple validation
471
+ if (password !== confirmPassword) {
472
+ alert('Passwords do not match');
473
+ return;
474
+ }
475
+
476
+ if (username && email && password) {
477
+ // Simulate successful signup and login
478
+ handleSuccessfulLogin(username);
479
+ } else {
480
+ alert('Please fill in all fields');
481
+ }
482
+ });
483
+
484
+ // Handle successful login
485
+ function handleSuccessfulLogin(username) {
486
+ // Update UI
487
+ loginSection.style.display = 'none';
488
+ chatSection.style.display = 'flex';
489
+ usernameDisplay.textContent = username;
490
+ userAvatar.textContent = username.charAt(0).toUpperCase();
491
+
492
+ // Add welcome message
493
+ addMessage('System', `Welcome to the private chatroom, ${username}!`, 'received');
494
+
495
+ // Simulate other users joining
496
+ setTimeout(() => {
497
+ addMessage('System', 'User "Jane" has joined the chatroom', 'received');
498
+ }, 1000);
499
+
500
+ setTimeout(() => {
501
+ addMessage('Jane', 'Hi everyone! How are you doing today?', 'received');
502
+ }, 2000);
503
+ }
504
+
505
+ // Logout functionality
506
+ logoutBtn.addEventListener('click', () => {
507
+ // Reset forms
508
+ loginForm.reset();
509
+ signupForm.reset();
510
+
511
+ // Show login section
512
+ chatSection.style.display = 'none';
513
+ loginSection.style.display = 'flex';
514
+
515
+ // Clear chat messages
516
+ chatMessages.innerHTML = '';
517
+ });
518
+
519
+ // Send message functionality
520
+ sendMessageBtn.addEventListener('click', sendMessage);
521
+ messageInput.addEventListener('keypress', (e) => {
522
+ if (e.key === 'Enter') {
523
+ sendMessage();
524
+ }
525
+ });
526
+
527
+ function sendMessage() {
528
+ const message = messageInput.value.trim();
529
+ if (message) {
530
+ // Add message to chat
531
+ addMessage(usernameDisplay.textContent, message, 'sent');
532
+
533
+ // Clear input
534
+ messageInput.value = '';
535
+
536
+ // Simulate response after a delay
537
+ setTimeout(() => {
538
+ const responses = [
539
+ "That's interesting!",
540
+ "I see what you mean.",
541
+ "Tell me more about that.",
542
+ "I agree with you.",
543
+ "That's a good point!"
544
+ ];
545
+
546
+ const randomResponse = responses[Math.floor(Math.random() * responses.length)];
547
+ addMessage('Jane', randomResponse, 'received');
548
+ }, 1000 + Math.random() * 2000);
549
+ }
550
+ }
551
+
552
+ // Add message to chat
553
+ function addMessage(sender, text, type) {
554
+ const messageDiv = document.createElement('div');
555
+ messageDiv.classList.add('message', type);
556
+
557
+ const messageText = document.createElement('div');
558
+ messageText.textContent = text;
559
+
560
+ const messageTime = document.createElement('div');
561
+ messageTime.classList.add('message-time');
562
+ messageTime.textContent = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
563
+
564
+ messageDiv.appendChild(messageText);
565
+ messageDiv.appendChild(messageTime);
566
+
567
+ chatMessages.appendChild(messageDiv);
568
+
569
+ // Scroll to bottom
570
+ chatMessages.scrollTop = chatMessages.scrollHeight;
571
+ }
572
+ </script>
573
+ </body>
574
+ </html>