2023-02-07 17:09:48 +00:00
|
|
|
import { isMobileOnly } from "react-device-detect";
|
2023-02-10 10:04:57 +00:00
|
|
|
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-13 13:28:33 +00:00
|
|
|
import ViewerWrapper from "./sub-components/ViewerWrapper";
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
import { MediaViewerProps } from "./MediaViewer.props";
|
2023-02-07 17:09:48 +00:00
|
|
|
import { FileStatus } from "@docspace/common/constants";
|
2023-02-10 10:04:57 +00:00
|
|
|
import {
|
|
|
|
isNullOrUndefined,
|
|
|
|
KeyboardEventKeys,
|
|
|
|
mapSupplied,
|
|
|
|
mediaTypes,
|
|
|
|
} from "./helpers";
|
2023-02-07 17:09:48 +00:00
|
|
|
|
|
|
|
import InfoOutlineReactSvgUrl from "PUBLIC_DIR/images/info.outline.react.svg?url";
|
|
|
|
import CopyReactSvgUrl from "PUBLIC_DIR/images/copy.react.svg?url";
|
|
|
|
import DuplicateReactSvgUrl from "PUBLIC_DIR/images/duplicate.react.svg?url";
|
|
|
|
import DownloadReactSvgUrl from "PUBLIC_DIR/images/download.react.svg?url";
|
|
|
|
import RenameReactSvgUrl from "PUBLIC_DIR/images/rename.react.svg?url";
|
|
|
|
import TrashReactSvgUrl from "PUBLIC_DIR/images/trash.react.svg?url";
|
|
|
|
import MoveReactSvgUrl from "PUBLIC_DIR/images/duplicate.react.svg?url";
|
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
function MediaViewer({
|
|
|
|
playlistPos,
|
|
|
|
nextMedia,
|
|
|
|
prevMedia,
|
|
|
|
...props
|
|
|
|
}: MediaViewerProps): JSX.Element {
|
|
|
|
const [title, setTitle] = useState<string>("");
|
|
|
|
const [fileUrl, setFileUrl] = useState<string>(() => {
|
|
|
|
const { playlist, currentFileId } = props;
|
|
|
|
const item = playlist.find(
|
|
|
|
(file) => file.fileId.toString() === currentFileId.toString()
|
|
|
|
);
|
|
|
|
return item?.src ?? "";
|
|
|
|
});
|
|
|
|
|
|
|
|
const [targetFile, setTargetFile] = useState(() => {
|
|
|
|
const { files, currentFileId } = props;
|
|
|
|
return files.find((item) => item.id === currentFileId);
|
|
|
|
});
|
|
|
|
|
|
|
|
const [isFavorite, setIsFavorite] = useState<boolean>(() => {
|
|
|
|
const { playlist } = props;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
return (
|
|
|
|
(playlist[playlistPos].fileStatus & FileStatus.IsFavorite) ===
|
|
|
|
FileStatus.IsFavorite
|
|
|
|
);
|
|
|
|
});
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
useEffect(() => {
|
|
|
|
const fileId = props.playlist[playlistPos]?.fileId;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (!isNullOrUndefined(fileId) && props.currentFileId !== fileId) {
|
|
|
|
props.onChangeUrl(fileId);
|
|
|
|
}
|
|
|
|
}, [props.playlist.length]);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
useEffect(() => {
|
|
|
|
const { playlist, files, setBufferSelection } = props;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const currentFile = playlist[playlistPos];
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const currentFileId =
|
|
|
|
playlist.length > 0
|
|
|
|
? playlist.find((file) => file.id === playlistPos)?.fileId
|
|
|
|
: 0;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const targetFile = files.find((item) => item.id === currentFileId);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (targetFile) setBufferSelection(targetFile);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const { src, title } = currentFile;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const ext = getFileExtension(title);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (ext === ".tiff" || ext === ".tif") {
|
|
|
|
fetchAndSetTiffDataURL(src);
|
|
|
|
}
|
|
|
|
}, []);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
useEffect(() => {
|
|
|
|
const { playlist, onEmptyPlaylistError, files, setBufferSelection } = props;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const { src, title, fileId } = playlist[playlistPos];
|
|
|
|
const ext = getFileExtension(title);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (!src) return onEmptyPlaylistError();
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (ext !== ".tif" && ext !== ".tiff" && src !== fileUrl) {
|
|
|
|
setFileUrl(src);
|
|
|
|
}
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (ext === ".tiff" || ext === ".tif") {
|
|
|
|
fetchAndSetTiffDataURL(src);
|
|
|
|
}
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const foundFile = files.find((file) => file.id === fileId);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (!isNullOrUndefined(foundFile)) {
|
|
|
|
setTargetFile(foundFile);
|
|
|
|
setBufferSelection(foundFile);
|
|
|
|
}
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
setTitle(title);
|
|
|
|
setIsFavorite(
|
|
|
|
(playlist[playlistPos].fileStatus & FileStatus.IsFavorite) ===
|
|
|
|
FileStatus.IsFavorite
|
|
|
|
);
|
|
|
|
}, [
|
|
|
|
props.playlist.length,
|
|
|
|
props.files.length,
|
|
|
|
props.currentFileId,
|
|
|
|
playlistPos,
|
|
|
|
]);
|
|
|
|
|
2023-02-13 09:07:53 +00:00
|
|
|
useEffect(() => {
|
|
|
|
document.addEventListener("keydown", onKeydown);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
document.removeEventListener("keydown", onKeydown);
|
|
|
|
};
|
|
|
|
}, [
|
|
|
|
props.playlist.length,
|
|
|
|
props.files.length,
|
|
|
|
playlistPos,
|
|
|
|
props.deleteDialogVisible,
|
|
|
|
]);
|
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const getContextModel = () => {
|
|
|
|
const {
|
|
|
|
t,
|
|
|
|
onClickDownload,
|
|
|
|
onClickRename,
|
|
|
|
onClickDelete,
|
|
|
|
onShowInfoPanel,
|
|
|
|
onMoveAction,
|
|
|
|
onCopyAction,
|
|
|
|
onDuplicate,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
if (!targetFile) return [];
|
|
|
|
|
|
|
|
const desktopModel = [
|
|
|
|
{
|
|
|
|
key: "download",
|
|
|
|
label: t("Common:Download"),
|
|
|
|
icon: DownloadReactSvgUrl,
|
|
|
|
onClick: () => onClickDownload(targetFile, t),
|
|
|
|
disabled: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "rename",
|
|
|
|
label: t("Rename"),
|
|
|
|
icon: RenameReactSvgUrl,
|
|
|
|
onClick: () => onClickRename(targetFile),
|
|
|
|
disabled: archiveRoom,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "delete",
|
|
|
|
label: t("Common:Delete"),
|
|
|
|
icon: TrashReactSvgUrl,
|
|
|
|
onClick: () => onClickDelete(targetFile, t),
|
|
|
|
disabled: archiveRoom,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const model = [
|
|
|
|
{
|
|
|
|
id: "option_room-info",
|
|
|
|
key: "room-info",
|
|
|
|
label: t("Common:Info"),
|
|
|
|
icon: InfoOutlineReactSvgUrl,
|
|
|
|
onClick: () => {
|
|
|
|
return onShowInfoPanel(targetFile);
|
|
|
|
},
|
|
|
|
disabled: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "download",
|
|
|
|
label: t("Common:Download"),
|
|
|
|
icon: DownloadReactSvgUrl,
|
|
|
|
onClick: () => onClickDownload(targetFile, t),
|
|
|
|
disabled: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "move-to",
|
|
|
|
label: t("MoveTo"),
|
|
|
|
icon: MoveReactSvgUrl,
|
|
|
|
onClick: onMoveAction,
|
|
|
|
disabled: !targetFile.security.Move,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "option_copy-to",
|
|
|
|
key: "copy-to",
|
|
|
|
label: t("Translations:Copy"),
|
|
|
|
icon: CopyReactSvgUrl,
|
|
|
|
onClick: onCopyAction,
|
|
|
|
disabled: !targetFile.security.Copy,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "option_create-copy",
|
|
|
|
key: "copy",
|
|
|
|
label: t("Common:Duplicate"),
|
|
|
|
icon: DuplicateReactSvgUrl,
|
|
|
|
onClick: () => onDuplicate(targetFile, t),
|
|
|
|
disabled: !targetFile.security.Duplicate,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "rename",
|
|
|
|
label: t("Rename"),
|
|
|
|
icon: RenameReactSvgUrl,
|
|
|
|
onClick: () => onClickRename(targetFile),
|
|
|
|
disabled: !targetFile.security.Rename,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
key: "separator0",
|
|
|
|
isSeparator: true,
|
|
|
|
disabled: !targetFile.security.Delete,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "delete",
|
|
|
|
label: t("Common:Delete"),
|
|
|
|
icon: TrashReactSvgUrl,
|
|
|
|
onClick: () => onClickDelete(targetFile, t),
|
|
|
|
disabled: !targetFile.security.Delete,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
return isMobileOnly
|
|
|
|
? model
|
|
|
|
: isImage && !isMobileOnly
|
|
|
|
? desktopModel.filter((el) => el.key !== "download")
|
|
|
|
: desktopModel;
|
|
|
|
};
|
|
|
|
|
|
|
|
const canImageView = useCallback(
|
|
|
|
(ext: string) => {
|
|
|
|
const { extsImagePreviewed } = props;
|
|
|
|
return extsImagePreviewed.indexOf(ext) != -1;
|
|
|
|
},
|
|
|
|
[props.extsImagePreviewed]
|
|
|
|
);
|
|
|
|
|
|
|
|
const canPlay = useCallback(
|
|
|
|
(fileTitle: string) => {
|
|
|
|
const { extsMediaPreviewed } = props;
|
|
|
|
|
|
|
|
const ext =
|
|
|
|
fileTitle[0] === "." ? fileTitle : getFileExtension(fileTitle);
|
|
|
|
|
|
|
|
const supply = mapSupplied[ext];
|
|
|
|
|
|
|
|
return !!supply && extsMediaPreviewed.indexOf(ext) != -1;
|
|
|
|
},
|
|
|
|
[props.extsMediaPreviewed]
|
|
|
|
);
|
|
|
|
|
|
|
|
const getFileExtension = useCallback((fileTitle: string) => {
|
|
|
|
if (!fileTitle) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
fileTitle = fileTitle.trim();
|
|
|
|
const posExt = fileTitle.lastIndexOf(".");
|
|
|
|
return 0 <= posExt ? fileTitle.substring(posExt).trim().toLowerCase() : "";
|
|
|
|
}, []);
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-15 08:09:36 +00:00
|
|
|
let lastRemovedFileId: null | number = null;
|
2023-02-14 12:32:55 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const onDelete = () => {
|
2023-02-13 11:19:21 +00:00
|
|
|
const { playlist, onDelete } = props;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
let currentFileId = playlist.find((file) => file.id === playlistPos)
|
|
|
|
?.fileId;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-15 08:09:36 +00:00
|
|
|
if (currentFileId === lastRemovedFileId) return;
|
2023-02-14 12:32:55 +00:00
|
|
|
|
2023-02-13 11:19:21 +00:00
|
|
|
const canDelete = targetFile?.security?.Delete;
|
2023-02-13 09:24:11 +00:00
|
|
|
|
|
|
|
if (!canDelete) return;
|
|
|
|
|
2023-02-14 12:32:55 +00:00
|
|
|
if (!isNullOrUndefined(currentFileId)) {
|
|
|
|
onDelete(currentFileId);
|
2023-02-15 08:09:36 +00:00
|
|
|
lastRemovedFileId = currentFileId;
|
2023-02-14 12:32:55 +00:00
|
|
|
}
|
2023-02-10 10:04:57 +00:00
|
|
|
};
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const onDownload = () => {
|
|
|
|
const { playlist, onDownload } = props;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
let currentFileId = playlist.find((file) => file.id === playlistPos)
|
|
|
|
?.fileId;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (!isNullOrUndefined(currentFileId)) onDownload(currentFileId);
|
|
|
|
};
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 12:13:52 +00:00
|
|
|
const onKeydown = (event: KeyboardEvent) => {
|
2023-02-10 10:04:57 +00:00
|
|
|
const { code, ctrlKey } = event;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (code in KeyboardEventKeys) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
2023-02-13 09:07:53 +00:00
|
|
|
if (props.deleteDialogVisible) return;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
switch (code) {
|
|
|
|
case KeyboardEventKeys.ArrowLeft:
|
2023-02-13 09:07:53 +00:00
|
|
|
if (document.fullscreenElement) return;
|
2023-02-10 10:04:57 +00:00
|
|
|
|
|
|
|
if (ctrlKey) {
|
|
|
|
const rotateLeftElement = document.getElementsByClassName(
|
|
|
|
"iconContainer rotateLeft"
|
|
|
|
)?.[0] as HTMLElement | undefined;
|
|
|
|
rotateLeftElement?.click();
|
|
|
|
} else {
|
|
|
|
prevMedia();
|
2023-02-07 17:09:48 +00:00
|
|
|
}
|
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.ArrowRight:
|
2023-02-13 09:07:53 +00:00
|
|
|
if (document.fullscreenElement) return;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
if (ctrlKey) {
|
|
|
|
const rotateRightElement = document.getElementsByClassName(
|
|
|
|
"iconContainer rotateRight"
|
|
|
|
)?.[0] as HTMLElement | undefined;
|
|
|
|
rotateRightElement?.click();
|
|
|
|
} else {
|
|
|
|
nextMedia();
|
2023-02-08 14:21:14 +00:00
|
|
|
}
|
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.Space:
|
|
|
|
const videoPlayElement = document.getElementsByClassName(
|
|
|
|
"video-play"
|
|
|
|
)?.[0] as HTMLElement | undefined;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
videoPlayElement?.click();
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.Escape:
|
|
|
|
if (!props.deleteDialogVisible) props.onClose();
|
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.KeyS:
|
|
|
|
if (ctrlKey) onDownload();
|
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.Digit1:
|
|
|
|
case KeyboardEventKeys.Numpad1:
|
|
|
|
if (ctrlKey) {
|
|
|
|
const resetElement = document.getElementsByClassName(
|
|
|
|
"iconContainer reset"
|
|
|
|
)?.[0] as HTMLElement | undefined;
|
|
|
|
resetElement?.click();
|
2023-02-07 17:09:48 +00:00
|
|
|
}
|
2023-02-10 10:04:57 +00:00
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
case KeyboardEventKeys.Delete:
|
|
|
|
onDelete();
|
|
|
|
break;
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
2023-02-10 07:00:57 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const onClose = useCallback(() => {
|
|
|
|
props.onClose();
|
|
|
|
}, [props.onClose]);
|
2023-02-10 07:00:57 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const fetchAndSetTiffDataURL = useCallback((src: string) => {
|
|
|
|
if (!window.Tiff) return;
|
2023-02-10 07:00:57 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
xhr.responseType = "arraybuffer";
|
2023-02-10 07:00:57 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
xhr.open("GET", src);
|
|
|
|
xhr.onload = function () {
|
|
|
|
try {
|
|
|
|
const tiff = new window.Tiff({ buffer: xhr.response });
|
2023-02-08 14:21:14 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
const dataUrl = tiff.toDataURL();
|
2023-02-07 17:09:48 +00:00
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
setFileUrl(dataUrl);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
2023-02-07 17:09:48 +00:00
|
|
|
};
|
2023-02-10 10:04:57 +00:00
|
|
|
xhr.send();
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const onSetSelectionFile = useCallback(() => {
|
|
|
|
props.setBufferSelection(targetFile);
|
|
|
|
}, [targetFile]);
|
|
|
|
|
|
|
|
const ext = getFileExtension(title);
|
|
|
|
const images = useMemo(() => [{ src: fileUrl, alt: "" }], [fileUrl]);
|
|
|
|
const audioIcon = useMemo(() => props.getIcon(96, ext), [ext]);
|
|
|
|
const headerIcon = useMemo(() => props.getIcon(24, ext), [ext]);
|
|
|
|
|
|
|
|
let isVideo = false;
|
|
|
|
let isAudio = false;
|
|
|
|
let canOpen = true;
|
|
|
|
let isImage = false;
|
|
|
|
|
|
|
|
const archiveRoom =
|
|
|
|
props.archiveRoomsId === targetFile?.rootFolderId ||
|
|
|
|
(!targetFile?.security?.Rename && !targetFile?.security?.Delete);
|
|
|
|
|
|
|
|
if (canPlay(ext) && canImageView(ext)) {
|
|
|
|
canOpen = false;
|
|
|
|
props.onError?.();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (canImageView(ext)) {
|
|
|
|
isImage = true;
|
|
|
|
} else {
|
|
|
|
isImage = false;
|
|
|
|
isVideo = mapSupplied[ext]
|
|
|
|
? mapSupplied[ext]?.type == mediaTypes.video
|
|
|
|
: false;
|
|
|
|
isAudio = mapSupplied[ext]
|
|
|
|
? mapSupplied[ext]?.type == mediaTypes.audio
|
|
|
|
: false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{canOpen && (
|
2023-02-13 13:28:33 +00:00
|
|
|
<ViewerWrapper
|
2023-02-10 10:04:57 +00:00
|
|
|
userAccess={props.userAccess}
|
|
|
|
visible={props.visible}
|
|
|
|
title={title}
|
|
|
|
onClose={onClose}
|
|
|
|
images={images}
|
|
|
|
inactive={props.playlist.length <= 1}
|
|
|
|
playlist={props.playlist}
|
|
|
|
playlistPos={playlistPos}
|
|
|
|
onNextClick={nextMedia}
|
|
|
|
onSetSelectionFile={onSetSelectionFile}
|
|
|
|
contextModel={getContextModel}
|
|
|
|
onPrevClick={prevMedia}
|
|
|
|
onDeleteClick={onDelete}
|
|
|
|
isFavorite={isFavorite}
|
|
|
|
isImage={isImage}
|
|
|
|
isAudio={isAudio}
|
|
|
|
isVideo={isVideo}
|
|
|
|
isPreviewFile={props.isPreviewFile}
|
|
|
|
onDownloadClick={onDownload}
|
|
|
|
archiveRoom={archiveRoom}
|
|
|
|
errorTitle={props.t("Files:MediaError")}
|
|
|
|
headerIcon={headerIcon}
|
|
|
|
audioIcon={audioIcon}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
2023-02-03 15:05:26 +00:00
|
|
|
}
|
|
|
|
|
2023-02-10 10:04:57 +00:00
|
|
|
export default MediaViewer;
|