diff --git a/src/components/Explorer/FileExplorer.tsx b/src/components/Explorer/FileExplorer.tsx
index 590a9b9fe..b53e6a390 100644
--- a/src/components/Explorer/FileExplorer.tsx
+++ b/src/components/Explorer/FileExplorer.tsx
@@ -5,8 +5,7 @@ import {
type FileExplorerRow,
type FileExplorerRender,
type FileExplorerRowContextMenuProps,
- FILE_PLACEHOLDER_NAME,
- FOLDER_PLACEHOLDER_NAME,
+ isRowFake,
} from '@src/components/Explorer/utils'
import { ContextMenu, ContextMenuItem } from '@src/components/ContextMenu'
import { useRef } from 'react'
@@ -16,11 +15,14 @@ export const StatusDot = () => {
}
/**
- * Implement a dynamic spacer with rem to offset the row
- * in the tree based on the level within the tree
- * level 0 to level N
+ * A dynamic spacer that will add spaces based on the level it is in the tree
+ * @param level supported be from 0 to N
+ * @returns
*/
const Spacer = (level: number) => {
+ if (level < 0) {
+ return
Do not pass a number less than 0.
+ }
const containerRemSpacing = `${level}rem`
return level === 0 ? (
@@ -50,10 +52,7 @@ const Spacer = (level: number) => {
* Render all the rows of the file explorer in linear layout in the DOM.
* each row is rendered one after another in the same parent DOM element
* rows will have aria support to understand the linear div soup layout
- *
-
- * what is opened and selected outside of this logic level.
- *
+ * Pure functional renderer, state is stored outside this component.
*/
export const FileExplorer = ({
rowsToRender,
@@ -66,8 +65,6 @@ export const FileExplorer = ({
contextMenuRow: FileExplorerRow | null
isRenaming: boolean
}) => {
- // Local state for selection and what is opened
- // diff this against new Project value that comes in
return (
{rowsToRender.map((row, index, original) => {
@@ -91,11 +88,17 @@ export const FileExplorer = ({
)
}
+/**
+ * TODO Support more context menu callback functions
+ * cut
+ * paste
+ * copy
+ *
+ */
function FileExplorerRowContextMenu({
itemRef,
onRename,
onDelete,
- onClone,
onOpenInNewWindow,
callback,
}: FileExplorerRowContextMenuProps) {
@@ -134,10 +137,6 @@ function RenameForm({
if (e.key !== 'Enter') {
return
}
-
- // TODO: Do the renaming
- // newName: inputRef.current?.value || fileOrDir.name || '',
-
// To get out of the renaming state, without this the current file is still in renaming mode
onSubmit(e)
}
@@ -158,12 +157,7 @@ function RenameForm({
e.stopPropagation()
}
}
-
- const hidePlaceHolderIfFakeRow =
- row.name === FOLDER_PLACEHOLDER_NAME || row.name === FILE_PLACEHOLDER_NAME
- ? ''
- : row.name
-
+ const formattedPlaceHolder = isRowFake(row) ? '' : row.name
return (