import React from "react"; import _ from "lodash"; import {Grid, Header as SHeader, Image,} from "semantic-ui-react"; import {TagsSelector} from "../Tags"; import {Media} from "../contexts/contexts"; import {encodeMediaPath} from "./Common"; import {fetchFile, tagFileGroup, untagFileGroup} from "../api"; import {StlViewer} from "react-stl-viewer"; import {Button, Modal, ModalActions, ModalContent, ModalHeader} from "./Theme"; import {toast} from "react-semantic-toasts-2"; function getMediaPathURL(previewFile) { if (previewFile['primary_path']) { return `/media/${encodeMediaPath(previewFile['primary_path'])}`; } else { return `/media/${encodeMediaPath(previewFile['path'])}`; } } function getDownloadPathURL(previewFile) { if (previewFile['primary_path']) { return `/download/${encodeMediaPath(previewFile['primary_path'])}`; } else { return `/download/${encodeMediaPath(previewFile['path'])}`; } } function getEpubViewerURL(previewFile) { if (previewFile['primary_path']) { return `/epub/epub.html?url=download/${encodeMediaPath(previewFile['primary_path'])}`; } else { return `/epub/epub.html?url=download/${encodeMediaPath(previewFile['path'])}`; } } function getIframeModal(previewFile) { const url = getMediaPathURL(previewFile); return