diff --git a/packages/web/src/javascripts/Components/FilePreview/FilePreview.tsx b/packages/web/src/javascripts/Components/FilePreview/FilePreview.tsx index b86a2506c..8f1febf9b 100644 --- a/packages/web/src/javascripts/Components/FilePreview/FilePreview.tsx +++ b/packages/web/src/javascripts/Components/FilePreview/FilePreview.tsx @@ -6,7 +6,8 @@ import Spinner from '@/Components/Spinner/Spinner' import FilePreviewError from './FilePreviewError' import { isFileTypePreviewable } from './isFilePreviewable' import PreviewComponent from './PreviewComponent' -import ProtectedItemOverlay from '../ProtectedItemOverlay/ProtectedItemOverlay' +import Button from '../Button/Button' +import { ProtectedIllustration } from '@standardnotes/icons' type Props = { application: WebApplication @@ -77,13 +78,28 @@ const FilePreview = ({ file, application }: Props) => { }, [application.files, downloadedBytes, file, isFilePreviewable, isAuthorized]) if (!isAuthorized) { + const hasProtectionSources = application.hasProtectionSources() + return ( - application.protections.authorizeItemAccess(file)} - hasProtectionSources={application.hasProtectionSources()} - /> +
+ +
This file is protected.
+

+ {hasProtectionSources + ? 'Authenticate to view this file.' + : 'Add a passcode or create an account to require authentication to view this file.'} +

+
+ {!hasProtectionSources && ( + + )} + +
+
) } diff --git a/packages/web/src/javascripts/Components/FilePreview/FilePreviewError.tsx b/packages/web/src/javascripts/Components/FilePreview/FilePreviewError.tsx index 29119f021..67f9a9f36 100644 --- a/packages/web/src/javascripts/Components/FilePreview/FilePreviewError.tsx +++ b/packages/web/src/javascripts/Components/FilePreview/FilePreviewError.tsx @@ -17,7 +17,7 @@ const FilePreviewError = ({ file, filesController, isFilePreviewable, tryAgainCa
This file can't be previewed.
{isFilePreviewable ? ( <> -
+
There was an error loading the file. Try again, or download the file and open it using another application.
@@ -41,7 +41,7 @@ const FilePreviewError = ({ file, filesController, isFilePreviewable, tryAgainCa ) : ( <> -
+
To view this file, download it and open it using another application.