diff --git a/client/modules/datafiles/src/DatafilesModal/PreviewModal/PreviewModal.tsx b/client/modules/datafiles/src/DatafilesModal/PreviewModal/PreviewModal.tsx index 767bec7860..bc6b10c144 100644 --- a/client/modules/datafiles/src/DatafilesModal/PreviewModal/PreviewModal.tsx +++ b/client/modules/datafiles/src/DatafilesModal/PreviewModal/PreviewModal.tsx @@ -1,6 +1,7 @@ import { useQueryClient } from '@tanstack/react-query'; import { TFileListing, + useAuthenticatedUser, useFileListingRouteParams, useFilePreview, } from '@client/hooks'; @@ -44,6 +45,13 @@ export const PreviewModalBody: React.FC<{ handleCancel(); }, [handleCancel, queryClient]); + const { user } = useAuthenticatedUser(); + const isReadOnly = [ + 'designsafe.storage.published', + 'designsafe.storage.community', + 'nees.public', + ].includes(selectedFile.system); + if (!isOpen) return null; return ( @@ -72,7 +80,7 @@ export const PreviewModalBody: React.FC<{ > {!selectedFile.path.endsWith('.hazmapper') && ( <> - {scheme === 'private' && api === 'tapis' && ( + {!isReadOnly && api === 'tapis' && ( )} - - {({ onClick }) => ( - - )} - + {user && ( + + {({ onClick }) => ( + + )} + + )}