|
537 | 537 | // Get icon for file or folder |
538 | 538 | const ico = (name, isFolder) => { |
539 | 539 | if (isFolder) { |
540 | | - // Check for special folder names |
541 | | - const folderName = name.toLowerCase(); |
542 | | - const folderIcon = FOLDER_ICONS[folderName] || FOLDER_ICONS['default']; |
543 | 540 | return { |
544 | 541 | type: 'svg', |
545 | | - url: ICON_BASE_URL + folderIcon.icon, |
546 | | - color: folderIcon.color, |
| 542 | + url: 'public/contexticon.svg', |
| 543 | + color: '', |
547 | 544 | cls: 'folder-icon' |
548 | 545 | }; |
549 | 546 | } |
550 | | - // File icon |
551 | | - const fileName = name.toLowerCase(); |
552 | | - // ======================================== |
553 | | - // SPRING BOOT / JAVA SPECIAL FILES |
554 | | - // ======================================== |
555 | | - if (fileName === 'pom.xml') { |
556 | | - return { |
557 | | - type: 'svg', |
558 | | - url: ICON_BASE_URL + 'maven.svg', |
559 | | - color: '#c71a36', |
560 | | - cls: '' |
561 | | - }; |
562 | | - } |
563 | | - if (fileName === 'build.gradle' || fileName === 'build.gradle.kts' || fileName === 'settings.gradle' || fileName === 'settings.gradle.kts') { |
564 | | - return { |
565 | | - type: 'svg', |
566 | | - url: ICON_BASE_URL + 'gradle.svg', |
567 | | - color: '#02303a', |
568 | | - cls: '' |
569 | | - }; |
570 | | - } |
571 | | - if (fileName === 'application.properties' || fileName === 'application.yml' || fileName === 'application.yaml') { |
572 | | - return { |
573 | | - type: 'svg', |
574 | | - url: ICON_BASE_URL + 'spring.svg', |
575 | | - color: '#6db33f', |
576 | | - cls: '' |
577 | | - }; |
578 | | - } |
579 | | - if (fileName.startsWith('application-') && (fileName.endsWith('.properties') || fileName.endsWith('.yml') || fileName.endsWith('.yaml'))) { |
580 | | - return { |
581 | | - type: 'svg', |
582 | | - url: ICON_BASE_URL + 'spring.svg', |
583 | | - color: '#6db33f', |
584 | | - cls: '' |
585 | | - }; |
586 | | - } |
587 | | - // ======================================== |
588 | | - // PYTHON SPECIAL FILES |
589 | | - // ======================================== |
590 | | - if (fileName === 'requirements.txt' || fileName === 'requirements-dev.txt') { |
591 | | - return { |
592 | | - type: 'svg', |
593 | | - url: ICON_BASE_URL + 'python.svg', |
594 | | - color: '#3776ab', |
595 | | - cls: '' |
596 | | - }; |
597 | | - } |
598 | | - if (fileName === 'setup.py' || fileName === 'setup.cfg') { |
599 | | - return { |
600 | | - type: 'svg', |
601 | | - url: ICON_BASE_URL + 'python.svg', |
602 | | - color: '#3776ab', |
603 | | - cls: '' |
604 | | - }; |
605 | | - } |
606 | | - if (fileName === 'pipfile' || fileName === 'pipfile.lock') { |
607 | | - return { |
608 | | - type: 'svg', |
609 | | - url: ICON_BASE_URL + 'python.svg', |
610 | | - color: '#3776ab', |
611 | | - cls: '' |
612 | | - }; |
613 | | - } |
614 | | - if (fileName === 'pyproject.toml') { |
615 | | - return { |
616 | | - type: 'svg', |
617 | | - url: ICON_BASE_URL + 'python.svg', |
618 | | - color: '#3776ab', |
619 | | - cls: '' |
620 | | - }; |
621 | | - } |
622 | | - if (fileName === 'manage.py') { // Django |
623 | | - return { |
624 | | - type: 'svg', |
625 | | - url: ICON_BASE_URL + 'django.svg', |
626 | | - color: '#092e20', |
627 | | - cls: '' |
628 | | - }; |
629 | | - } |
630 | | - // ======================================== |
631 | | - // JAVASCRIPT/NODE SPECIAL FILES |
632 | | - // ======================================== |
633 | | - if (fileName === 'package.json') { |
634 | | - return { |
635 | | - type: 'svg', |
636 | | - url: ICON_BASE_URL + 'nodejs.svg', |
637 | | - color: '#8cc84b', |
638 | | - cls: '' |
639 | | - }; |
640 | | - } |
641 | | - if (fileName === 'package-lock.json') { |
642 | | - return { |
643 | | - type: 'svg', |
644 | | - url: ICON_BASE_URL + 'npm.svg', |
645 | | - color: '#cb3837', |
646 | | - cls: '' |
647 | | - }; |
648 | | - } |
649 | | - if (fileName === 'yarn.lock') { |
650 | | - return { |
651 | | - type: 'svg', |
652 | | - url: ICON_BASE_URL + 'yarn.svg', |
653 | | - color: '#2c8ebb', |
654 | | - cls: '' |
655 | | - }; |
656 | | - } |
657 | | - if (fileName === 'tsconfig.json') { |
658 | | - return { |
659 | | - type: 'svg', |
660 | | - url: ICON_BASE_URL + 'typescript-def.svg', |
661 | | - color: '#3178c6', |
662 | | - cls: '' |
663 | | - }; |
664 | | - } |
665 | | - if (fileName === 'webpack.config.js' || fileName === 'webpack.config.ts') { |
666 | | - return { |
667 | | - type: 'svg', |
668 | | - url: ICON_BASE_URL + 'webpack.svg', |
669 | | - color: '#8dd6f9', |
670 | | - cls: '' |
671 | | - }; |
672 | | - } |
673 | | - if (fileName === 'vite.config.js' || fileName === 'vite.config.ts') { |
674 | | - return { |
675 | | - type: 'svg', |
676 | | - url: ICON_BASE_URL + 'vite.svg', |
677 | | - color: '#646cff', |
678 | | - cls: '' |
679 | | - }; |
680 | | - } |
681 | | - if (fileName === 'next.config.js' || fileName === 'next.config.ts') { |
682 | | - return { |
683 | | - type: 'svg', |
684 | | - url: ICON_BASE_URL + 'next.svg', |
685 | | - color: '#000000', |
686 | | - cls: '' |
687 | | - }; |
688 | | - } |
689 | | - // ======================================== |
690 | | - // GIT FILES |
691 | | - // ======================================== |
692 | | - if (fileName === '.gitignore' || fileName === '.gitattributes' || fileName === '.gitmodules') { |
693 | | - return { |
694 | | - type: 'svg', |
695 | | - url: ICON_BASE_URL + 'git.svg', |
696 | | - color: '#f34f29', |
697 | | - cls: '' |
698 | | - }; |
699 | | - } |
700 | | - // ======================================== |
701 | | - // DOCKER FILES |
702 | | - // ======================================== |
703 | | - if (fileName === 'dockerfile' || fileName.startsWith('dockerfile.')) { |
704 | | - return { |
705 | | - type: 'svg', |
706 | | - url: ICON_BASE_URL + 'docker.svg', |
707 | | - color: '#0db7ed', |
708 | | - cls: '' |
709 | | - }; |
710 | | - } |
711 | | - if (fileName === 'docker-compose.yml' || fileName === 'docker-compose.yaml') { |
712 | | - return { |
713 | | - type: 'svg', |
714 | | - url: ICON_BASE_URL + 'docker.svg', |
715 | | - color: '#0db7ed', |
716 | | - cls: '' |
717 | | - }; |
718 | | - } |
719 | | - // ======================================== |
720 | | - // ENV FILES |
721 | | - // ======================================== |
722 | | - if (fileName.startsWith('.env')) { |
723 | | - return { |
724 | | - type: 'svg', |
725 | | - url: ICON_BASE_URL + 'tune.svg', |
726 | | - color: '#e7c547', |
727 | | - cls: '' |
728 | | - }; |
729 | | - } |
730 | | - // ======================================== |
731 | | - // README FILES |
732 | | - // ======================================== |
733 | | - if (fileName === 'readme.md' || fileName === 'readme' || fileName === 'readme.txt') { |
734 | | - return { |
735 | | - type: 'svg', |
736 | | - url: ICON_BASE_URL + 'readme.svg', |
737 | | - color: '#4caf50', |
738 | | - cls: '' |
739 | | - }; |
740 | | - } |
741 | | - // ======================================== |
742 | | - // LICENSE FILES |
743 | | - // ======================================== |
744 | | - if (fileName === 'license' || fileName === 'license.md' || fileName === 'license.txt') { |
745 | | - return { |
746 | | - type: 'svg', |
747 | | - url: ICON_BASE_URL + 'license.svg', |
748 | | - color: '#cbcb41', |
749 | | - cls: '' |
750 | | - }; |
751 | | - } |
752 | | - // ======================================== |
753 | | - // GET BY EXTENSION (DEFAULT) |
754 | | - // ======================================== |
| 547 | + // File icon by extension |
755 | 548 | const ext = name.split('.').pop().toLowerCase(); |
756 | | - const iconData = ICONS[ext] || ICONS['default']; |
757 | | - |
| 549 | + let url = ''; |
| 550 | + if (ext === 'js') url = 'public/contexticon.svg'; |
| 551 | + else if (ext === 'html') url = 'public/contexticon.svg'; |
| 552 | + else if (ext === 'css') url = 'public/contexticon.svg'; |
| 553 | + else if (ext === 'py') url = 'public/contexticon.svg'; |
| 554 | + else if (ext === 'md') url = 'public/contexticon.svg'; |
| 555 | + else url = 'public/contexticon.svg'; |
| 556 | + // You can add more mappings for other extensions if you add more icons |
758 | 557 | return { |
759 | 558 | type: 'svg', |
760 | | - url: ICON_BASE_URL + iconData.icon, |
761 | | - color: iconData.color, |
762 | | - cls: '' // No custom classes needed - icons are already colored |
| 559 | + url, |
| 560 | + color: '', |
| 561 | + cls: '' |
763 | 562 | }; |
764 | 563 | }; |
765 | 564 | const esc = s => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); |
|
892 | 691 | const has = nd.t === 'd' && nd.kids.size > 0; |
893 | 692 | const sz = nd.f ? bytes(nd.f.size) : ''; |
894 | 693 | acc.push({ |
895 | | - html: `<div class="tree-item ${nd.ig ? 'ignored' : ''}" data-path="${nd.full}"> |
| 694 | + html: `<div class="tree-item${nd.ig ? ' ignored' : ''}${has ? ' has-children' : ''}" data-path="${nd.full}"> |
896 | 695 | <div class="tree-item-content" data-level="${lv}"> |
| 696 | + <span class="tree-lines">${Array(lv).fill('<span class=\'tree-vline\'></span>').join('')}</span> |
897 | 697 | <button class="expand-btn" style="visibility:${has ? 'visible' : 'hidden'}"> |
898 | | - <span class="material-symbols-outlined">chevron_right</span> |
| 698 | + <img src="public/arrowRight.svg" class="tree-arrow" alt=">" /> |
899 | 699 | </button> |
900 | 700 | <div class="file-icon ${ic.cls}"> |
901 | 701 | <img src="${ic.url}" alt="${nd.n}" class="vscode-icon" onerror="this.style.display='none'" /> |
|
0 commit comments