diff options
| author | diogo464 <[email protected]> | 2025-08-12 10:50:21 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-12 10:50:21 +0100 |
| commit | 546b1dbd65f705c65c8fe46383e34661c8ccc627 (patch) | |
| tree | f3bfab4b2d77fac217df48a920be6d3fe7db04af /frontend | |
| parent | ee1ea39b01170892386f2a11ea65370184cd50b5 (diff) | |
Enable clickable file downloads in file tree
Files with blob IDs now appear as clickable links that download directly.
- Added conditional rendering for files with valid blobs
- Files display as blue links with hover effects
- Downloads open in new tab to preserve current view
- Proper URL encoding for special characters in filenames
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/file-drive.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/frontend/file-drive.tsx b/frontend/file-drive.tsx index 7a59def..1e14c78 100644 --- a/frontend/file-drive.tsx +++ b/frontend/file-drive.tsx | |||
| @@ -322,7 +322,18 @@ export default function FileDrive() { | |||
| 322 | ) : ( | 322 | ) : ( |
| 323 | <File className="h-4 w-4 text-gray-500" /> | 323 | <File className="h-4 w-4 text-gray-500" /> |
| 324 | )} | 324 | )} |
| 325 | <span>{item.name}</span> | 325 | {item.type === "file" && item.blob ? ( |
| 326 | <a | ||
| 327 | href={`/blob/${item.blob}?filename=${encodeURIComponent(item.name)}`} | ||
| 328 | className="text-blue-600 hover:text-blue-800 hover:underline cursor-pointer" | ||
| 329 | target="_blank" | ||
| 330 | rel="noopener noreferrer" | ||
| 331 | > | ||
| 332 | {item.name} | ||
| 333 | </a> | ||
| 334 | ) : ( | ||
| 335 | <span>{item.name}</span> | ||
| 336 | )} | ||
| 326 | </div> | 337 | </div> |
| 327 | </TableCell> | 338 | </TableCell> |
| 328 | <TableCell>{formatFileSize(item.size || 0)}</TableCell> | 339 | <TableCell>{formatFileSize(item.size || 0)}</TableCell> |
