awacke1 commited on
Commit
3362e92
Β·
verified Β·
1 Parent(s): f4aa6b0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +169 -16
index.html CHANGED
@@ -170,7 +170,6 @@
170
  }
171
 
172
  .treemap-node.file {
173
- background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
174
  color: white;
175
  }
176
 
@@ -179,6 +178,66 @@
179
  color: white;
180
  }
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  .tooltip {
183
  position: absolute;
184
  background: rgba(0, 0, 0, 0.9);
@@ -282,6 +341,40 @@
282
  <div class="stat-label">Max Depth</div>
283
  </div>
284
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  </div>
286
  </div>
287
 
@@ -436,7 +529,7 @@
436
  name: 'Demo Project',
437
  path: '',
438
  type: 'directory',
439
- size: 45320000,
440
  children: [
441
  {
442
  name: 'src',
@@ -445,33 +538,45 @@
445
  size: 28500000,
446
  children: [
447
  { name: 'main.js', path: 'src/main.js', type: 'file', size: 15200000 },
448
- { name: 'utils.js', path: 'src/utils.js', type: 'file', size: 8500000 },
449
- { name: 'config.js', path: 'src/config.js', type: 'file', size: 3200000 },
450
- { name: 'helpers.js', path: 'src/helpers.js', type: 'file', size: 1600000 }
451
  ]
452
  },
453
  {
454
  name: 'assets',
455
  path: 'assets',
456
  type: 'directory',
457
- size: 12400000,
458
  children: [
 
459
  { name: 'logo.png', path: 'assets/logo.png', type: 'file', size: 5600000 },
460
  { name: 'background.jpg', path: 'assets/background.jpg', type: 'file', size: 4200000 },
461
- { name: 'icons.svg', path: 'assets/icons.svg', type: 'file', size: 2600000 }
462
  ]
463
  },
464
  {
465
  name: 'docs',
466
  path: 'docs',
467
  type: 'directory',
468
- size: 2800000,
469
  children: [
470
- { name: 'README.md', path: 'docs/README.md', type: 'file', size: 1200000 },
471
- { name: 'API.md', path: 'docs/API.md', type: 'file', size: 900000 },
 
472
  { name: 'CHANGELOG.md', path: 'docs/CHANGELOG.md', type: 'file', size: 700000 }
473
  ]
474
  },
 
 
 
 
 
 
 
 
 
 
475
  {
476
  name: 'tests',
477
  path: 'tests',
@@ -479,12 +584,13 @@
479
  size: 1320000,
480
  children: [
481
  { name: 'main.test.js', path: 'tests/main.test.js', type: 'file', size: 680000 },
482
- { name: 'utils.test.js', path: 'tests/utils.test.js', type: 'file', size: 440000 },
483
- { name: 'config.test.js', path: 'tests/config.test.js', type: 'file', size: 200000 }
484
  ]
485
  },
486
  { name: 'package.json', path: 'package.json', type: 'file', size: 180000 },
487
- { name: 'webpack.config.js', path: 'webpack.config.js', type: 'file', size: 120000 }
 
488
  ]
489
  };
490
 
@@ -553,6 +659,30 @@
553
  document.getElementById('totalSize').textContent = this.formatFileSize(stats.size);
554
  document.getElementById('maxDepth').textContent = stats.depth;
555
  document.getElementById('stats').style.display = 'flex';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  }
557
 
