From 5d505627686ea7fcd8a273b175144783d760a2b4 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 24 Dec 2025 12:30:04 -0700 Subject: [PATCH] Reworking Cards in the App so that they use the new FileGroup.files and .data. --- app/src/components/Archive.js | 36 +++++++++++++++++++---------- app/src/components/Common.js | 42 ++++++++++++++++++++++++++-------- modules/videos/models.py | 3 ++- wrolpi/files/pdfs.py | 3 ++- wrolpi/files/test/test_pdfs.py | 4 ++-- 5 files changed, 62 insertions(+), 26 deletions(-) diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js index 6386a6cd..e8de0e7e 100644 --- a/app/src/components/Archive.js +++ b/app/src/components/Archive.js @@ -34,6 +34,7 @@ import { mimetypeColor, PageContainer, PreviewPath, + resolveDataPath, SearchInput, SortButton, TabLinks, @@ -104,11 +105,16 @@ function ArchivePage() { } - const {data, size} = archiveFile; + const {data, size, directory} = archiveFile; - const singlefileUrl = data.singlefile_path ? `/media/${encodeMediaPath(data.singlefile_path)}` : null; - const readabilityUrl = data.readability_path ? `/media/${encodeMediaPath(data.readability_path)}` : null; - const screenshotUrl = data.screenshot_path ? `/media/${encodeMediaPath(data.screenshot_path)}` : null; + // Resolve data paths (filename-only) to full relative paths using directory + const singlefilePath = resolveDataPath(data.singlefile_path, directory); + const readabilityPath = resolveDataPath(data.readability_path, directory); + const screenshotPath = resolveDataPath(data.screenshot_path, directory); + + const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null; + const readabilityUrl = readabilityPath ? `/media/${encodeMediaPath(readabilityPath)}` : null; + const screenshotUrl = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null; const singlefileButton =