(folder: Folder, project: ProjectWithSessions, level: number = 0, isLastInLevel: boolean = false, parentPath: boolean[] = [])
| 1830 | |
| 1831 | // Recursive function to render a folder and its children |
| 1832 | const renderFolder = (folder: Folder, project: ProjectWithSessions, level: number = 0, isLastInLevel: boolean = false, parentPath: boolean[] = []) => { |
| 1833 | const isExpanded = expandedFolders.has(folder.id); |
| 1834 | const folderSessions = project.sessions.filter(s => s.folderId === folder.id); |
| 1835 | const isDraggingOverFolder = dragState.overType === 'folder' && dragState.overFolderId === folder.id; |
| 1836 | const hasChildren = (folder.children && folder.children.length > 0) || folderSessions.length > 0; |
| 1837 | const folderUnviewedCount = folderSessions.filter(s => s.status === 'completed_unviewed').length; |
| 1838 | |
| 1839 | return ( |
| 1840 | <div key={folder.id} className="relative" style={{ marginLeft: `${level * 16}px` }}> |
| 1841 | {/* Tree lines for this folder */} |
| 1842 | <div className="absolute inset-0 pointer-events-none"> |
| 1843 | {/* Vertical lines for parent levels */} |
| 1844 | {parentPath.map((hasMoreSiblings, parentLevel) => ( |
| 1845 | hasMoreSiblings && ( |
| 1846 | <div |
| 1847 | key={parentLevel} |
| 1848 | className="absolute top-0 bottom-0 w-px bg-border-secondary" |
| 1849 | style={{ left: `${parentLevel * 16 + 8}px` }} |
| 1850 | /> |
| 1851 | ) |
| 1852 | ))} |
| 1853 | |
| 1854 | |
| 1855 | {/* Vertical line for this level (if not last and has children when expanded) */} |
| 1856 | {level > 0 && !isLastInLevel && ( |
| 1857 | <div |
| 1858 | className="absolute top-0 bottom-0 w-px bg-border-secondary" |
| 1859 | style={{ left: `${(level - 1) * 16 + 8}px` }} |
| 1860 | /> |
| 1861 | )} |
| 1862 | |
| 1863 | {/* Vertical line down from this folder if expanded and has children */} |
| 1864 | {isExpanded && hasChildren && ( |
| 1865 | <div |
| 1866 | className="absolute w-px bg-border-secondary" |
| 1867 | style={{ |
| 1868 | left: `${level * 16 + 8}px`, |
| 1869 | top: '24px', |
| 1870 | bottom: '0px' |
| 1871 | }} |
| 1872 | /> |
| 1873 | )} |
| 1874 | |
| 1875 | {/* Horizontal connector line for this folder */} |
| 1876 | {level > 0 && ( |
| 1877 | <div |
| 1878 | className="absolute h-px bg-border-secondary" |
| 1879 | style={{ |
| 1880 | left: `${(level - 1) * 16 + 8}px`, |
| 1881 | right: `calc(100% - ${level * 16}px)`, |
| 1882 | top: '12px' |
| 1883 | }} |
| 1884 | /> |
| 1885 | )} |
| 1886 | </div> |
| 1887 | <div |
| 1888 | className={`relative group/folder flex items-center space-x-1 py-1 rounded cursor-pointer transition-colors hover:bg-surface-hover ${ |
| 1889 | isDraggingOverFolder ? 'bg-interactive/20' : '' |
no test coverage detected