Using image next to a PDF with the same stem as the PDF's poster.
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Controller Tests / controller-tests (push) Has been cancelled
Jest Tests / jest-tests (push) Has been cancelled

This commit is contained in:
Roland 2025-12-22 16:55:15 -07:00
parent 8cffea6e1f
commit 3f4d5798e2
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 34 additions and 8 deletions

View file

@ -674,6 +674,10 @@ export function findPosterPath(file) {
// Ebook.
return file['data']['cover_path'];
}
if (file['data'] && file['data']['poster_path']) {
// PDF.
return file['data']['poster_path'];
}
if (video && video['poster_path']) {
// file is a video model.
return video['poster_path'];

View file

@ -144,22 +144,20 @@ function FileCard({file}) {
}
const author = file.author;
const downloadUrl = `/download/${encodeMediaPath(file.primary_path)}`;
const color = mimetypeColor(file.mimetype);
const size = file.size !== null && file.size !== undefined ? humanFileSize(file.size) : null;
const title = file.title || file.name || file.primary_path;
const header = <ExternalCardLink to={downloadUrl} className='card-title-ellipsis'>
{title}
</ExternalCardLink>;
const dt = file.published_datetime || file.published_modified_datetime || file.modified;
return <Card color={color}>
<CardPoster to={downloadUrl} file={file}/>
<CardPoster file={file}/>
<CardContent {...s}>
<CardHeader>
<Popup on='hover'
trigger={header}
content={title}/>
<PreviewLink file={file}>
<Popup on='hover'
trigger={<span className='card-title-ellipsis'>{title}</span>}
content={title}/>
</PreviewLink>
</CardHeader>
{author && <b {...s}>{author}</b>}
<p>{isoDatetimeToAgoPopup(dt, false)}</p>