sky-meilin commited on
Commit
da8a140
·
verified ·
1 Parent(s): dc61783

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +839 -19
index.html CHANGED
@@ -1,19 +1,839 @@
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="de">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>AI Dokumenten Hub</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
+ <!-- Phosphor Icons für moderne Icons -->
11
+ <script src="https://unpkg.com/@phosphor-icons/web"></script>
12
+
13
+ <style>
14
+ :root {
15
+ /* Farbpalette - Modern & Professional */
16
+ --primary: #6366f1;
17
+ --primary-dark: #4f46e5;
18
+ --secondary: #ec4899;
19
+ --bg-dark: #0f172a;
20
+ --bg-card: #1e293b;
21
+ --bg-hover: #334155;
22
+ --text-main: #f8fafc;
23
+ --text-muted: #94a3b8;
24
+ --border: #334155;
25
+ --success: #10b981;
26
+ --glass: rgba(30, 41, 59, 0.7);
27
+
28
+ /* Layout */
29
+ --nav-height: 70px;
30
+ --header-height: 60px;
31
+ }
32
+
33
+ * {
34
+ box-sizing: border-box;
35
+ margin: 0;
36
+ padding: 0;
37
+ -webkit-tap-highlight-color: transparent;
38
+ }
39
+
40
+ body {
41
+ font-family: 'Inter', sans-serif;
42
+ background-color: var(--bg-dark);
43
+ color: var(--text-main);
44
+ height: 100vh;
45
+ overflow: hidden; /* App-like feel */
46
+ display: flex;
47
+ flex-direction: column;
48
+ }
49
+
50
+ /* --- Header --- */
51
+ header {
52
+ height: var(--header-height);
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: space-between;
56
+ padding: 0 20px;
57
+ background: rgba(15, 23, 42, 0.95);
58
+ border-bottom: 1px solid var(--border);
59
+ z-index: 100;
60
+ }
61
+
62
+ .brand {
63
+ font-weight: 700;
64
+ font-size: 1.2rem;
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 10px;
68
+ }
69
+
70
+ .brand i {
71
+ color: var(--primary);
72
+ font-size: 1.5rem;
73
+ }
74
+
75
+ .built-with {
76
+ font-size: 0.75rem;
77
+ color: var(--text-muted);
78
+ text-decoration: none;
79
+ opacity: 0.7;
80
+ transition: opacity 0.2s;
81
+ }
82
+ .built-with:hover {
83
+ opacity: 1;
84
+ color: var(--primary);
85
+ }
86
+
87
+ /* --- Main Layout --- */
88
+ main {
89
+ flex: 1;
90
+ position: relative;
91
+ overflow: hidden;
92
+ }
93
+
94
+ .view-container {
95
+ position: absolute;
96
+ top: 0;
97
+ left: 0;
98
+ width: 100%;
99
+ height: 100%;
100
+ overflow-y: auto;
101
+ padding: 20px;
102
+ padding-bottom: 100px; /* Space for FAB and Nav */
103
+ opacity: 0;
104
+ pointer-events: none;
105
+ transform: translateY(20px);
106
+ transition: opacity 0.3s ease, transform 0.3s ease;
107
+ display: none; /* Helper to ensure visibility */
108
+ }
109
+
110
+ .view-container.active {
111
+ opacity: 1;
112
+ pointer-events: all;
113
+ transform: translateY(0);
114
+ display: block;
115
+ }
116
+
117
+ h2 {
118
+ font-size: 1.5rem;
119
+ margin-bottom: 20px;
120
+ font-weight: 600;
121
+ }
122
+
123
+ /* --- Upload Area (Drag & Drop) --- */
124
+ .upload-zone {
125
+ border: 2px dashed var(--border);
126
+ border-radius: 16px;
127
+ padding: 40px 20px;
128
+ text-align: center;
129
+ background: rgba(255, 255, 255, 0.02);
130
+ transition: all 0.3s ease;
131
+ cursor: pointer;
132
+ margin-bottom: 20px;
133
+ }
134
+
135
+ .upload-zone.drag-over {
136
+ border-color: var(--primary);
137
+ background: rgba(99, 102, 241, 0.1);
138
+ }
139
+
140
+ .upload-icon {
141
+ font-size: 3rem;
142
+ color: var(--text-muted);
143
+ margin-bottom: 15px;
144
+ }
145
+
146
+ .upload-text {
147
+ color: var(--text-main);
148
+ font-weight: 500;
149
+ }
150
+
151
+ .upload-subtext {
152
+ color: var(--text-muted);
153
+ font-size: 0.9rem;
154
+ margin-top: 5px;
155
+ }
156
+
157
+ #fileInput {
158
+ display: none;
159
+ }
160
+
161
+ /* --- Document List --- */
162
+ .doc-grid {
163
+ display: grid;
164
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
165
+ gap: 15px;
166
+ }
167
+
168
+ .doc-card {
169
+ background: var(--bg-card);
170
+ border: 1px solid var(--border);
171
+ border-radius: 12px;
172
+ padding: 15px;
173
+ display: flex;
174
+ flex-direction: column;
175
+ align-items: center;
176
+ text-align: center;
177
+ transition: transform 0.2s, box-shadow 0.2s;
178
+ position: relative;
179
+ }
180
+
181
+ .doc-card:hover {
182
+ transform: translateY(-2px);
183
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
184
+ border-color: var(--primary);
185
+ }
186
+
187
+ .doc-icon {
188
+ font-size: 2rem;
189
+ margin-bottom: 10px;
190
+ color: var(--primary);
191
+ }
192
+
193
+ .doc-name {
194
+ font-size: 0.9rem;
195
+ font-weight: 500;
196
+ margin-bottom: 5px;
197
+ white-space: nowrap;
198
+ overflow: hidden;
199
+ text-overflow: ellipsis;
200
+ width: 100%;
201
+ }
202
+
203
+ .doc-meta {
204
+ font-size: 0.75rem;
205
+ color: var(--text-muted);
206
+ }
207
+
208
+ .doc-actions {
209
+ position: absolute;
210
+ top: 5px;
211
+ right: 5px;
212
+ opacity: 0;
213
+ transition: opacity 0.2s;
214
+ }
215
+
216
+ .doc-card:hover .doc-actions {
217
+ opacity: 1;
218
+ }
219
+
220
+ .btn-icon {
221
+ background: var(--bg-hover);
222
+ border: none;
223
+ color: var(--text-main);
224
+ border-radius: 50%;
225
+ width: 28px;
226
+ height: 28px;
227
+ display: flex;
228
+ align-items: center;
229
+ justify-content: center;
230
+ cursor: pointer;
231
+ }
232
+
233
+ .btn-icon:hover {
234
+ background: var(--secondary);
235
+ }
236
+
237
+ /* --- AI Integration Hub --- */
238
+ .ai-grid {
239
+ display: grid;
240
+ grid-template-columns: 1fr;
241
+ gap: 15px;
242
+ }
243
+
244
+ .ai-card {
245
+ background: linear-gradient(135deg, var(--bg-card), rgba(30, 41, 59, 0.5));
246
+ border: 1px solid var(--border);
247
+ border-radius: 16px;
248
+ padding: 20px;
249
+ display: flex;
250
+ align-items: center;
251
+ gap: 15px;
252
+ transition: transform 0.2s;
253
+ }
254
+
255
+ .ai-card:active {
256
+ transform: scale(0.98);
257
+ }
258
+
259
+ .ai-avatar {
260
+ width: 50px;
261
+ height: 50px;
262
+ border-radius: 12px;
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ font-size: 1.5rem;
267
+ color: white;
268
+ }
269
+
270
+ .ai-info {
271
+ flex: 1;
272
+ }
273
+
274
+ .ai-name {
275
+ font-weight: 600;
276
+ margin-bottom: 2px;
277
+ }
278
+
279
+ .ai-status {
280
+ font-size: 0.8rem;
281
+ display: flex;
282
+ align-items: center;
283
+ gap: 5px;
284
+ }
285
+
286
+ .status-dot {
287
+ width: 8px;
288
+ height: 8px;
289
+ background-color: var(--success);
290
+ border-radius: 50%;
291
+ box-shadow: 0 0 8px var(--success);
292
+ }
293
+
294
+ .btn-primary {
295
+ background: var(--primary);
296
+ color: white;
297
+ border: none;
298
+ padding: 10px 20px;
299
+ border-radius: 8px;
300
+ font-weight: 600;
301
+ cursor: pointer;
302
+ transition: background 0.2s;
303
+ display: flex;
304
+ align-items: center;
305
+ gap: 8px;
306
+ }
307
+
308
+ .btn-primary:hover {
309
+ background: var(--primary-dark);
310
+ }
311
+
312
+ /* --- Floating Action Button (FAB) --- */
313
+ .fab {
314
+ position: fixed;
315
+ bottom: calc(var(--nav-height) + 20px);
316
+ right: 20px;
317
+ width: 56px;
318
+ height: 56px;
319
+ border-radius: 50%;
320
+ background: var(--primary);
321
+ color: white;
322
+ border: none;
323
+ box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
324
+ display: flex;
325
+ align-items: center;
326
+ justify-content: center;
327
+ font-size: 1.5rem;
328
+ cursor: pointer;
329
+ z-index: 90;
330
+ transition: transform 0.2s, background 0.2s;
331
+ }
332
+
333
+ .fab:hover {
334
+ transform: scale(1.1);
335
+ background: var(--primary-dark);
336
+ }
337
+
338
+ /* --- Bottom Navigation --- */
339
+ .bottom-nav {
340
+ position: fixed;
341
+ bottom: 0;
342
+ left: 0;
343
+ width: 100%;
344
+ height: var(--nav-height);
345
+ background: var(--bg-card);
346
+ border-top: 1px solid var(--border);
347
+ display: flex;
348
+ justify-content: space-around;
349
+ align-items: center;
350
+ z-index: 100;
351
+ }
352
+
353
+ .nav-item {
354
+ display: flex;
355
+ flex-direction: column;
356
+ align-items: center;
357
+ justify-content: center;
358
+ color: var(--text-muted);
359
+ text-decoration: none;
360
+ font-size: 0.75rem;
361
+ gap: 4px;
362
+ padding: 10px 20px;
363
+ transition: color 0.2s;
364
+ background: none;
365
+ border: none;
366
+ cursor: pointer;
367
+ width: 100%;
368
+ }
369
+
370
+ .nav-item i {
371
+ font-size: 1.5rem;
372
+ }
373
+
374
+ .nav-item.active {
375
+ color: var(--primary);
376
+ }
377
+
378
+ /* --- Toast Notification --- */
379
+ .toast-container {
380
+ position: fixed;
381
+ top: 80px;
382
+ right: 20px;
383
+ z-index: 1000;
384
+ display: flex;
385
+ flex-direction: column;
386
+ gap: 10px;
387
+ }
388
+
389
+ .toast {
390
+ background: var(--bg-card);
391
+ border-left: 4px solid var(--primary);
392
+ padding: 15px 20px;
393
+ border-radius: 4px;
394
+ box-shadow: 0 4px 12px rgba(0,0,0,0.3);
395
+ display: flex;
396
+ align-items: center;
397
+ gap: 10px;
398
+ animation: slideIn 0.3s ease;
399
+ min-width: 250px;
400
+ }
401
+
402
+ @keyframes slideIn {
403
+ from { transform: translateX(100%); opacity: 0; }
404
+ to { transform: translateX(0); opacity: 1; }
405
+ }
406
+
407
+ /* --- Modal --- */
408
+ .modal-overlay {
409
+ position: fixed;
410
+ top: 0;
411
+ left: 0;
412
+ width: 100%;
413
+ height: 100%;
414
+ background: rgba(0, 0, 0, 0.7);
415
+ backdrop-filter: blur(5px);
416
+ z-index: 200;
417
+ display: flex;
418
+ align-items: center;
419
+ justify-content: center;
420
+ opacity: 0;
421
+ pointer-events: none;
422
+ transition: opacity 0.3s;
423
+ }
424
+
425
+ .modal-overlay.open {
426
+ opacity: 1;
427
+ pointer-events: all;
428
+ }
429
+
430
+ .modal {
431
+ background: var(--bg-card);
432
+ width: 90%;
433
+ max-width: 400px;
434
+ border-radius: 16px;
435
+ padding: 25px;
436
+ border: 1px solid var(--border);
437
+ transform: scale(0.9);
438
+ transition: transform 0.3s;
439
+ }
440
+
441
+ .modal-overlay.open .modal {
442
+ transform: scale(1);
443
+ }
444
+
445
+ .modal h3 {
446
+ margin-bottom: 15px;
447
+ }
448
+
449
+ .form-group {
450
+ margin-bottom: 15px;
451
+ }
452
+
453
+ .form-group label {
454
+ display: block;
455
+ margin-bottom: 5px;
456
+ color: var(--text-muted);
457
+ font-size: 0.9rem;
458
+ }
459
+
460
+ .form-group input, .form-group select, .form-group textarea {
461
+ width: 100%;
462
+ background: var(--bg-dark);
463
+ border: 1px solid var(--border);
464
+ padding: 12px;
465
+ border-radius: 8px;
466
+ color: var(--text-main);
467
+ font-family: inherit;
468
+ }
469
+
470
+ .modal-actions {
471
+ display: flex;
472
+ justify-content: flex-end;
473
+ gap: 10px;
474
+ margin-top: 20px;
475
+ }
476
+
477
+ .btn-secondary {
478
+ background: transparent;
479
+ border: 1px solid var(--border);
480
+ color: var(--text-main);
481
+ padding: 10px 20px;
482
+ border-radius: 8px;
483
+ cursor: pointer;
484
+ }
485
+
486
+ /* --- Responsive Tweaks --- */
487
+ @media (min-width: 768px) {
488
+ .doc-grid {
489
+ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
490
+ }
491
+ .fab {
492
+ width: 60px;
493
+ height: 60px;
494
+ }
495
+ }
496
+ </style>
497
+ </head>
498
+ <body>
499
+
500
+ <!-- Header -->
501
+ <header>
502
+ <div class="brand">
503
+ <i class="ph ph-files"></i>
504
+ <span>DocuHub AI</span>
505
+ </div>
506
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">
507
+ Built with anycoder
508
+ </a>
509
+ </header>
510
+
511
+ <!-- Main Content Area -->
512
+ <main>
513
+
514
+ <!-- View 1: Document Storage -->
515
+ <section id="view-storage" class="view-container active">
516
+ <h2>Meine Dokumente</h2>
517
+
518
+ <div class="upload-zone" id="dropZone">
519
+ <i class="ph ph-cloud-arrow-up upload-icon"></i>
520
+ <div class="upload-text">Hierher ziehen oder tippen</div>
521
+ <div class="upload-subtext">PDF, JPG, PNG, TXT</div>
522
+ <input type="file" id="fileInput" multiple>
523
+ </div>
524
+
525
+ <div class="doc-grid" id="docGrid">
526
+ <!-- Documents will be injected here via JS -->
527
+ </div>
528
+ </section>
529
+
530
+ <!-- View 2: AI Integration Hub -->
531
+ <section id="view-ai" class="view-container">
532
+ <h2>AI Integration Hub</h2>
533
+ <p style="color: var(--text-muted); margin-bottom: 20px;">
534
+ Verbinden Sie KI-Modelle für automatisierte Analyse und Zusammenfassung.
535
+ </p>
536
+
537
+ <div class="ai-grid" id="aiGrid">
538
+ <!-- AI Cards will be injected here via JS -->
539
+ </div>
540
+ </section>
541
+
542
+ <!-- View 3: Settings -->
543
+ <section id="view-settings" class="view-container">
544
+ <h2>Einstellungen</h2>
545
+ <div class="ai-card" style="cursor: default;">
546
+ <div class="ai-avatar" style="background: var(--bg-hover);">
547
+ <i class="ph ph-gear"></i>
548
+ </div>
549
+ <div class="ai-info">
550
+ <div class="ai-name">App Version</div>
551
+ <div class="ai-status">v1.0.0 (Stable)</div>
552
+ </div>
553
+ </div>
554
+ <div class="ai-card" style="cursor: default;">
555
+ <div class="ai-avatar" style="background: var(--bg-hover);">
556
+ <i class="ph ph-database"></i>
557
+ </div>
558
+ <div class="ai-info">
559
+ <div class="ai-name">Speicherstatus</div>
560
+ <div class="ai-status">45% verbraucht</div>
561
+ </div>
562
+ </div>
563
+ </section>
564
+
565
+ </main>
566
+
567
+ <!-- Floating Action Button (Add Document) -->
568
+ <button class="fab" id="fabAdd" onclick="triggerFileUpload()">
569
+ <i class="ph ph-plus"></i>
570
+ </button>
571
+
572
+ <!-- Bottom Navigation -->
573
+ <nav class="bottom-nav">
574
+ <button class="nav-item active" onclick="switchView('view-storage', this)">
575
+ <i class="ph ph-files"></i>
576
+ <span>Dokumente</span>
577
+ </button>
578
+ <button class="nav-item" onclick="switchView('view-ai', this)">
579
+ <i class="ph ph-robot"></i>
580
+ <span>AI Hub</span>
581
+ </button>
582
+ <button class="nav-item" onclick="switchView('view-settings', this)">
583
+ <i class="ph ph-gear"></i>
584
+ <span>Einstellungen</span>
585
+ </button>
586
+ </nav>
587
+
588
+ <!-- Modal for Adding AI Connection -->
589
+ <div class="modal-overlay" id="aiModal">
590
+ <div class="modal">
591
+ <h3>Neue KI-Verbindung</h3>
592
+ <div class="form-group">
593
+ <label>Name des Assistenten</label>
594
+ <input type="text" id="aiName" placeholder="z.B. Analyse-Bot">
595
+ </div>
596
+ <div class="form-group">
597
+ <label>API Endpoint / Model</label>
598
+ <select id="aiModel">
599
+ <option value="openai">OpenAI GPT-4</option>
600
+ <option value="anthropic">Claude 3</option>
601
+ <option value="local">Lokales Model (Ollama)</option>
602
+ </select>
603
+ </div>
604
+ <div class="modal-actions">
605
+ <button class="btn-secondary" onclick="closeModal()">Abbrechen</button>
606
+ <button class="btn-primary" onclick="saveAIConnection()">Verbinden</button>
607
+ </div>
608
+ </div>
609
+ </div>
610
+
611
+ <!-- Toast Container -->
612
+ <div class="toast-container" id="toastContainer"></div>
613
+
614
+ <script>
615
+ // --- State Management ---
616
+ let documents = [
617
+ { id: 1, name: "Projekt_Plan.pdf", type: "pdf", date: "Heute" },
618
+ { id: 2, name: "Rechnung_123.jpg", type: "image", date: "Gestern" },
619
+ { id: 3, name: "Meeting_Notizen.txt", type: "text", date: "01.10.2023" }
620
+ ];
621
+
622
+ let aiConnections = [
623
+ { id: 1, name: "ChatGPT", model: "GPT-4", active: true },
624
+ { id: 2, name: "Claude", model: "Claude 3 Opus", active: false }
625
+ ];
626
+
627
+ // --- DOM Elements ---
628
+ const dropZone = document.getElementById('dropZone');
629
+ const fileInput = document.getElementById('fileInput');
630
+ const docGrid = document.getElementById('docGrid');
631
+ const aiGrid = document.getElementById('aiGrid');
632
+ const aiModal = document.getElementById('aiModal');
633
+
634
+ // --- Initialization ---
635
+ document.addEventListener('DOMContentLoaded', () => {
636
+ renderDocuments();
637
+ renderAIConnections();
638
+ setupDragAndDrop();
639
+ });
640
+
641
+ // --- Navigation Logic ---
642
+ function switchView(viewId, navBtn) {
643
+ // Hide all views
644
+ document.querySelectorAll('.view-container').forEach(el => {
645
+ el.classList.remove('active');
646
+ });
647
+ // Show target view
648
+ document.getElementById(viewId).classList.add('active');
649
+
650
+ // Update Nav Icons
651
+ document.querySelectorAll('.nav-item').forEach(el => {
652
+ el.classList.remove('active');
653
+ });
654
+ if(navBtn) navBtn.classList.add('active');
655
+ }
656
+
657
+ // --- File Upload Logic ---
658
+ function triggerFileUpload() {
659
+ fileInput.click();
660
+ }
661
+
662
+ function setupDragAndDrop() {
663
+ // Prevent default browser behavior
664
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
665
+ dropZone.addEventListener(eventName, preventDefaults, false);
666
+ document.body.addEventListener(eventName, preventDefaults, false);
667
+ });
668
+
669
+ // Highlight drop zone
670
+ ['dragenter', 'dragover'].forEach(eventName => {
671
+ dropZone.addEventListener(eventName, () => dropZone.classList.add('drag-over'), false);
672
+ });
673
+
674
+ ['dragleave', 'drop'].forEach(eventName => {
675
+ dropZone.addEventListener(eventName, () => dropZone.classList.remove('drag-over'), false);
676
+ });
677
+
678
+ // Handle Drop
679
+ dropZone.addEventListener('drop', handleDrop, false);
680
+
681
+ // Handle Click to Upload
682
+ dropZone.addEventListener('click', () => fileInput.click());
683
+ fileInput.addEventListener('change', (e) => handleFiles(e.target.files));
684
+ }
685
+
686
+ function preventDefaults(e) {
687
+ e.preventDefault();
688
+ e.stopPropagation();
689
+ }
690
+
691
+ function handleDrop(e) {
692
+ const dt = e.dataTransfer;
693
+ const files = dt.files;
694
+ handleFiles(files);
695
+ }
696
+
697
+ function handleFiles(files) {
698
+ ([...files]).forEach(file => {
699
+ // Check if it's a file type we care about
700
+ if(file.type) {
701
+ const type = file.type.split('/')[0];
702
+ const newDoc = {
703
+ id: Date.now(),
704
+ name: file.name,
705
+ type: type === 'image' ? 'image' : 'file',
706
+ date: "Gerade eben"
707
+ };
708
+ documents.unshift(newDoc); // Add to top
709
+ showToast(`Dokument "${file.name}" hochgeladen`);
710
+ }
711
+ });
712
+ renderDocuments();
713
+ }
714
+
715
+ // --- Rendering Logic ---
716
+ function renderDocuments() {
717
+ docGrid.innerHTML = '';
718
+ documents.forEach(doc => {
719
+ let iconClass = 'ph-file';
720
+ let color = 'var(--text-muted)';
721
+
722
+ if(doc.type === 'pdf') { iconClass = 'ph-file-pdf'; color = '#ef4444'; }
723
+ if(doc.type === 'image') { iconClass = 'ph-image'; color = '#ec4899'; }
724
+
725
+ const card = document.createElement('div');
726
+ card.className = 'doc-card';
727
+ card.innerHTML = `
728
+ <div class="doc-actions">
729
+ <button class="btn-icon" onclick="deleteDoc(${doc.id})">
730
+ <i class="ph ph-trash"></i>
731
+ </button>
732
+ </div>
733
+ <i class="ph ${iconClass} doc-icon" style="color: ${color}"></i>
734
+ <div class="doc-name" title="${doc.name}">${doc.name}</div>
735
+ <div class="doc-meta">${doc.date}</div>
736
+ `;
737
+ docGrid.appendChild(card);
738
+ });
739
+ }
740
+
741
+ function deleteDoc(id) {
742
+ documents = documents.filter(d => d.id !== id);
743
+ renderDocuments();
744
+ showToast('Dokument gelöscht');
745
+ }
746
+
747
+ function renderAIConnections() {
748
+ aiGrid.innerHTML = '';
749
+ aiConnections.forEach(ai => {
750
+ const card = document.createElement('div');
751
+ card.className = 'ai-card';
752
+
753
+ // Determine Icon based on provider
754
+ let icon = 'ph-robot';
755
+ let bg = 'var(--primary)';
756
+ if(ai.model.includes('Claude')) { icon = 'ph-brain'; bg = '#d97706'; }
757
+ if(ai.model.includes('Lokal')) { icon = 'ph-cpu'; bg = '#059669'; }
758
+
759
+ card.innerHTML = `
760
+ <div class="ai-avatar" style="background: ${bg}">
761
+ <i class="ph ${icon}"></i>
762
+ </div>
763
+ <div class="ai-info">
764
+ <div class="ai-name">${ai.name}</div>
765
+ <div class="ai-status">
766
+ <div class="status-dot"></div>
767
+ ${ai.active ? 'Aktiv' : 'Inaktiv'}
768
+ </div>
769
+ </div>
770
+ <button class="btn-icon" onclick="toggleAI(${ai.id})">
771
+ <i class="ph ${ai.active ? 'ph-power' : 'ph-power'}"></i>
772
+ </button>
773
+ <button class="btn-icon" style="background:transparent; opacity:0.5; pointer-events:none">
774
+ <i class="ph ph-dots-three-vertical"></i>
775
+ </button>
776
+ `;
777
+ aiGrid.appendChild(card);
778
+ });
779
+ }
780
+
781
+ // --- AI Connection Logic ---
782
+ function openModal() {
783
+ aiModal.classList.add('open');
784
+ }
785
+
786
+ function closeModal() {
787
+ aiModal.classList.remove('open');
788
+ }
789
+
790
+ function saveAIConnection() {
791
+ const name = document.getElementById('aiName').value;
792
+ const model = document.getElementById('aiModel').value;
793
+
794
+ if(!name) {
795
+ showToast('Bitte geben Sie einen Namen ein');
796
+ return;
797
+ }
798
+
799
+ aiConnections.push({
800
+ id: Date.now(),
801
+ name: name,
802
+ model: model,
803
+ active: true
804
+ });
805
+
806
+ renderAIConnections();
807
+ closeModal();
808
+ showToast(`KI-Verbindung "${name}" erstellt`);
809
+ }
810
+
811
+ function toggleAI(id) {
812
+ const ai = aiConnections.find(a => a.id === id);
813
+ if(ai) {
814
+ ai.active = !ai.active;
815
+ renderAIConnections();
816
+ showToast(`KI "${ai.name}" ${ai.active ? 'aktiviert' : 'deaktiviert'}`);
817
+ }
818
+ }
819
+
820
+ // --- Utilities ---
821
+ function showToast(message) {
822
+ const container = document.getElementById('toastContainer');
823
+ const toast = document.createElement('div');
824
+ toast.className = 'toast';
825
+ toast.innerHTML = `<i class="ph ph-check-circle" style="color: var(--success); font-size: 1.2rem;"></i> ${message}`;
826
+
827
+ container.appendChild(toast);
828
+
829
+ // Remove after 3 seconds
830
+ setTimeout(() => {
831
+ toast.style.opacity = '0';
832
+ toast.style.transform = 'translateX(100%)';
833
+ setTimeout(() => toast.remove(), 300);
834
+ }, 3000);
835
+ }
836
+
837
+ </script>
838
+ </body>
839
+ </html>