|
|
|
@ -32,9 +32,42 @@ export const ShowDocModal: FC<IProps> = ({
@@ -32,9 +32,42 @@ export const ShowDocModal: FC<IProps> = ({
|
|
|
|
|
const onClickUrl = (url: string): (() => void) => () => |
|
|
|
|
donwloadWithoutOpenUrl(url); |
|
|
|
|
|
|
|
|
|
const isSupported = () => { |
|
|
|
|
return [ |
|
|
|
|
"pdf", |
|
|
|
|
"csv", |
|
|
|
|
"xslx", |
|
|
|
|
"docx", |
|
|
|
|
"png", |
|
|
|
|
"jpg", |
|
|
|
|
"jpeg", |
|
|
|
|
"bmp", |
|
|
|
|
"mp4", |
|
|
|
|
"webm", |
|
|
|
|
"mp3", |
|
|
|
|
].includes(docType); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const Content = useMemo(() => { |
|
|
|
|
if (!docSrc || !docType) return null; |
|
|
|
|
|
|
|
|
|
if (!isSupported()) { |
|
|
|
|
return ( |
|
|
|
|
<p |
|
|
|
|
style={{ |
|
|
|
|
paddingTop: 40, |
|
|
|
|
paddingBottom: 100, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: 18, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
Предперегляд {'"'} |
|
|
|
|
{docType} |
|
|
|
|
{'"'} типу документа не передбачено в системі |
|
|
|
|
</p> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (docType.includes("pdf")) { |
|
|
|
|
return ( |
|
|
|
|
<object |
|
|
|
@ -79,3 +112,18 @@ export const ShowDocModal: FC<IProps> = ({
@@ -79,3 +112,18 @@ export const ShowDocModal: FC<IProps> = ({
|
|
|
|
|
</ModalComponent> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// return (
|
|
|
|
|
// <>
|
|
|
|
|
// <iframe
|
|
|
|
|
// ref={iframeRef}
|
|
|
|
|
// src={`https://docs.google.com/gview?embedded=true&url=${encodeURIComponent(
|
|
|
|
|
// docSrc
|
|
|
|
|
// )}`}
|
|
|
|
|
// onLoad={(event) => {
|
|
|
|
|
// console.log(event.nativeEvent);
|
|
|
|
|
// }}
|
|
|
|
|
// style={{ width: "100%", height: "auto", border: "none" }}
|
|
|
|
|
// />
|
|
|
|
|
// </>
|
|
|
|
|
// );
|
|
|
|
|