diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index f0d0ab08f04..5c09b0fd201 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -1370,3 +1370,18 @@ export const PATIENT_NOTES_THREADS = { } as const; export const RATION_CARD_CATEGORY = ["BPL", "APL", "NO_CARD"] as const; + +export const DEFAULT_ALLOWED_EXTENSIONS = [ + "image/*", + "video/*", + "audio/*", + "text/plain", + "text/csv", + "application/rtf", + "application/msword", + "application/vnd.oasis.opendocument.text", + "application/pdf", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/vnd.oasis.opendocument.spreadsheet,application/pdf", +]; diff --git a/src/Components/Common/FilePreviewDialog.tsx b/src/Components/Common/FilePreviewDialog.tsx index 9bf9780c7a3..b4443d330ea 100644 --- a/src/Components/Common/FilePreviewDialog.tsx +++ b/src/Components/Common/FilePreviewDialog.tsx @@ -32,6 +32,19 @@ type FilePreviewProps = { fixedWidth?: boolean; }; +const previewExtensions = [ + ".html", + ".htm", + ".pdf", + ".mp4", + ".webm", + ".jpg", + ".jpeg", + ".png", + ".gif", + ".webp", +]; + const FilePreviewDialog = (props: FilePreviewProps) => { const { show, onClose, file_state, setFileState, downloadURL, fileUrl } = props; @@ -130,13 +143,21 @@ const FilePreviewDialog = (props: FilePreviewProps) => { }} pageNumber={page} /> - ) : ( + ) : previewExtensions.includes(file_state.extension) ? (