clean up file-explorer and context menu

pull/5370/head
Joseph Izang 2 years ago committed by Aniket
parent 656d946427
commit d9b2128b8d
  1. 6
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  2. 4
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx

@ -13,7 +13,7 @@ declare global {
const _paq = window._paq = window._paq || [] //eslint-disable-line
export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => {
const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, copyFileName, copyPath, paste, runScript, emit, pageX, pageY, path, type, focus, generateUml, ...otherProps } = props
const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, copyFileName, copyPath, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props
const contextMenuRef = useRef(null)
const intl = useIntl()
useEffect(() => {
@ -64,9 +64,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
}
const menu = () => {
return actions.filter(item => filterItem(item)).sort((a, b) => {
return a.name > b.name ? -1 : a.name < b.name ? 1 : 0
}).reverse().map((item, index) => {
return actions.filter(item => filterItem(item)).map((item, index) => {
return <li
id={`menuitem${item.name.toLowerCase()}`}
key={index}

@ -14,7 +14,7 @@ import { Drag } from "@remix-ui/drag-n-drop"
import { ROOT_PATH } from '../utils/constants'
export const FileExplorer = (props: FileExplorerProps) => {
const { name, contextMenuItems, removedContextMenuItems, files, fileState, plugin } = props
const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props
const [state, setState] = useState<FileExplorerState>({
ctrlKey: false,
newFileName: '',
@ -38,8 +38,6 @@ export const FileExplorer = (props: FileExplorerProps) => {
})
const [canPaste, setCanPaste] = useState(false)
const treeRef = useRef<HTMLDivElement>(null)
const [contentForAST, setContentForAST] = useState('')
useEffect(() => {
if (contextMenuItems) {

Loading…
Cancel
Save