diff --git a/app/assets/javascripts/components/Files/FilePreviewInfoPanel.tsx b/app/assets/javascripts/components/Files/FilePreviewInfoPanel.tsx new file mode 100644 index 000000000..cf215c80d --- /dev/null +++ b/app/assets/javascripts/components/Files/FilePreviewInfoPanel.tsx @@ -0,0 +1,37 @@ +import { formatSizeToReadableString } from '@standardnotes/filepicker'; +import { SNFile } from '@standardnotes/snjs'; +import { FunctionComponent } from 'preact'; +import { Icon } from '../Icon'; + +type Props = { + file: SNFile; +}; + +export const FilePreviewInfoPanel: FunctionComponent = ({ file }) => { + return ( +
+
+ +
File information
+
+
+ Type: {file.mimeType} +
+
+ Size:{' '} + {formatSizeToReadableString(file.size)} +
+
+ Created:{' '} + {file.created_at.toLocaleString()} +
+
+ Last Modified:{' '} + {file.userModifiedDate.toLocaleString()} +
+
+ File ID: {file.uuid} +
+
+ ); +}; diff --git a/app/assets/javascripts/components/Files/FilePreviewModal.tsx b/app/assets/javascripts/components/Files/FilePreviewModal.tsx index e1d0b4b0b..6ea7f46e0 100644 --- a/app/assets/javascripts/components/Files/FilePreviewModal.tsx +++ b/app/assets/javascripts/components/Files/FilePreviewModal.tsx @@ -8,6 +8,7 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; import { getFileIconComponent } from '../AttachedFilesPopover/PopoverFileItem'; import { Button } from '../Button'; import { Icon } from '../Icon'; +import { FilePreviewInfoPanel } from './FilePreviewInfoPanel'; import { isFileTypePreviewable } from './isFilePreviewable'; type Props = { @@ -40,6 +41,7 @@ export const FilePreviewModal: FunctionComponent = ({ const [objectUrl, setObjectUrl] = useState(); const [isFilePreviewable, setIsFilePreviewable] = useState(false); const [isLoadingFile, setIsLoadingFile] = useState(false); + const [showFileInfoPanel, setShowFileInfoPanel] = useState(false); const closeButtonRef = useRef(null); const getObjectUrl = useCallback(async () => { @@ -109,6 +111,12 @@ export const FilePreviewModal: FunctionComponent = ({ {file.name}
+ {objectUrl && (
-
- {objectUrl ? ( - getPreviewComponentForFile(file, objectUrl) - ) : isLoadingFile ? ( -
- ) : ( -
- -
- This file can't be previewed. -
- {isFilePreviewable ? ( - <> -
- There was an error loading the file. Try again, or download - it and open it using another application. -
-
+
+
+ {objectUrl ? ( + getPreviewComponentForFile(file, objectUrl) + ) : isLoadingFile ? ( +
+ ) : ( +
+ +
+ 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. +
+
+ + +
+ + ) : ( + <> +
+ To view this file, download it and open it using another + application. +
- -
- - ) : ( - <> -
- To view this file, download it and open it using another - application. -
- - - )} -
- )} + + )} +
+ )} +
+ {showFileInfoPanel && }
diff --git a/app/assets/stylesheets/_sn.scss b/app/assets/stylesheets/_sn.scss index f2e8bdcbd..266087998 100644 --- a/app/assets/stylesheets/_sn.scss +++ b/app/assets/stylesheets/_sn.scss @@ -473,6 +473,10 @@ border-right-width: 1px; } +.sn-component .border-l-1px { + border-left-width: 1px; +} + .sn-component .border-t-1px { border-top-width: 1px; } @@ -493,6 +497,10 @@ padding: 0.25rem; } +.p-1\.5 { + padding: 0.375rem; +} + .p-8 { padding: 2rem; }