(filePath, container, existingThumbnail)
| 12834 | fileInfo.appendChild(parentDirElement); |
| 12835 | |
| 12836 | |
| 12837 | |
| 12838 | const fileDetails = document.createElement('div'); |
| 12839 | fileDetails.className = 'file-details'; |
| 12840 | fileDetails.innerHTML = `<span class="directory-label">Size: |
| 12841 | <span>${file.size? formatFileSize(file.size): ''}</span> |
| 12842 | `; |
| 12843 | fileInfo.appendChild(fileDetails); |
| 12844 | fileElement.appendChild(fileInfo); |
| 12845 | |
| 12846 | fileElement.addEventListener('click', () => { |
| 12847 | toggleModelSelection(fileElement, file.filePath); |
| 12848 | }); |
| 12849 | // Designer info is now shown in metadata section, so we don't need it here |
| 12850 | // Removed redundant designer info display |
| 12851 | |
| 12852 | if (!file.thumbnail &&!skipThumbnail) { |
| 12853 | const fileExtension = file.filePath.split('.').pop().toLowerCase(); |
| 12854 | if (fileExtension === '3mf') { |
| 12855 | try { |
| 12856 | const images = await window.electron.get3MFImages(file.filePath); |
| 12857 | if (images && images.length > 0) { |
| 12858 | const firstImage = images[0]; |
| 12859 | console.log(`[DEBUG] renderFile: Using ${images.length} embedded image(s) from 3MF: ${file.filePath}`); |
| 12860 | const img = document.createElement('img'); |
| 12861 | img.src = firstImage; |
| 12862 | img.className = 'model-thumbnail'; |
| 12863 | thumbnailContainer.innerHTML = ''; |
| 12864 | thumbnailContainer.appendChild(img); |
| 12865 | thumbnailContainer.classList.remove('loading'); |
| 12866 | |
| 12867 | await window.electron.addMultipleThumbnails(file.filePath, images); |
| 12868 | file.thumbnail = firstImage; |
| 12869 | |
| 12870 | return fileElement; |
| 12871 | } else { |
| 12872 | console.log(`[DEBUG] renderFile: No embedded images found in 3MF: ${file.filePath}`); |
| 12873 | } |
| 12874 | } catch (imageError) { |
| 12875 | console.error('renderFile: Error checking for embedded image:', imageError); |
| 12876 | } |
| 12877 | } |
| 12878 | |
| 12879 | try { |
| 12880 | const thumbnail = await new Promise((resolve, reject) => { |
| 12881 | renderQueue.push({ |
| 12882 | filePath: file.filePath, |
| 12883 | container: thumbnailContainer, |
| 12884 | existingThumbnail: null, |
| 12885 | resolve, |
| 12886 | reject, |
| 12887 | thumbPriority: THUMB_PRIORITY_BACKGROUND |
| 12888 | }); |
| 12889 | processRenderQueue(); |
| 12890 | }); |
| 12891 | |
| 12892 | if (thumbnail) { |
| 12893 | await window.electron.saveThumbnail(file.filePath, thumbnail); |
no test coverage detected