|
|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect, useState } from 'react'
|
|
|
+import React, { useEffect } from 'react'
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
|
import withErrorBoundary from '../../../infrastructure/error-boundary'
|
|
|
@@ -31,17 +31,6 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
|
|
|
const { _id: projectId } = useProjectContext(projectContextPropTypes)
|
|
|
const { fileTreeData } = useFileTreeData()
|
|
|
const isReady = projectId && fileTreeData
|
|
|
- const [shouldShowVisualSelection, setShouldShowVisualSelection] =
|
|
|
- useState(true)
|
|
|
-
|
|
|
- const handleFileTreeClick = e => {
|
|
|
- if (e.target.classList.contains('bottom-buffer')) {
|
|
|
- setShouldShowVisualSelection(false)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- setShouldShowVisualSelection(e.target !== e.currentTarget)
|
|
|
- }
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (isReady) onInit()
|
|
|
@@ -59,15 +48,8 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
|
|
|
{isConnected ? null : <div className="disconnected-overlay" />}
|
|
|
<FileTreeToolbar />
|
|
|
<FileTreeContextMenu />
|
|
|
- {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
|
|
|
- <div
|
|
|
- className="file-tree-inner"
|
|
|
- onClick={handleFileTreeClick}
|
|
|
- data-testid="file-tree-inner"
|
|
|
- >
|
|
|
- <FileTreeRootFolder
|
|
|
- shouldShowVisualSelection={shouldShowVisualSelection}
|
|
|
- />
|
|
|
+ <div className="file-tree-inner">
|
|
|
+ <FileTreeRootFolder />
|
|
|
</div>
|
|
|
<FileTreeModalDelete />
|
|
|
<FileTreeModalCreateFile />
|
|
|
@@ -77,7 +59,7 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
|
|
|
)
|
|
|
})
|
|
|
|
|
|
-function FileTreeRootFolder({ shouldShowVisualSelection }) {
|
|
|
+function FileTreeRootFolder() {
|
|
|
useFileTreeSocketListener()
|
|
|
const { fileTreeData } = useFileTreeData()
|
|
|
|
|
|
@@ -93,7 +75,6 @@ function FileTreeRootFolder({ shouldShowVisualSelection }) {
|
|
|
classes={{ root: 'file-tree-list' }}
|
|
|
dropRef={dropRef}
|
|
|
isOver={isOver}
|
|
|
- shouldShowVisualSelection={shouldShowVisualSelection}
|
|
|
>
|
|
|
<li className="bottom-buffer" />
|
|
|
</FileTreeFolderList>
|
|
|
@@ -101,10 +82,6 @@ function FileTreeRootFolder({ shouldShowVisualSelection }) {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-FileTreeRootFolder.propTypes = {
|
|
|
- shouldShowVisualSelection: PropTypes.bool,
|
|
|
-}
|
|
|
-
|
|
|
FileTreeRoot.propTypes = {
|
|
|
onSelect: PropTypes.func.isRequired,
|
|
|
onInit: PropTypes.func.isRequired,
|