Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Jun 15, 2024
1 parent 7f39b48 commit 9c38340
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/ui/src/components/editor/panels/Files/container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
fileBrowserUploadPath,
staticResourcePath
} from '@etherealengine/common/src/schema.type.module'
import { CommonKnownContentTypes } from '@etherealengine/common/src/utils/CommonKnownContentTypes'
import { processFileName } from '@etherealengine/common/src/utils/processFileName'
import { Engine } from '@etherealengine/ecs'
import { AssetSelectionChangePropsType } from '@etherealengine/editor/src/components/assets/AssetsPreviewPanel'
Expand Down Expand Up @@ -104,6 +105,15 @@ export type FileType = {
url: string
}

const fileConsistsOfContentType = function (file: FileType, contentType: string): boolean {
if (file.isFolder) {
return contentType.startsWith('image')
} else {
const guessedType: string = CommonKnownContentTypes[file.type]
return guessedType?.startsWith(contentType)
}
}

export function isFileDataType(value: any): value is FileDataType {
return value && value.key
}
Expand Down Expand Up @@ -145,6 +155,9 @@ const FileBrowserContentPanel: React.FC<FileBrowserContentPanelProps> = (props)
const openCompress = useHookstate(false)
const openConvert = useHookstate(false)

const openConfirm = useHookstate(false)
const contentToDeletePath = useHookstate('')

const filesViewMode = useMutableState(FilesViewModeState).viewMode
const [anchorPosition, setAnchorPosition] = React.useState<any>(undefined)

Expand Down Expand Up @@ -279,6 +292,19 @@ const FileBrowserContentPanel: React.FC<FileBrowserContentPanelProps> = (props)
fileService.update(null, { oldName, newName, oldPath, newPath, isCopy })
}

const handleConfirmClose = () => {
contentToDeletePath.set('')

openConfirm.set(false)
}

const deleteContent = async (): Promise<void> => {
if (isLoading) return
openConfirm.set(false)
fileService.remove(contentToDeletePath.value)
props.onSelectionChanged({ resourceUrl: '', name: '', contentType: '', size: '' })
}

const currentContentRef = useRef(null! as { item: FileDataType; isCopy: boolean })

const showUploadAndDownloadButtons =
Expand Down

0 comments on commit 9c38340

Please sign in to comment.