(items)
| 704 | } |
| 705 | |
| 706 | function renderList(items) { |
| 707 | if (!listEl) return; |
| 708 | listEl.textContent = ''; |
| 709 | |
| 710 | items.forEach((entry) => { |
| 711 | const name = String(entry.name || ''); |
| 712 | const type = String(entry.type || 'file'); |
| 713 | const isFolder = type === 'folder'; |
| 714 | const fullPath = isFolder ? joinPath(currentPath, name) : joinPath(currentPath, name); |
| 715 | |
| 716 | const row = document.createElement('div'); |
| 717 | row.className = 'fr-share-row ' + (isFolder ? 'is-folder' : 'is-file'); |
| 718 | |
| 719 | const nameCell = document.createElement('div'); |
| 720 | nameCell.className = 'fr-share-cell fr-share-cell-name'; |
| 721 | |
| 722 | const icon = document.createElement('div'); |
| 723 | icon.className = 'fr-share-icon ' + (isFolder ? 'fr-share-icon-folder' : 'fr-share-icon-file'); |
| 724 | if (isFolder) { |
| 725 | icon.textContent = 'DIR'; |
| 726 | } else { |
| 727 | const ext = getExt(name).toUpperCase(); |
| 728 | icon.textContent = ext ? ext.slice(0, 4) : 'FILE'; |
| 729 | } |
| 730 | |
| 731 | const link = document.createElement('a'); |
| 732 | link.className = 'fr-share-link'; |
| 733 | link.textContent = name || '(unnamed)'; |
| 734 | link.title = name; |
| 735 | if (isFolder) { |
| 736 | link.href = buildShareUrl(fullPath); |
| 737 | } else { |
| 738 | link.href = buildDownloadFileUrl(fullPath, false); |
| 739 | } |
| 740 | |
| 741 | nameCell.appendChild(icon); |
| 742 | nameCell.appendChild(link); |
| 743 | |
| 744 | const sizeCell = document.createElement('div'); |
| 745 | sizeCell.className = 'fr-share-cell fr-share-cell-size'; |
| 746 | sizeCell.textContent = isFolder ? '-' : formatBytes(entry.size); |
| 747 | |
| 748 | const modCell = document.createElement('div'); |
| 749 | modCell.className = 'fr-share-cell fr-share-cell-modified'; |
| 750 | modCell.textContent = formatDate(entry.modified); |
| 751 | |
| 752 | const actionsCell = document.createElement('div'); |
| 753 | actionsCell.className = 'fr-share-cell fr-share-cell-actions'; |
| 754 | |
| 755 | if (isFolder) { |
| 756 | const openBtn = document.createElement('a'); |
| 757 | openBtn.className = 'fr-share-pill'; |
| 758 | openBtn.href = buildShareUrl(fullPath); |
| 759 | openBtn.textContent = 'Open'; |
| 760 | actionsCell.appendChild(openBtn); |
| 761 | } else { |
| 762 | const previewType = getPreviewType(name); |
| 763 | if (previewType) { |
no test coverage detected