Spaces:
Running

Jepeto85 commited on
Commit
08e47f1
·
verified ·
1 Parent(s): 4b774b6

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +586 -19
index.html CHANGED
@@ -1,19 +1,586 @@
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>File Submission System</title>
7
+
8
+ <!-- Icons -->
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+
11
+ <!-- Google Fonts -->
12
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
13
+
14
+ <style>
15
+ :root {
16
+ --primary-color: #6366f1;
17
+ --primary-hover: #4f46e5;
18
+ --success-color: #10b981;
19
+ --danger-color: #ef4444;
20
+ --bg-dark: #0f172a;
21
+ --bg-card: #1e293b;
22
+ --text-main: #f8fafc;
23
+ --text-muted: #94a3b8;
24
+ --border-color: #334155;
25
+ --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
26
+ }
27
+
28
+ * {
29
+ box-sizing: border-box;
30
+ margin: 0;
31
+ padding: 0;
32
+ }
33
+
34
+ body {
35
+ font-family: 'Inter', sans-serif;
36
+ background-color: var(--bg-dark);
37
+ color: var(--text-main);
38
+ line-height: 1.6;
39
+ display: flex;
40
+ flex-direction: column;
41
+ min-height: 100vh;
42
+ }
43
+
44
+ /* Header & Footer */
45
+ header {
46
+ padding: 20px;
47
+ text-align: center;
48
+ border-bottom: 1px solid var(--border-color);
49
+ background: rgba(15, 23, 42, 0.95);
50
+ position: sticky;
51
+ top: 0;
52
+ z-index: 100;
53
+ backdrop-filter: blur(10px);
54
+ }
55
+
56
+ h1 {
57
+ font-size: 1.5rem;
58
+ font-weight: 700;
59
+ color: var(--primary-color);
60
+ }
61
+
62
+ .anycoder-link {
63
+ font-size: 0.8rem;
64
+ color: var(--text-muted);
65
+ margin-top: 5px;
66
+ display: inline-block;
67
+ text-decoration: none;
68
+ transition: color 0.3s;
69
+ }
70
+
71
+ .anycoder-link:hover {
72
+ color: var(--primary-color);
73
+ text-decoration: underline;
74
+ }
75
+
76
+ main {
77
+ flex: 1;
78
+ display: flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ padding: 40px 20px;
82
+ }
83
+
84
+ /* Main Card */
85
+ .container {
86
+ background-color: var(--bg-card);
87
+ border-radius: 24px;
88
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
89
+ width: 100%;
90
+ max-width: 600px;
91
+ padding: 40px;
92
+ border: 1px solid var(--border-color);
93
+ transition: transform 0.3s ease;
94
+ }
95
+
96
+ .header-section {
97
+ text-align: center;
98
+ margin-bottom: 30px;
99
+ }
100
+
101
+ .header-section h2 {
102
+ font-size: 2rem;
103
+ margin-bottom: 10px;
104
+ }
105
+
106
+ .header-section p {
107
+ color: var(--text-muted);
108
+ }
109
+
110
+ /* Drag & Drop Zone */
111
+ .upload-zone {
112
+ border: 2px dashed var(--border-color);
113
+ border-radius: 16px;
114
+ padding: 60px 20px;
115
+ text-align: center;
116
+ transition: all 0.4s ease;
117
+ cursor: pointer;
118
+ background: rgba(255,255,255,0.02);
119
+ position: relative;
120
+ }
121
+
122
+ .upload-zone:hover, .upload-zone.drag-over {
123
+ border-color: var(--primary-color);
124
+ background: rgba(99, 102, 241, 0.1);
125
+ transform: scale(1.02);
126
+ box-shadow: var(--shadow-glow);
127
+ }
128
+
129
+ .upload-zone i {
130
+ font-size: 4rem;
131
+ color: var(--text-muted);
132
+ margin-bottom: 20px;
133
+ transition: color 0.3s;
134
+ }
135
+
136
+ .upload-zone:hover i, .upload-zone.drag-over i {
137
+ color: var(--primary-color);
138
+ }
139
+
140
+ .upload-text {
141
+ font-size: 1.2rem;
142
+ font-weight: 600;
143
+ margin-bottom: 10px;
144
+ display: block;
145
+ }
146
+
147
+ .upload-subtext {
148
+ font-size: 0.9rem;
149
+ color: var(--text-muted);
150
+ }
151
+
152
+ .file-input {
153
+ position: absolute;
154
+ width: 100%;
155
+ height: 100%;
156
+ top: 0;
157
+ left: 0;
158
+ opacity: 0;
159
+ cursor: pointer;
160
+ }
161
+
162
+ /* File List & Status */
163
+ .file-details {
164
+ margin-top: 30px;
165
+ display: none; /* Hidden by default */
166
+ background: rgba(0,0,0,0.3);
167
+ padding: 20px;
168
+ border-radius: 12px;
169
+ border: 1px solid var(--border-color);
170
+ }
171
+
172
+ .file-item {
173
+ display: flex;
174
+ align-items: center;
175
+ gap: 15px;
176
+ padding: 15px;
177
+ background: rgba(30, 41, 59, 0.8);
178
+ border-radius: 8px;
179
+ margin-bottom: 15px;
180
+ animation: fadeIn 0.5s ease;
181
+ }
182
+
183
+ .file-icon {
184
+ width: 50px;
185
+ height: 50px;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: center;
189
+ background: #1e293b;
190
+ border-radius: 10px;
191
+ color: var(--primary-color);
192
+ font-size: 1.5rem;
193
+ flex-shrink: 0;
194
+ }
195
+
196
+ .file-info {
197
+ flex: 1;
198
+ overflow: hidden;
199
+ }
200
+
201
+ .file-name {
202
+ font-weight: 600;
203
+ white-space: nowrap;
204
+ overflow: hidden;
205
+ text-overflow: ellipsis;
206
+ display: block;
207
+ color: var(--text-main);
208
+ }
209
+
210
+ .file-meta {
211
+ font-size: 0.8rem;
212
+ color: var(--text-muted);
213
+ }
214
+
215
+ .status-badge {
216
+ padding: 5px 12px;
217
+ border-radius: 20px;
218
+ font-size: 0.8rem;
219
+ font-weight: 600;
220
+ text-transform: uppercase;
221
+ }
222
+
223
+ .status-valid {
224
+ background: rgba(16, 185, 129, 0.2);
225
+ color: var(--success-color);
226
+ border: 1px solid var(--success-color);
227
+ }
228
+
229
+ .status-invalid {
230
+ background: rgba(239, 68, 68, 0.2);
231
+ color: var(--danger-color);
232
+ border: 1px solid var(--danger-color);
233
+ }
234
+
235
+ /* Action Buttons */
236
+ .actions {
237
+ margin-top: 30px;
238
+ display: flex;
239
+ gap: 15px;
240
+ justify-content: center;
241
+ }
242
+
243
+ button {
244
+ padding: 12px 32px;
245
+ border-radius: 8px;
246
+ font-size: 1rem;
247
+ font-weight: 600;
248
+ cursor: pointer;
249
+ transition: all 0.3s ease;
250
+ display: flex;
251
+ align-items: center;
252
+ gap: 10px;
253
+ }
254
+
255
+ .btn-primary {
256
+ background-color: var(--primary-color);
257
+ color: white;
258
+ box-shadow: var(--shadow-glow);
259
+ border: none;
260
+ }
261
+
262
+ .btn-primary:hover {
263
+ background-color: var(--primary-hover);
264
+ transform: translateY(-2px);
265
+ box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
266
+ }
267
+
268
+ .btn-primary:disabled {
269
+ background-color: var(--border-color);
270
+ cursor: not-allowed;
271
+ box-shadow: none;
272
+ transform: none;
273
+ }
274
+
275
+ .btn-secondary {
276
+ background-color: transparent;
277
+ color: var(--text-muted);
278
+ border: 1px solid var(--border-color);
279
+ }
280
+
281
+ .btn-secondary:hover {
282
+ background-color: rgba(255,255,255,0.05);
283
+ color: var(--text-main);
284
+ }
285
+
286
+ /* Modal for Results */
287
+ .modal-overlay {
288
+ position: fixed;
289
+ top: 0;
290
+ left: 0;
291
+ width: 100%;
292
+ height: 100%;
293
+ background: rgba(0, 0, 0, 0.8);
294
+ display: flex;
295
+ justify-content: center;
296
+ align-items: center;
297
+ z-index: 1000;
298
+ opacity: 0;
299
+ pointer-events: none;
300
+ transition: opacity 0.3s ease;
301
+ backdrop-filter: blur(5px);
302
+ }
303
+
304
+ .modal-overlay.active {
305
+ opacity: 1;
306
+ pointer-events: all;
307
+ }
308
+
309
+ .modal-content {
310
+ background: var(--bg-card);
311
+ padding: 40px;
312
+ border-radius: 24px;
313
+ text-align: center;
314
+ max-width: 500px;
315
+ width: 90%;
316
+ border: 1px solid var(--border-color);
317
+ transform: translateY(20px);
318
+ transition: transform 0.3s ease;
319
+ }
320
+
321
+ .modal-overlay.active .modal-content {
322
+ transform: translateY(0);
323
+ }
324
+
325
+ .modal-icon {
326
+ font-size: 4rem;
327
+ margin-bottom: 20px;
328
+ display: block;
329
+ }
330
+
331
+ .modal-title {
332
+ font-size: 2rem;
333
+ margin-bottom: 15px;
334
+ }
335
+
336
+ .modal-body {
337
+ color: var(--text-muted);
338
+ margin-bottom: 30px;
339
+ line-height: 1.6;
340
+ }
341
+
342
+ @keyframes fadeIn {
343
+ from { opacity: 0; transform: translateY(10px); }
344
+ to { opacity: 1; transform: translateY(0); }
345
+ }
346
+
347
+ /* Responsive */
348
+ @media (max-width: 600px) {
349
+ .container { padding: 20px; }
350
+ .header-section h2 { font-size: 1.5rem; }
351
+ .actions { flex-direction: column; }
352
+ button { width: 100%; justify-content: center; }
353
+ }
354
+ </style>
355
+ </head>
356
+ <body>
357
+
358
+ <header>
359
+ <h1><i class="fa-solid fa-cloud-arrow-up"></i> SecureSubmit</h1>
360
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
361
+ Built with anycoder
362
+ </a>
363
+ </header>
364
+
365
+ <main>
366
+ <div class="container">
367
+ <div class="header-section">
368
+ <h2>Upload your project</h2>
369
+ <p>Support for ZIP, PDF, and Image files (Max 25MB)</p>
370
+ </div>
371
+
372
+ <!-- Drag and Drop Zone -->
373
+ <div class="upload-zone" id="dropZone">
374
+ <i class="fa-solid fa-file-zipper"></i>
375
+ <span class="upload-text">Drag & Drop files here</span>
376
+ <span class="upload-subtext">or click to browse from your computer</span>
377
+ <input type="file" id="fileInput" accept=".zip,application/zip,application/x-zip-compressed">
378
+ </div>
379
+
380
+ <!-- File Details Section -->
381
+ <div class="file-details" id="fileDetails">
382
+ <div class="file-item">
383
+ <div class="file-icon">
384
+ <i class="fa-solid fa-file-archive"></i>
385
+ </div>
386
+ <div class="file-info">
387
+ <span class="file-name" id="fileName">project.zip</span>
388
+ <span class="file-meta" id="fileSize">2.4 MB</span>
389
+ </div>
390
+ <div id="fileStatusBadge" class="status-badge status-valid">
391
+ <i class="fa-solid fa-check-circle"></i> Valid Format
392
+ </div>
393
+ </div>
394
+ </div>
395
+
396
+ <div class="actions">
397
+ <button class="btn-secondary" id="clearBtn">
398
+ <i class="fa-solid fa-xmark"></i> Clear
399
+ </button>
400
+ <button class="btn-primary" id="submitBtn" disabled>
401
+ <i class="fa-solid fa-paper-plane"></i> Submit File
402
+ </button>
403
+ </div>
404
+ </div>
405
+ </main>
406
+
407
+ <!-- Result Modal -->
408
+ <div class="modal-overlay" id="resultModal">
409
+ <div class="modal-content">
410
+ <span class="modal-icon" id="modalIcon"></span>
411
+ <h2 class="modal-title" id="modalTitle"></h2>
412
+ <p class="modal-body" id="modalBody"></p>
413
+ <button class="btn-primary" onclick="closeModal()">Close</button>
414
+ </div>
415
+ </div>
416
+
417
+ <footer style="text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid var(--border-color);">
418
+ &copy; 2023 SecureSubmit System. Client-side validation enabled.
419
+ </footer>
420
+
421
+ <script>
422
+ // DOM Elements
423
+ const dropZone = document.getElementById('dropZone');
424
+ const fileInput = document.getElementById('fileInput');
425
+ const fileDetails = document.getElementById('fileDetails');
426
+ const fileNameEl = document.getElementById('fileName');
427
+ const fileSizeEl = document.getElementById('fileSize');
428
+ const fileStatusBadge = document.getElementById('fileStatusBadge');
429
+ const submitBtn = document.getElementById('submitBtn');
430
+ const clearBtn = document.getElementById('clearBtn');
431
+ const resultModal = document.getElementById('resultModal');
432
+
433
+ let currentFile = null;
434
+
435
+ // Helper: Format bytes to human readable
436
+ const formatBytes = (bytes, decimals = 2) => {
437
+ if (!+bytes) return '0 Bytes';
438
+ const k = 1024;
439
+ const dm = decimals < 0 ? 0 : decimals;
440
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
441
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
442
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
443
+ };
444
+
445
+ // Helper: Check if file is a ZIP
446
+ const isZipFile = (file) => {
447
+ const validMimeTypes = ['application/zip', 'application/x-zip-compressed'];
448
+ // Common MIME types for ZIP
449
+ const isMime = validMimeTypes.includes(file.type);
450
+ // Fallback for extension check if MIME type is missing (common on some OS)
451
+ const isExtension = file.name.toLowerCase().endsWith('.zip');
452
+ return isMime || isExtension;
453
+ };
454
+
455
+ // Event: Drag & Drop Over
456
+ dropZone.addEventListener('dragover', (e) => {
457
+ e.preventDefault();
458
+ dropZone.classList.add('drag-over');
459
+ });
460
+
461
+ // Event: Drag & Drop Leave
462
+ dropZone.addEventListener('dragleave', () => {
463
+ dropZone.classList.remove('drag-over');
464
+ });
465
+
466
+ // Event: Drop
467
+ dropZone.addEventListener('drop', (e) => {
468
+ e.preventDefault();
469
+ dropZone.classList.remove('drag-over');
470
+
471
+ if (e.dataTransfer.files.length) {
472
+ handleFile(e.dataTransfer.files[0]);
473
+ }
474
+ });
475
+
476
+ // Event: Click to Upload
477
+ fileInput.addEventListener('change', (e) => {
478
+ if (e.target.files.length) {
479
+ handleFile(e.target.files[0]);
480
+ }
481
+ });
482
+
483
+ // Logic: Handle File Selection
484
+ function handleFile(file) {
485
+ currentFile = file;
486
+
487
+ // Update UI
488
+ fileNameEl.textContent = file.name;
489
+ fileSizeEl.textContent = formatBytes(file.size);
490
+
491
+ // Validation Logic
492
+ if (isZipFile(file)) {
493
+ fileStatusBadge.className = 'status-badge status-valid';
494
+ fileStatusBadge.innerHTML = '<i class="fa-solid fa-check-circle"></i> Valid (ZIP)';
495
+ submitBtn.disabled = false;
496
+ submitBtn.innerHTML = '<i class="fa-solid fa-check"></i> Ready to Submit';
497
+ submitBtn.style.backgroundColor = 'var(--success-color)';
498
+ submitBtn.style.boxShadow = '0 0 20px rgba(16, 185, 129, 0.3)';
499
+ } else {
500
+ fileStatusBadge.className = 'status-badge status-invalid';
501
+ fileStatusBadge.innerHTML = '<i class="fa-solid fa-circle-xmark"></i> Invalid Format';
502
+ submitBtn.disabled = true;
503
+ submitBtn.innerHTML = '<i class="fa-solid fa-ban"></i> Select ZIP File';
504
+ submitBtn.style.backgroundColor = 'var(--border-color)';
505
+ submitBtn.style.boxShadow = 'none';
506
+
507
+ // Visual feedback on drop zone
508
+ dropZone.style.borderColor = 'var(--danger-color)';
509
+ setTimeout(() => {
510
+ dropZone.style.borderColor = 'var(--border-color)';
511
+ }, 3000);
512
+ }
513
+
514
+ // Show details
515
+ fileDetails.style.display = 'block';
516
+ }
517
+
518
+ // Event: Clear
519
+ clearBtn.addEventListener('click', () => {
520
+ currentFile = null;
521
+ fileInput.value = ''; // Reset input
522
+ fileDetails.style.display = 'none';
523
+ submitBtn.disabled = true;
524
+ submitBtn.innerHTML = '<i class="fa-solid fa-paper-plane"></i> Submit File';
525
+ submitBtn.style.backgroundColor = ''; // Reset to CSS default
526
+ submitBtn.style.boxShadow = '';
527
+ dropZone.classList.remove('drag-over');
528
+ });
529
+
530
+ // Event: Submit
531
+ submitBtn.addEventListener('click', () => {
532
+ if (!currentFile) return;
533
+
534
+ // Simulate Upload Process
535
+ const originalBtnText = submitBtn.innerHTML;
536
+ submitBtn.disabled = true;
537
+ submitBtn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Processing...';
538
+
539
+ setTimeout(() => {
540
+ // Success Simulation
541
+ submitBtn.innerHTML = originalBtnText;
542
+ showModal(true, "Submission Successful!", `Your file <strong>${currentFile.name}</strong> has been successfully uploaded and is being processed. You will receive an email confirmation shortly.`);
543
+ }, 1500);
544
+ });
545
+
546
+ // Modal Logic
547
+ function showModal(isSuccess, title, body) {
548
+ const icon = document.getElementById('modalIcon');
549
+ const modalTitle = document.getElementById('modalTitle');
550
+ const modalBody = document.getElementById('modalBody');
551
+
552
+ if (isSuccess) {
553
+ icon.innerHTML = '<i class="fa-solid fa-circle-check" style="color: var(--success-color);"></i>';
554
+ modalTitle.style.color = 'var(--success-color)';
555
+ } else {
556
+ icon.innerHTML = '<i class="fa-solid fa-circle-xmark" style="color: var(--danger-color);"></i>';
557
+ modalTitle.style.color = 'var(--danger-color)';
558
+ }
559
+
560
+ modalTitle.textContent = title;
561
+ modalBody.innerHTML = body;
562
+ resultModal.classList.add('active');
563
+ }
564
+
565
+ window.closeModal = function() {
566
+ resultModal.classList.remove('active');
567
+ // Reset button state if modal closes after success
568
+ if(submitBtn.innerHTML.includes('Processing')) {
569
+ submitBtn.disabled = false;
570
+ submitBtn.innerHTML = '<i class="fa-solid fa-check"></i> Ready to Submit';
571
+ }
572
+ };
573
+
574
+ // Close modal on outside click
575
+ resultModal.addEventListener('click', (e) => {
576
+ if (e.target === resultModal) {
577
+ closeModal();
578
+ }
579
+ });
580
+
581
+ // Initialize state
582
+ submitBtn.disabled = true;
583
+ fileDetails.style.display = 'none';
584
+ </script>
585
+ </body>
586
+ </html>