558
  calculateStats(node, depth = 0) {
@@ -749,7 +879,15 @@
749
 
750
  layout.forEach(rect => {
751
  const element = document.createElement('div');
752
- element.className = `treemap-node ${rect.data.type}`;
 
 
 
 
 
 
 
 
753
 
754
  element.style.left = `${rect.x}px`;
755
  element.style.top = `${rect.y}px`;
@@ -780,8 +918,23 @@
780
 
781
  createTooltipContent(data) {
782
  let content = `<strong>${data.name}</strong><br>`;
783
- content += `Type: ${data.type}<br>`;
784
- content += `Size: ${this.formatFileSize(data.size)}<br>`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  content += `Path: ${data.path}<br>`;
786
 
787
  if (data.type === 'file' && data.lastModified) {
 
170
  }
171
 
172
  .treemap-node.file {
 
173
  color: white;
174
  }
175
 
 
178
  color: white;
179
  }
180
 
181
+ /* File type specific colors */
182
+ .treemap-node.file-image {
183
+ background: linear-gradient(135deg, #00cec9 0%, #00b894 100%);
184
+ }
185
+
186
+ .treemap-node.file-video {
187
+ background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
188
+ }
189
+
190
+ .treemap-node.file-audio {
191
+ background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
192
+ }
193
+
194
+ .treemap-node.file-document {
195
+ background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
196
+ }
197
+
198
+ .treemap-node.file-office {
199
+ background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
200
+ }
201
+
202
+ .treemap-node.file-code {
203
+ background: linear-gradient(135deg, #81ecec 0%, #00cec9 100%);
204
+ }
205
+
206
+ .legend {
207
+ display: flex;
208
+ justify-content: center;
209
+ flex-wrap: wrap;
210
+ gap: 15px;
211
+ margin-top: 20px;
212
+ padding: 20px;
213
+ background: white;
214
+ border-radius: 10px;
215
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
216
+ }
217
+
218
+ .legend-item {
219
+ display: flex;
220
+ align-items: center;
221
+ gap: 8px;
222
+ font-size: 0.9em;
223
+ }
224
+
225
+ .legend-color {
226
+ width: 16px;
227
+ height: 16px;
228
+ border-radius: 3px;
229
+ border: 1px solid rgba(0,0,0,0.1);
230
+ }
231
+
232
+ .legend-color.folder { background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%); }
233
+ .legend-color.image { background: linear-gradient(135deg, #00cec9 0%, #00b894 100%); }
234
+ .legend-color.video { background: linear-gradient(135deg, #e17055 0%, #d63031 100%); }
235
+ .legend-color.audio { background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%); }
236
+ .legend-color.document { background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%); }
237
+ .legend-color.office { background: linear-gradient(135deg, #00b894 0%, #00a085 100%); }
238
+ .legend-color.code { background: linear-gradient(135deg, #81ecec 0%, #00cec9 100%); }
239
+ .legend-color.other { background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%); }
240
+
241
  .tooltip {
242
  position: absolute;
243
  background: rgba(0, 0, 0, 0.9);
 
341
  <div class="stat-label">Max Depth</div>
342
  </div>
343
  </div>
344
+ <div class="legend" id="legend" style="display: none;">
345
+ <div class="legend-item">
346
+ <div class="legend-color folder"></div>
347
+ <span>πŸ“ Folders</span>
348
+ </div>
349
+ <div class="legend-item">
350
+ <div class="legend-color image"></div>
351
+ <span>πŸ–ΌοΈ Images</span>
352
+ </div>
353
+ <div class="legend-item">
354
+ <div class="legend-color video"></div>
355
+ <span>πŸŽ₯ Video</span>
356
+ </div>
357
+ <div class="legend-item">
358
+ <div class="legend-color audio"></div>
359
+ <span>🎡 Audio</span>
360
+ </div>
361
+ <div class="legend-item">
362
+ <div class="legend-color document"></div>
363
+ <span>πŸ“„ Documents</span>
364
+ </div>
365
+ <div class="legend-item">
366
+ <div class="legend-color office"></div>
367
+ <span>πŸ“Š Office</span>
368
+ </div>
369
+ <div class="legend-item">
370
+ <div class="legend-color code"></div>
371
+ <span>πŸ’» Code</span>
372
+ </div>
373
+ <div class="legend-item">
374
+ <div class="legend-color other"></div>
375
+ <span>πŸ“¦ Other</span>
376
+ </div>
377
+ </div>
378
  </div>
379
  </div>
380
 
 
529
  name: 'Demo Project',
530
  path: '',
531
  type: 'directory',
532
+ size: 78650000,
533
  children: [
534
  {
535
  name: 'src',
 
538
  size: 28500000,
539
  children: [
540
  { name: 'main.js', path: 'src/main.js', type: 'file', size: 15200000 },
541
+ { name: 'utils.py', path: 'src/utils.py', type: 'file', size: 8500000 },
542
+ { name: 'config.json', path: 'src/config.json', type: 'file', size: 3200000 },
543
+ { name: 'index.html', path: 'src/index.html', type: 'file', size: 1600000 }
544
  ]
545
  },
546
  {
547
  name: 'assets',
548
  path: 'assets',
549
  type: 'directory',
550
+ size: 25800000,
551
  children: [
552
+ { name: 'hero-video.mp4', path: 'assets/hero-video.mp4', type: 'file', size: 12400000 },
553
  { name: 'logo.png', path: 'assets/logo.png', type: 'file', size: 5600000 },
554
  { name: 'background.jpg', path: 'assets/background.jpg', type: 'file', size: 4200000 },
555
+ { name: 'theme-song.mp3', path: 'assets/theme-song.mp3', type: 'file', size: 3600000 }
556
  ]
557
  },
558
  {
559
  name: 'docs',
560
  path: 'docs',
561
  type: 'directory',
562
+ size: 8900000,
563
  children: [
564
+ { name: 'manual.pdf', path: 'docs/manual.pdf', type: 'file', size: 5200000 },
565
+ { name: 'README.md', path: 'docs/README.md', type: 'file', size: 1800000 },
566
+ { name: 'API.txt', path: 'docs/API.txt', type: 'file', size: 1200000 },
567
  { name: 'CHANGELOG.md', path: 'docs/CHANGELOG.md', type: 'file', size: 700000 }
568
  ]
569
  },
570
+ {
571
+ name: 'data',
572
+ path: 'data',
573
+ type: 'directory',
574
+ size: 11200000,
575
+ children: [
576
+ { name: 'report.xlsx', path: 'data/report.xlsx', type: 'file', size: 6800000 },
577
+ { name: 'presentation.pptx', path: 'data/presentation.pptx', type: 'file', size: 4400000 }
578
+ ]
579
+ },
580
  {
581
  name: 'tests',
582
  path: 'tests',
 
584
  size: 1320000,
585
  children: [
586
  { name: 'main.test.js', path: 'tests/main.test.js', type: 'file', size: 680000 },
587
+ { name: 'utils.test.py', path: 'tests/utils.test.py', type: 'file', size: 440000 },
588
+ { name: 'config.test.json', path: 'tests/config.test.json', type: 'file', size: 200000 }
589
  ]
590
  },
591
  { name: 'package.json', path: 'package.json', type: 'file', size: 180000 },
592
+ { name: 'webpack.config.js', path: 'webpack.config.js', type: 'file', size: 120000 },
593
+ { name: 'archive.zip', path: 'archive.zip', type: 'file', size: 2630000 }
594
  ]
595
  };
596
 
 
659
  document.getElementById('totalSize').textContent = this.formatFileSize(stats.size);
660
  document.getElementById('maxDepth').textContent = stats.depth;
661
  document.getElementById('stats').style.display = 'flex';
662
+ document.getElementById('legend').style.display = 'flex';
663
+ }
664
+
665
+ getFileTypeCategory(filename) {
666
+ if (!filename || filename.indexOf('.') === -1) return 'other';
667
+
668
+ const extension = filename.toLowerCase().split('.').pop();
669
+
670
+ const categories = {
671
+ image: ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'ico'],
672
+ video: ['mp4', 'avi', 'mov', 'mkv', 'wmv', 'flv', 'webm'],
673
+ audio: ['mp3', 'wav', 'flac', 'aac', 'ogg', 'm4a'],
674
+ document: ['pdf', 'md', 'txt', 'rtf', 'doc', 'docx'],
675
+ office: ['xlsx', 'xls', 'pptx', 'ppt', 'csv'],
676
+ code: ['html', 'htm', 'css', 'js', 'ts', 'py', 'java', 'cpp', 'c', 'php', 'rb', 'go', 'rs', 'swift', 'kt', 'json', 'xml', 'yml', 'yaml', 'svg']
677
+ };
678
+
679
+ for (const [category, extensions] of Object.entries(categories)) {
680
+ if (extensions.includes(extension)) {
681
+ return category;
682
+ }
683
+ }
684
+
685
+ return 'other';
686
  }
687
 
688
  calculateStats(node, depth = 0) {
 
879
 
880
  layout.forEach(rect => {
881
  const element = document.createElement('div');
882
+ let cssClass = `treemap-node ${rect.data.type}`;
883
+
884
+ // Add file type specific class for files
885
+ if (rect.data.type === 'file') {
886
+ const fileType = this.getFileTypeCategory(rect.data.name);
887
+ cssClass = `treemap-node file-${fileType}`;
888
+ }
889
+
890
+ element.className = cssClass;
891
 
892
  element.style.left = `${rect.x}px`;
893
  element.style.top = `${rect.y}px`;
 
918
 
919
  createTooltipContent(data) {
920
  let content = `<strong>${data.name}</strong><br>`;
921
+ content += `Type: ${data.type}`;
922
+
923
+ if (data.type === 'file') {
924
+ const fileType = this.getFileTypeCategory(data.name);
925
+ const typeLabels = {
926
+ image: 'πŸ–ΌοΈ Image',
927
+ video: 'πŸŽ₯ Video',
928
+ audio: '🎡 Audio',
929
+ document: 'πŸ“„ Document',
930
+ office: 'πŸ“Š Office',
931
+ code: 'πŸ’» Code',
932
+ other: 'πŸ“¦ Other'
933
+ };
934
+ content += ` (${typeLabels[fileType]})`;
935
+ }
936
+
937
+ content += `<br>Size: ${this.formatFileSize(data.size)}<br>`;
938
  content += `Path: ${data.path}<br>`;
939
 
940
  if (data.type === 'file' && data.lastModified) {