diff options
| author | diogo464 <[email protected]> | 2025-08-12 10:55:44 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-12 10:55:44 +0100 |
| commit | 4ef7eb34f9e67ec8c7ac0b6e02d33740eed233d1 (patch) | |
| tree | 5a4c6ba4a7cef1d143d038f8304602958412efdc | |
| parent | 546b1dbd65f705c65c8fe46383e34661c8ccc627 (diff) | |
Make entire directory rows clickable for toggle
Enhanced directory interaction by making the entire table row clickable
to expand/collapse folders, improving user experience and efficiency.
- Added row-level click handlers for directories with cursor feedback
- Prevented event bubbling on checkbox and actions dropdown cells
- Simplified arrow buttons to show state only (no individual clicks)
- Preserved file download links and all existing functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
| -rw-r--r-- | frontend/file-drive.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/frontend/file-drive.tsx b/frontend/file-drive.tsx index 1e14c78..2784c1a 100644 --- a/frontend/file-drive.tsx +++ b/frontend/file-drive.tsx | |||
| @@ -306,14 +306,18 @@ export default function FileDrive() { | |||
| 306 | const rows: React.ReactNode[] = [] | 306 | const rows: React.ReactNode[] = [] |
| 307 | 307 | ||
| 308 | rows.push( | 308 | rows.push( |
| 309 | <TableRow key={item.path} className={`hover:bg-muted/50 ${isSelected ? "bg-muted/30" : ""}`}> | 309 | <TableRow |
| 310 | <TableCell className="w-[40px]"> | 310 | key={item.path} |
| 311 | className={`hover:bg-muted/50 ${isSelected ? "bg-muted/30" : ""} ${item.type === "dir" ? "cursor-pointer" : ""}`} | ||
| 312 | onClick={item.type === "dir" ? () => toggleFolder(item.path) : undefined} | ||
| 313 | > | ||
| 314 | <TableCell className="w-[40px]" onClick={(e) => e.stopPropagation()}> | ||
| 311 | <Checkbox checked={isSelected} onCheckedChange={() => toggleFileSelection(item.path)} /> | 315 | <Checkbox checked={isSelected} onCheckedChange={() => toggleFileSelection(item.path)} /> |
| 312 | </TableCell> | 316 | </TableCell> |
| 313 | <TableCell className="font-medium"> | 317 | <TableCell className="font-medium"> |
| 314 | <div className="flex items-center gap-2" style={{ paddingLeft: `${level * 20}px` }}> | 318 | <div className="flex items-center gap-2" style={{ paddingLeft: `${level * 20}px` }}> |
| 315 | {item.type === "dir" && ( | 319 | {item.type === "dir" && ( |
| 316 | <Button variant="ghost" size="sm" className="h-4 w-4 p-0" onClick={() => toggleFolder(item.path)}> | 320 | <Button variant="ghost" size="sm" className="h-4 w-4 p-0"> |
| 317 | {isExpanded ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />} | 321 | {isExpanded ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />} |
| 318 | </Button> | 322 | </Button> |
| 319 | )} | 323 | )} |
| @@ -322,7 +326,7 @@ export default function FileDrive() { | |||
| 322 | ) : ( | 326 | ) : ( |
| 323 | <File className="h-4 w-4 text-gray-500" /> | 327 | <File className="h-4 w-4 text-gray-500" /> |
| 324 | )} | 328 | )} |
| 325 | {item.type === "file" && item.blob ? ( | 329 | {item.type === "file" && item.blob ? ( |
| 326 | <a | 330 | <a |
| 327 | href={`/blob/${item.blob}?filename=${encodeURIComponent(item.name)}`} | 331 | href={`/blob/${item.blob}?filename=${encodeURIComponent(item.name)}`} |
| 328 | className="text-blue-600 hover:text-blue-800 hover:underline cursor-pointer" | 332 | className="text-blue-600 hover:text-blue-800 hover:underline cursor-pointer" |
| @@ -338,7 +342,7 @@ export default function FileDrive() { | |||
| 338 | </TableCell> | 342 | </TableCell> |
| 339 | <TableCell>{formatFileSize(item.size || 0)}</TableCell> | 343 | <TableCell>{formatFileSize(item.size || 0)}</TableCell> |
| 340 | <TableCell>{formatDate(item.lastmod)}</TableCell> | 344 | <TableCell>{formatDate(item.lastmod)}</TableCell> |
| 341 | <TableCell> | 345 | <TableCell onClick={(e) => e.stopPropagation()}> |
| 342 | <DropdownMenu> | 346 | <DropdownMenu> |
| 343 | <DropdownMenuTrigger asChild> | 347 | <DropdownMenuTrigger asChild> |
| 344 | <Button variant="ghost" size="sm" className="h-8 w-8 p-0"> | 348 | <Button variant="ghost" size="sm" className="h-8 w-8 p-0"> |
