Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
dataroom Home tab on sidebar
Ashish Viradiyabaf619954f4c
diff --git a/components/datarooms/folders/view-tree.tsx b/components/datarooms/folders/view-tree.tsxindex bfd7726d..393a413b 100644--- a/components/datarooms/folders/view-tree.tsx+++ b/components/datarooms/folders/view-tree.tsx@@ -2,7 +2,9 @@ import { useRouter } from "next/router";import { memo, useMemo } from "react";-import { DataroomDocument, DataroomFolder } from "@prisma/client";+import { DataroomFolder } from "@prisma/client";+import { HomeIcon } from "lucide-react";+import { cn } from "@/lib/utils";import { FileTree } from "@/components/ui/nextra-filetree";@@ -30,9 +32,13 @@ type DataroomFolderWithDocuments = DataroomFolder & {}[];};-type FolderPath = Set<string> | null+type FolderPath = Set<string> | null;-function findFolderPath(folder: DataroomFolderWithDocuments, folderId: string, currentPath: Set<string> = new Set<string>()):FolderPath {+function findFolderPath(+ folder: DataroomFolderWithDocuments,+ folderId: string,+ currentPath: Set<string> = new Set<string>(),+): FolderPath {if (folder.id === folderId) {return currentPath.add(folder.id);}@@ -52,7 +58,7 @@ const FolderComponent = memo(folder,folderId,setFolderId,- folderPath+ folderPath,}: {folder: DataroomFolderWithDocuments;folderId: string | null;@@ -90,9 +96,9 @@ const FolderComponent = memo();const isActive = folder.id === folderId;- const isChildActive = folderPath?.has(folder.id) || folder.childFolders.some(- (childFolder) => childFolder.id === folderId,- );+ const isChildActive =+ folderPath?.has(folder.id) ||+ folder.childFolders.some((childFolder) => childFolder.id === folderId);return (<div@@ -118,6 +124,42 @@ const FolderComponent = memo();FolderComponent.displayName = "FolderComponent";+const HomeLink = memo(+ ({+ folderId,+ setFolderId,+ }: {+ folderId: string | null;+ setFolderId: React.Dispatch<React.SetStateAction<string | null>>;+ }) => {+ return (+ <li+ className={cn(+ "flex list-none",+ "rounded-md text-foreground transition-all duration-200 ease-in-out",+ "hover:bg-gray-100 hover:shadow-sm hover:dark:bg-muted",+ "px-3 py-1.5 leading-6",+ folderId === null && "bg-gray-100 font-semibold dark:bg-muted",+ )}+ >+ <span+ className="inline-flex w-full cursor-pointer items-center"+ onClick={(e) => {+ e.preventDefault();+ setFolderId(null);+ }}+ >+ <HomeIcon className="h-5 w-5 shrink-0" aria-hidden="true" />+ <span className="ml-2 w-fit truncate" title="Home">+ Dataroom Home+ </span>+ </span>+ </li>+ );+ },+);+HomeLink.displayName = "HomeLink";+const SidebarFolders = ({folders,documents,@@ -149,10 +191,11 @@ const SidebarFolders = ({}return null;- }, [folders, documents, folderId])+ }, [folders, documents, folderId]);return (<FileTree>+ <HomeLink folderId={folderId} setFolderId={setFolderId} />{nestedFolders.map((folder) => (<FolderComponentkey={folder.id}