MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / updateParentModelGroupThumbnailCarousel

Function updateParentModelGroupThumbnailCarousel

renderer.js:19274–19343  ·  view source on GitHub ↗
(thumbnailWrap, imageElement, thumbnails)

Source from the content-addressed store, hash-verified

19272 bar.appendChild(favBtn);
19273 updateEngagementBarDisplay(bar, rating, favorite);
19274
19275 return bar;
19276}
19277
19278// Helper function to create a DOM element for a model item
19279function createModelItem(model, viewMode = null, thumbPriority = THUMB_PRIORITY_BACKGROUND) {
19280 const view = viewMode || currentGridView;
19281 const item = document.createElement('div');
19282 item.className = `file-item file-item-${view}`;
19283 item.dataset.filepath = model.filePath;
19284
19285 if (isInSelectedModels(model.filePath)) {
19286 item.classList.add('selected');
19287 }
19288
19289 // Print status element
19290 const printStatus = document.createElement('div');
19291 printStatus.className = 'print-status' + (model.printed ? ' printed' : '');
19292 printStatus.textContent = model.printed ? 'Printed' : 'Not Printed';
19293 printStatus.style.cursor = 'pointer';
19294 printStatus.title = 'Click to toggle printed status';
19295
19296 // Add click handler to toggle printed status
19297 printStatus.addEventListener('click', async (e) => {
19298 e.preventDefault();
19299 e.stopPropagation(); // Prevent triggering file item click
19300
19301 // Get current model state to ensure we have the latest printed status
19302 const currentModel = await window.electron.getModel(model.filePath);
19303 if (currentModel) {
19304 const newPrintedStatus = !currentModel.printed;
19305 await autoSaveModel('printed', newPrintedStatus, model.filePath);
19306 }
19307 });
19308
19309 item.appendChild(printStatus);
19310
19311 // Archive status element (for models inside ZIP archives)
19312 const isZipEntry = model.filePath && model.filePath.includes('::');
19313 let archiveStatus = null;
19314 if (isZipEntry) {
19315 archiveStatus = document.createElement('div');
19316 archiveStatus.className = 'archive-status';
19317 archiveStatus.textContent = 'Archive';
19318 item.appendChild(archiveStatus);
19319 }
19320
19321 // Define thumbnail sizes based on view mode (optimized)
19322 const previewPx = view === 'preview' ? getPreviewTileSizePx() : 0;
19323 const thumbnailSizes = {
19324 'list': { width: '48px', height: '48px' }, // Slightly larger for better visibility
19325 'preview': { width: `${previewPx}px`, height: `${previewPx}px` },
19326 'detailed': { width: '276px', height: '276px' } // Optimized large thumbnail
19327 };
19328
19329 const thumbSize = thumbnailSizes[view] || thumbnailSizes['detailed'];
19330
19331 // Thumbnail container with size based on view mode

Callers 2

Calls 2

navigateFunction · 0.85
updateBadgeFunction · 0.85

Tested by

no test coverage detected