|
|
@ -32,9 +32,42 @@ export const ShowDocModal: FC<IProps> = ({ |
|
|
|
const onClickUrl = (url: string): (() => void) => () => |
|
|
|
const onClickUrl = (url: string): (() => void) => () => |
|
|
|
donwloadWithoutOpenUrl(url); |
|
|
|
donwloadWithoutOpenUrl(url); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isSupported = () => { |
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
|
|
"pdf", |
|
|
|
|
|
|
|
"csv", |
|
|
|
|
|
|
|
"xslx", |
|
|
|
|
|
|
|
"docx", |
|
|
|
|
|
|
|
"png", |
|
|
|
|
|
|
|
"jpg", |
|
|
|
|
|
|
|
"jpeg", |
|
|
|
|
|
|
|
"bmp", |
|
|
|
|
|
|
|
"mp4", |
|
|
|
|
|
|
|
"webm", |
|
|
|
|
|
|
|
"mp3", |
|
|
|
|
|
|
|
].includes(docType); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const Content = useMemo(() => { |
|
|
|
const Content = useMemo(() => { |
|
|
|
if (!docSrc || !docType) return null; |
|
|
|
if (!docSrc || !docType) return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSupported()) { |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<p |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
paddingTop: 40, |
|
|
|
|
|
|
|
paddingBottom: 100, |
|
|
|
|
|
|
|
textAlign: "center", |
|
|
|
|
|
|
|
fontSize: 18, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Предперегляд {'"'} |
|
|
|
|
|
|
|
{docType} |
|
|
|
|
|
|
|
{'"'} типу документа не передбачено в системі |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (docType.includes("pdf")) { |
|
|
|
if (docType.includes("pdf")) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<object |
|
|
|
<object |
|
|
@ -79,3 +112,18 @@ export const ShowDocModal: FC<IProps> = ({ |
|
|
|
</ModalComponent> |
|
|
|
</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" }}
|
|
|
|
|
|
|
|
// />
|
|
|
|
|
|
|
|
// </>
|
|
|
|
|
|
|
|
// );
|
|
|
|