diff --git a/src/dataEntryApp/components/MediaUploader.js b/src/dataEntryApp/components/MediaUploader.js index 701f05895..39a4b5905 100644 --- a/src/dataEntryApp/components/MediaUploader.js +++ b/src/dataEntryApp/components/MediaUploader.js @@ -9,6 +9,7 @@ import Audiotrack from "@material-ui/icons/Audiotrack"; import CloudUploadIcon from "@material-ui/icons/CloudUpload"; import CustomizedBackdrop from "./CustomizedBackdrop"; import CloseIcon from "@material-ui/icons/Close"; +import ReactImageVideoLightbox from "react-image-video-lightbox"; import { Concept } from "avni-models"; import { FilePreview } from "./FilePreview"; import MediaService from "../../adminApp/service/MediaService"; @@ -83,6 +84,7 @@ export const MediaUploader = ({ label, obsValue, mediaType, update, formElement const [preview, setPreview] = useState({}); const [uploadButtonClicked, setUploadButtonClicked] = useState(0); const [uploading, setUploading] = useState(false); + const [openImage, setOpenImage] = useState(); const isFileDataType = formElement.getType() === Concept.dataType.File; const supportedMIMEType = isFileDataType ? getFileMimeType(formElement) : `${mediaType}/*`; const isMultiSelect = formElement.isMultiSelect(); @@ -106,6 +108,13 @@ export const MediaUploader = ({ label, obsValue, mediaType, update, formElement setUploading(uploadButtonClicked > 0); }, [uploadButtonClicked]); + useEffect(() => { + if (openImage) { + const LightBoxContainer = document.querySelector("div.imagePreviewContainer"); + LightBoxContainer.firstChild.style.zIndex = 1; + } + }, [openImage]); + const onMediaSelect = event => { const alerts = []; const etFiles = Array.from(event.target.files); @@ -165,9 +174,16 @@ export const MediaUploader = ({ label, obsValue, mediaType, update, formElement })); }; - //TODO ONCLICK open in new tab const mediaPreviewMap = fileToPreview => ({ - image: {label}, + image: ( + {label} setOpenImage(fileToPreview)} + /> + ), video: (