diff --git a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx index 3352e44b43..ead7268c0a 100644 --- a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx +++ b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx @@ -1,11 +1,11 @@ -import React, { useState, useEffect, useRef, useMemo, useContext } from 'react'; // eslint-disable-line +import React, { useState, useEffect, useRef, useContext } from 'react'; // eslint-disable-line import { TreeViewItemProps } from '../../types'; import './tree-view-item.css'; -import { MoveContext } from '../../../../workspace/src/lib/components/file-explorer' - +import { MoveContext } from '@remix-ui/workspace' + export const TreeViewItem = (props: TreeViewItemProps) => { - const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, innerRef, file, showIcon = true, ...otherProps } = props; + const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, file, showIcon = true, ...otherProps } = props; const [isExpanded, setIsExpanded] = useState(false); const dragRef = useRef(); const moveContext = useContext(MoveContext) diff --git a/libs/remix-ui/tree-view/src/types/index.ts b/libs/remix-ui/tree-view/src/types/index.ts index 8f20c1b8a2..1248e7ad5a 100644 --- a/libs/remix-ui/tree-view/src/types/index.ts +++ b/libs/remix-ui/tree-view/src/types/index.ts @@ -1,6 +1,4 @@ /* eslint-disable no-undef */ -import { FileType } from 'libs/remix-ui/workspace/src/lib/types/index' - export interface TreeViewProps { children?: React.ReactNode, id?: string @@ -27,5 +25,5 @@ export interface TreeViewItemProps { showIcon?: boolean expandedPaths?: string[]; handleClickFolder?: (path: string, type: string) => void; - file?: FileType + file?: any } diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 528589afc1..523a7d3943 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -10,18 +10,7 @@ import '../css/file-explorer.css' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' - -interface MoveContextType{ - dragged: string, - moveFile: (dest: string) => void - currentlyMoved: (path: string) => void -} - -export const MoveContext = React.createContext({ - dragged:"", - moveFile:( )=> {}, - currentlyMoved: () => {} -}) +import { MoveContext } from '../contexts' export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 56bba8e036..c0bcb7c59f 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -33,3 +33,16 @@ export const FileSystemContext = createContext<{ dispatchMoveFile: (src: string, dest: string) => Promise, dispatchCloneRepository: (url: string) => Promise }>(null) + +interface MoveContextType{ + dragged: string, + moveFile: (dest: string) => void + currentlyMoved: (path: string) => void +} + +export const MoveContext = createContext({ + dragged:"", + moveFile:( )=> {}, + currentlyMoved: () => {} +}) + \ No newline at end of file