Refactoring docs to match new url scheme like videos and archives.

This commit is contained in:
Roland 2026-03-20 15:53:21 -06:00
parent 66a891c759
commit 1c79c1c495
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 28 additions and 49 deletions

View file

@ -187,7 +187,7 @@ function DocPage() {
const handleDelete = async () => {
if (doc && doc.id) {
await deleteDocs([doc.id]);
await deleteDocs([docFile.id]);
toast({
type: 'success',
title: 'Document Deleted',
@ -512,7 +512,7 @@ export function DocsRoute() {
text: 'Docs',
to: '/docs',
end: true,
isActive: () => path === '/docs' || /^\/docs\/view\/\d+$/.test(path)
isActive: () => path === '/docs' || /^\/docs\/\d+$/.test(path)
},
{text: 'Subjects', to: '/docs/subjects', isActive: () => path.startsWith('/docs/subjects')},
{text: 'Authors', to: '/docs/authors', isActive: () => path.startsWith('/docs/authors')},
@ -523,7 +523,7 @@ export function DocsRoute() {
<TabLinks links={links}/>
<Routes>
<Route path='/' element={<DocsPage/>}/>
<Route path='view/:fileGroupId' element={<DocPage/>}/>
<Route path=':fileGroupId' element={<DocPage/>}/>
<Route path='subjects' element={<SubjectsPage/>}/>
<Route path='authors' element={<AuthorsPage/>}/>
<Route path='statistics' element={<DocsStatisticsPage/>}/>

View file

@ -75,7 +75,7 @@ function EbookCard({file, sortField}) {
const viewerUrl = isEpub ? `/epub/epub.html?url=${downloadUrl}` : null;
// Link to doc detail page if this is a modeled doc.
const detailUrl = file.model === 'doc' ? `/docs/view/${file.id}` : null;
const detailUrl = file.model === 'doc' ? `/docs/${file.id}` : null;
const color = mimetypeColor(file.mimetype, file.primary_path);
const title = file.title || file.stem || file.name;