Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

Show dataroom folder for each document

Ashish Viradiya0c6b1957d215
diff --git a/components/documents/document-header.tsx b/components/documents/document-header.tsx
index e6da0d65..8df3e168 100644
--- a/components/documents/document-header.tsx
+++ b/components/documents/document-header.tsx
@@ -13,6 +13,7 @@ import {
CloudDownloadIcon,
DownloadIcon,
FileDownIcon,
+ FolderIcon,
MoonIcon,
ServerIcon,
SheetIcon,
@@ -864,6 +865,29 @@ export default function DocumentHeader({
>
{item.dataroom.name}
</Link>
+ {item.folder ? (
+ <Link
+ href={`/datarooms/${item.dataroom.id}/documents/${item.folder.path}`}
+ className="flex flex-row items-center space-x-2 hover:underline"
+ title={`Folder: ${item.folder.name}`}
+ >
+ <ArrowRightIcon className="h-3.5 w-3.5" />
+ <FolderIcon className="mr-1 h-4 w-4" />
+ <span className="ml-1 truncate">
+ {item.folder.name}
+ </span>
+ </Link>
+ ) : (
+ <Link
+ href={`/datarooms/${item.dataroom.id}/documents`}
+ className="flex flex-row items-center space-x-2 hover:underline"
+ title="Home"
+ >
+ <ArrowRightIcon className="h-3.5 w-3.5" />
+ <FolderIcon className="mr-1 h-4 w-4" />
+ <span className="ml-1 truncate">Home</span>
+ </Link>
+ )}
</li>
))}
</ul>
diff --git a/lib/types.ts b/lib/types.ts
index 0316e4f9..a09da83b 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -50,6 +50,11 @@ export interface DocumentWithVersion extends Document {
id: string;
name: string;
};
+ folder: {
+ id: string;
+ name: string;
+ path: string;
+ };
}[];
hasPageLinks: boolean;
}
diff --git a/pages/api/teams/[teamId]/documents/[id]/index.ts b/pages/api/teams/[teamId]/documents/[id]/index.ts
index c926b0e4..b863d790 100644
--- a/pages/api/teams/[teamId]/documents/[id]/index.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/index.ts
@@ -52,6 +52,13 @@ export default async function handle(
name: true,
},
},
+ folder: {
+ select: {
+ id: true,
+ name: true,
+ path: true,
+ },
+ },
},
},
},