diff --git a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx index 3bc79721e1..15689d9984 100644 --- a/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx +++ b/client/modules/datafiles/src/DatafilesToolbar/DatafilesToolbar.tsx @@ -83,6 +83,11 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ const rules = useMemo( function () { + // Check if none of the selected files end with `.hazmapper`. + const notContainingHazmapperFile = selectedFiles.every( + (file) => !file.path.endsWith('.hazmapper') + ); + // Rules for which toolbar buttons are active for a given selection. return { canPreview: @@ -91,21 +96,24 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ user && selectedFiles.length === 1 && !isReadOnly && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, canCopy: + user && selectedFiles.length >= 1 && notContainingHazmapperFile, + canMove: user && selectedFiles.length >= 1 && - !selectedFiles[0].path.endsWith('.hazmapper'), + !isReadOnly && + notContainingHazmapperFile, canTrash: user && selectedFiles.length >= 1 && !isReadOnly && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, // Disable downloads from frontera.work until we have a non-flaky mount on ds-download. canDownload: selectedFiles.length >= 1 && system !== USER_WORK_SYSTEM && - !selectedFiles[0].path.endsWith('.hazmapper'), + notContainingHazmapperFile, }; }, [selectedFiles, isReadOnly, user, system] @@ -138,7 +146,7 @@ export const DatafilesToolbar: React.FC<{ searchInput?: React.ReactNode }> = ({ {({ onClick }) => (