|
2 | 2 | import type { TreeNode } from "./types"; |
3 | 3 | import { formatLeafValue, isPreviewable } from "./utils"; |
4 | 4 | import CheckIcon from "@mui/icons-material/Check"; |
5 | | -// for copy button |
6 | | -// add to imports |
7 | 5 | import ContentCopyIcon from "@mui/icons-material/ContentCopy"; |
8 | 6 | import DownloadIcon from "@mui/icons-material/Download"; |
9 | 7 | import ExpandLess from "@mui/icons-material/ExpandLess"; |
@@ -70,41 +68,6 @@ const FileTreeRow: React.FC<Props> = ({ |
70 | 68 | } |
71 | 69 | }; |
72 | 70 |
|
73 | | - // if (node.kind === "folder") { |
74 | | - // return ( |
75 | | - // <> |
76 | | - // <Box |
77 | | - // sx={{ |
78 | | - // display: "flex", |
79 | | - // alignItems: "center", |
80 | | - // gap: 1, |
81 | | - // py: 0.5, |
82 | | - // px: 1, |
83 | | - // cursor: "pointer", |
84 | | - // "&:hover": { backgroundColor: "rgba(0,0,0,0.04)" }, |
85 | | - // }} |
86 | | - // onClick={() => setOpen((o) => !o)} |
87 | | - // > |
88 | | - // <Box sx={{ pl: level * 1.25 }}> |
89 | | - // <FolderIcon fontSize="small" /> |
90 | | - // </Box> |
91 | | - // <Typography sx={{ fontWeight: 600, flex: 1 }}>{node.name}</Typography> |
92 | | - // {open ? <ExpandLess /> : <ExpandMore />} |
93 | | - // </Box> |
94 | | - |
95 | | - // <Collapse in={open} timeout="auto" unmountOnExit> |
96 | | - // {node.children.map((child) => ( |
97 | | - // <FileTreeRow |
98 | | - // key={child.path} |
99 | | - // node={child} |
100 | | - // level={level + 1} |
101 | | - // onPreview={onPreview} |
102 | | - // /> |
103 | | - // ))} |
104 | | - // </Collapse> |
105 | | - // </> |
106 | | - // ); |
107 | | - // } |
108 | 71 | if (node.kind === "folder") { |
109 | 72 | // const isSubject = /^sub-/i.test(node.name); // subject folders only |
110 | 73 | const isJson = /\.json$/i.test(node.name); // end with .json only |
@@ -225,9 +188,7 @@ const FileTreeRow: React.FC<Props> = ({ |
225 | 188 | } |
226 | 189 | // if the node is a file |
227 | 190 | return ( |
228 | | - <Box |
229 | | - sx={{ display: "flex", alignItems: "flex-start", gap: 1, py: 0.5, px: 1 }} |
230 | | - > |
| 191 | + <Box sx={{ display: "flex", alignItems: "center", gap: 1, py: 0.5, px: 1 }}> |
231 | 192 | <Box sx={{ pl: level * 1.25, pt: "2px" }}> |
232 | 193 | <InsertDriveFileIcon |
233 | 194 | fontSize="small" |
@@ -289,6 +250,8 @@ const FileTreeRow: React.FC<Props> = ({ |
289 | 250 | </IconButton> |
290 | 251 | </span> |
291 | 252 | </Tooltip> |
| 253 | + {/* Placeholder to align with folder chevron */} |
| 254 | + <Box sx={{ width: 28 }} /> |
292 | 255 | {(externalUrl || internal) && ( |
293 | 256 | <Box |
294 | 257 | sx={{ display: "flex", gap: 1, flexShrink: 0 }} |
@@ -331,27 +294,6 @@ const FileTreeRow: React.FC<Props> = ({ |
331 | 294 | Preview |
332 | 295 | </Button> |
333 | 296 | )} |
334 | | - |
335 | | - {/* {node.link?.url && ( |
336 | | - <Box sx={{ display: "flex", gap: 1, flexShrink: 0 }}> |
337 | | - <Button |
338 | | - size="small" |
339 | | - variant="text" |
340 | | - onClick={() => window.open(node.link!.url, "_blank")} |
341 | | - startIcon={<DownloadIcon fontSize="small" />} |
342 | | - > |
343 | | - Download |
344 | | - </Button> |
345 | | - {isPreviewable(node.link.url) && ( |
346 | | - <Button |
347 | | - size="small" |
348 | | - variant="text" |
349 | | - startIcon={<VisibilityIcon fontSize="small" />} |
350 | | - onClick={() => onPreview(node.link!.url, node.link!.index)} |
351 | | - > |
352 | | - Preview |
353 | | - </Button> |
354 | | - )} */} |
355 | 297 | </Box> |
356 | 298 | )} |
357 | 299 | </Box> |
|
0 commit comments