track when copy happens with boolean flag

pull/5062/head
Joseph Izang 3 months ago committed by Aniket
parent e6b03b0fe8
commit 3f476d2a41
  1. 5
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  2. 5
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  3. 1
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -35,7 +35,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
uploadFile,
uploadFolder,
fileState,
canPaste
canPaste,
hasCopied
} = props
const [state, setState] = useState<WorkSpaceState>(workspaceState)
// const [isPending, startTransition] = useTransition();
@ -286,7 +287,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
targetDocument?.removeEventListener('keydown', CopyComboHandler)
}
}
}, [treeRef.current, feTarget, canPaste, state.copyElement.length])
}, [treeRef.current, feTarget, canPaste, state.copyElement.length, hasCopied])
const hasReservedKeyword = (content: string): boolean => {
if (state.reservedKeywords.findIndex((value) => content.startsWith(value)) !== -1) return true

@ -146,6 +146,7 @@ export function Workspace() {
}
const inputValue = useRef(null)
const [, dispatch] = useReducer(loadingReducer, loadingInitialState)
const [hasCopied, setHasCopied] = useState(false)
const toast = (message: string) => {
setModalState((prevState) => {
@ -522,6 +523,7 @@ export function Workspace() {
setCanPaste(true)
const path = copied[0].key
global.toast(intl.formatMessage({ id: 'filePanel.copiedToClipboard' }, { path }))
setHasCopied(true)
}
const handleCopyClick = (path: string, type: 'folder' | 'file' | 'workspace') => {
@ -530,6 +532,7 @@ export function Workspace() {
})
setCanPaste(true)
global.toast(intl.formatMessage({ id: 'filePanel.copiedToClipboard' }, { path }))
setHasCopied(true)
}
const handlePasteClick = (dest: string, destType: string) => {
@ -1072,6 +1075,7 @@ export function Workspace() {
importFromIpfs={importFromUrl}
importFromHttps={importFromUrl}
canPaste={canPaste}
hasCopied={hasCopied}
/>
)}
@ -1090,6 +1094,7 @@ export function Workspace() {
flatTree={global.fs.localhost.flatTree}
fileState={[]}
canPaste={canPaste}
hasCopied={hasCopied}
workspaceState={state}
expandPath={global.fs.localhost.expandPath}
focusEdit={global.fs.focusEdit}

@ -102,6 +102,7 @@ export interface FileExplorerProps {
name: string,
menuItems?: string[],
canPaste: boolean
hasCopied: boolean
contextMenuItems: MenuItems,
removedContextMenuItems: MenuItems,
files: { [x: string]: Record<string, FileType> },

Loading…
Cancel
Save