changes after review

pull/4767/head
Joseph Izang 7 months ago
parent bf631af43d
commit b0776057f9
  1. 19
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  2. 6
      libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx

@ -304,13 +304,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (dest.length === 0 || sourcesrc.length === 0) return
if (await moveFilesIsAllowed(sourcesrc, dest) === false) return
const src = sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join('\n')
try {
props.dispatchMoveFiles(sourcesrc, dest)
} catch (error) {
props.modal(
intl.formatMessage({ id: 'filePanel.movingFileFailed' }),
intl.formatMessage({ id: 'filePanel.movingFileFailedMsg' }, { src }),
intl.formatMessage({ id: 'filePanel.movingFileFailedMsg' }, { src: sourcesrc.join(' ') }),
intl.formatMessage({ id: 'filePanel.close' }),
async () => { }
)
@ -328,13 +328,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (dest.length === 0 || sourcesrc.length === 0) return
if (await moveFoldersIsAllowed(sourcesrc, dest) === false) return
const src = sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join('\n')
// console.log('moveFolderSilently', { src, dest, sourcesrc })
try {
props.dispatchMoveFolders(sourcesrc, dest)
} catch (error) {
props.modal(
intl.formatMessage({ id: 'filePanel.movingFolderFailed' }),
intl.formatMessage({ id: 'filePanel.movingFolderFailedMsg' }, { src }),
intl.formatMessage({ id: 'filePanel.movingFolderFailedMsg' }, { src: sourcesrc.join(' ') }),
intl.formatMessage({ id: 'filePanel.close' }),
async () => { }
)
@ -343,9 +343,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
const handleFileMove = async (dest: string, sourcesrc: string[]) => {
if (await moveFilesIsAllowed(sourcesrc, dest) === false) return
const files = filesSelected && filesSelected.length > 0 && filesSelected.join('\n')
console.log(files)
const src = files.length > 0 ? files : sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join('\n')
console.log('What files have been selected?', filesSelected)
const files = filesSelected && filesSelected.length > 0 && filesSelected.join(' ')
const src = files.length > 0 ? files : sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join(' ')
console.log('handleFileMove sourcesrc', {files, sourcesrc, dest, src })
try {
props.modal(
intl.formatMessage({ id: 'filePanel.moveFile' }),
@ -367,9 +368,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
const handleFolderMove = async (dest: string, sourcesrc: string[]) => {
if (await moveFoldersIsAllowed(sourcesrc, dest) === false) return
const folders = filesSelected && filesSelected.length > 0 && filesSelected.join('\n')
const folders = filesSelected && filesSelected.length > 0 && filesSelected.join(' ')
console.log(folders)
const src = folders.length > 0 ? folders : sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join('\n')
const src = folders.length > 0 ? folders : sourcesrc.length === 1 ? sourcesrc[0] : sourcesrc.join(' ')
try {
props.modal(
intl.formatMessage({ id: 'filePanel.moveFile' }),

@ -53,12 +53,13 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
}
const onDrop = async (event: SyntheticEvent) => {
event.stopPropagation()
event.preventDefault()
const target = await getEventTarget(event)
const items = buildMultiSelectedItemProfiles(target)
const filePaths = []
// console.log('onDrop', { items, target, filePaths })
let dragDestination: any
if (!target || !target.path) {
dragDestination = {
@ -68,8 +69,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
} else {
dragDestination = getFlatTreeItem(target.path)
}
filePaths.push(dragDestination.path)
items.forEach((item) => filePaths.push(item.path))
props.setFilesSelected(filePaths)

Loading…
Cancel
Save