🐛 Fix discerning file and folder roots (#862)
This commit is contained in:
+6
-3
@@ -33,8 +33,8 @@ const PendingRootRow = ({
|
||||
const uploadedFilesSize = root.uploadedSize;
|
||||
const uploadProgress = Math.floor((uploadedFilesSize / root.size) * 100);
|
||||
const isUploadCompleted = root.status === 'completed';
|
||||
const isFileRoot = root.isUnknownFormat || rootKey.includes('.');
|
||||
const fileType = isFileRoot ? rootKey.split('.').pop() : '';
|
||||
const isFileRoot = root.isFileRoot;
|
||||
const fileType = isFileRoot && rootKey.includes('.') ? rootKey.split('.').pop() : '';
|
||||
|
||||
// Callback function to open the folder after the upload is completed
|
||||
const handleShowFolder = useCallback(() => {
|
||||
@@ -116,7 +116,10 @@ const PendingRootRow = ({
|
||||
return rootName;
|
||||
};
|
||||
|
||||
const showFileFolderTestId = !showFolder || isFileRoot ? 'testid:upload-root-modal-row-show-file' : 'testid:upload-root-modal-row-show-folder';
|
||||
const showFileFolderTestId =
|
||||
!showFolder || isFileRoot
|
||||
? 'testid:upload-root-modal-row-show-file'
|
||||
: 'testid:upload-root-modal-row-show-folder';
|
||||
|
||||
return (
|
||||
<div className="root-row testid:upload-root-modal-row">
|
||||
|
||||
@@ -105,8 +105,8 @@ class FileUploadService {
|
||||
this.rootStates.failed[key] = true;
|
||||
}
|
||||
|
||||
// Check if the root is a file with unknow format
|
||||
const isUnknownFormat =
|
||||
// Check if the root is a file regardless of the file format
|
||||
const isFileRoot =
|
||||
this.groupedPendingFiles[key]?.length === 1 &&
|
||||
this.groupedPendingFiles[key][0].originalFile?.name === key;
|
||||
|
||||
@@ -142,7 +142,7 @@ class FileUploadService {
|
||||
size: this.rootSizes[key],
|
||||
uploadedSize,
|
||||
status,
|
||||
isUnknownFormat,
|
||||
isFileRoot,
|
||||
};
|
||||
|
||||
return acc;
|
||||
@@ -253,10 +253,9 @@ class FileUploadService {
|
||||
},
|
||||
callback: async (filePayload, context) => {
|
||||
const root = filePayload.root;
|
||||
const isUnknownFormat =
|
||||
const isFileRoot =
|
||||
this.groupedPendingFiles[root]?.length === 1 &&
|
||||
this.groupedPendingFiles[root][0].originalFile?.name === root;
|
||||
const isFileRoot = isUnknownFormat || filePayload.root.includes('.');
|
||||
|
||||
const file = filePayload.file;
|
||||
if (file) {
|
||||
|
||||
@@ -9,7 +9,7 @@ export const RootPendingFilesListState = atom<
|
||||
uploadedSize: number;
|
||||
status: string;
|
||||
items: PendingFileRecoilType[];
|
||||
isUnknownFormat: boolean;
|
||||
isFileRoot: boolean;
|
||||
};
|
||||
}
|
||||
| undefined
|
||||
|
||||
@@ -94,7 +94,7 @@ export type UploadRootType = {
|
||||
uploadedSize: number;
|
||||
status: string;
|
||||
items: PendingFileRecoilType[];
|
||||
isUnknownFormat: boolean;
|
||||
isFileRoot: boolean;
|
||||
};
|
||||
|
||||
export type UploadRootListType = {
|
||||
|
||||
Reference in New Issue
Block a user