diff --git a/app/src/components/Files.js b/app/src/components/Files.js index 2e6babc8..28183320 100644 --- a/app/src/components/Files.js +++ b/app/src/components/Files.js @@ -31,7 +31,7 @@ import { PageContainer, Paginator, textEllipsis, - useTitle + useTitle, CardLink } from "./Common"; import {useBrowseFiles, useQuery, useSearchFiles} from "../hooks/customHooks"; import {Route, Routes} from "react-router-dom"; @@ -326,13 +326,44 @@ function ImageRowCells({file}) { ) } +export function EbookRowCells({file}) { + const {ebook} = file; + + const downloadUrl = `/download/${encodeURIComponent(file.path)}`; + const viewerUrl = file['mimetype'].startsWith('application/epub') ? `/epub.html?url=${downloadUrl}` : null; + + let cover = ; + if (ebook && ebook.cover_path) { + const coverSrc = `/media/${encodeURIComponent(ebook.cover_path)}`; + cover = ; + } + + // Fragment for SelectableRow + return ( + +
{cover}
+
+ + + {textEllipsis(ebook.title || file.title)} + + +
) +} + function FileRow({file}) { + const isEbookType = file.mimetype && ( + file.mimetype.startsWith('application/epub') || file.mimetype.startsWith('application/x-mobipocket-ebook') + ); + if (file.model === 'video' && 'video' in file) { return ; } else if (file.model === 'archive' && 'archive' in file) { return ; } else if (file.mimetype && file.mimetype.startsWith('image/')) { return ; + } else if (isEbookType) { + return ; } const onDownloadFile = async () => window.open(`/media/${file.key}`);