Skip to content

Commit

Permalink
QOL updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker committed Jun 1, 2024
1 parent bcc31fd commit 2e45ca9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion src/Components/Common/FilePreviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -130,13 +143,21 @@ const FilePreviewDialog = (props: FilePreviewProps) => {
}}
pageNumber={page}
/>
) : (
) : previewExtensions.includes(file_state.extension) ? (
<iframe
sandbox=""
title="Source Files"
src={fileUrl}
className="h-[75vh] w-full"
/>
) : (
<div className="flex h-full w-full flex-col items-center justify-center">
<CareIcon
icon="l-file"
className="mb-4 text-5xl text-gray-600"
/>
Can't preview this file. Try downloading it.
</div>
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/useFileManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default function useFileManager(
<CareIcon icon="l-archive" className="mr-2" />
This file has been archived and cannot be unarchived.
</div>
<div className="grid grid-cols-2 gap-4">
<div className="flex flex-col gap-4 md:grid md:grid-cols-2">
{[
{
label: "File Name",
Expand Down

0 comments on commit 2e45ca9

Please sign in to comment.