Skip to content

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

fix: scroll on documents

Marc Seitz03c6e1fb2170
diff --git a/components/documents/documents-list.tsx b/components/documents/documents-list.tsx
index b8c85625..89d493a2 100644
--- a/components/documents/documents-list.tsx
+++ b/components/documents/documents-list.tsx
@@ -2,7 +2,6 @@ import { useState } from "react";
import { TeamContextType } from "@/context/team-context";
-import { ScrollArea } from "@/components/ui/scroll-area";
import { Skeleton } from "@/components/ui/skeleton";
import { UploadNotificationDrawer } from "@/components/upload-notification";
import UploadZone from "@/components/upload-zone";
@@ -67,93 +66,88 @@ export function DocumentsList({
setRejectedFiles={setRejectedFiles}
dataroomId={dataroomId}
>
- <ScrollArea
- className="-m-2 h-[calc(100dvh-205px)] *:p-2"
- showScrollbar={true}
- >
- <div className="space-y-4">
- {/* Folders list */}
- <ul role="list" className="space-y-4">
- {folders
- ? folders.map((folder) => {
+ <div className="space-y-4">
+ {/* Folders list */}
+ <ul role="list" className="space-y-4">
+ {folders
+ ? folders.map((folder) => {
+ return (
+ <FolderCard
+ key={folder.id}
+ folder={folder}
+ teamInfo={teamInfo}
+ isDataroom={dataroomId ? true : false}
+ dataroomId={dataroomId}
+ />
+ );
+ })
+ : Array.from({ length: 3 }).map((_, i) => (
+ <li
+ key={i}
+ className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6"
+ >
+ <Skeleton key={i} className="h-9 w-9" />
+ <div>
+ <Skeleton key={i} className="h-4 w-32" />
+ <Skeleton key={i + 1} className="mt-2 h-3 w-12" />
+ </div>
+ <Skeleton
+ key={i + 1}
+ className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"
+ />
+ </li>
+ ))}
+ </ul>
+
+ {/* Documents list */}
+ <ul role="list" className="space-y-4">
+ {documents
+ ? documents.map((document) => {
+ if (dataroomId) {
return (
- <FolderCard
- key={folder.id}
- folder={folder}
+ <DataroomDocumentCard
+ key={document.id}
+ document={document as DataroomFolderDocument}
teamInfo={teamInfo}
- isDataroom={dataroomId ? true : false}
dataroomId={dataroomId}
/>
);
- })
- : Array.from({ length: 3 }).map((_, i) => (
- <li
- key={i}
- className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6"
- >
- <Skeleton key={i} className="h-9 w-9" />
- <div>
- <Skeleton key={i} className="h-4 w-32" />
- <Skeleton key={i + 1} className="mt-2 h-3 w-12" />
- </div>
- <Skeleton
- key={i + 1}
- className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"
- />
- </li>
- ))}
- </ul>
-
- {/* Documents list */}
- <ul role="list" className="space-y-4">
- {documents
- ? documents.map((document) => {
- if (dataroomId) {
- return (
- <DataroomDocumentCard
- key={document.id}
- document={document as DataroomFolderDocument}
- teamInfo={teamInfo}
- dataroomId={dataroomId}
- />
- );
- } else {
- return (
- <DocumentCard
- key={document.id}
- document={
- document as DocumentWithLinksAndLinkCountAndViewCount
- }
- teamInfo={teamInfo}
- />
- );
- }
- })
- : Array.from({ length: 3 }).map((_, i) => (
- <li
- key={i}
- className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6"
- >
- <Skeleton key={i} className="h-9 w-9" />
- <div>
- <Skeleton key={i} className="h-4 w-32" />
- <Skeleton key={i + 1} className="mt-2 h-3 w-12" />
- </div>
- <Skeleton
- key={i + 1}
- className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"
+ } else {
+ return (
+ <DocumentCard
+ key={document.id}
+ document={
+ document as DocumentWithLinksAndLinkCountAndViewCount
+ }
+ teamInfo={teamInfo}
/>
- </li>
- ))}
- </ul>
+ );
+ }
+ })
+ : Array.from({ length: 3 }).map((_, i) => (
+ <li
+ key={i}
+ className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6"
+ >
+ <Skeleton key={i} className="h-9 w-9" />
+ <div>
+ <Skeleton key={i} className="h-4 w-32" />
+ <Skeleton key={i + 1} className="mt-2 h-3 w-12" />
+ </div>
+ <Skeleton
+ key={i + 1}
+ className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"
+ />
+ </li>
+ ))}
+ </ul>
- {documents && documents.length === 0 && (
- <div className="flex items-center justify-center">
- <EmptyDocuments />
- </div>
- )}
- </div>
- </ScrollArea>
+ {documents && documents.length === 0 && (
+ <div className="flex items-center justify-center">
+ <EmptyDocuments />
+ </div>
+ )}
+ </div>
</UploadZone>
{showDrawer ? (
<UploadNotificationDrawer
diff --git a/components/layouts/app.tsx b/components/layouts/app.tsx
index 7c42c70a..3d65cf6e 100644
--- a/components/layouts/app.tsx
+++ b/components/layouts/app.tsx
@@ -1,5 +1,4 @@
import Sidebar from "../Sidebar";
-import { ScrollArea } from "../ui/scroll-area";
export default function AppLayout({ children }: { children: React.ReactNode }) {
return (
diff --git a/pages/datarooms/[id]/documents/[...name].tsx b/pages/datarooms/[id]/documents/[...name].tsx
index 99aa7822..4a5e1653 100644
--- a/pages/datarooms/[id]/documents/[...name].tsx
+++ b/pages/datarooms/[id]/documents/[...name].tsx
@@ -101,7 +101,7 @@ export default function Documents() {
/>
</header>
- <div className="grid h-full gap-4 md:grid-cols-4">
+ <div className="grid h-full gap-4 pb-2 md:grid-cols-4">
<div className="h-full truncate md:col-span-1">
<ScrollArea showScrollbar>
<SidebarFolderTree dataroomId={dataroom?.id!} />
diff --git a/pages/datarooms/[id]/documents/index.tsx b/pages/datarooms/[id]/documents/index.tsx
index 09ceae9a..899b3178 100644
--- a/pages/datarooms/[id]/documents/index.tsx
+++ b/pages/datarooms/[id]/documents/index.tsx
@@ -10,6 +10,7 @@ import { AddFolderModal } from "@/components/folders/add-folder-modal";
import AppLayout from "@/components/layouts/app";
import { NavMenu } from "@/components/navigation-menu";
import { Button } from "@/components/ui/button";
+import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import {
useDataroom,
@@ -94,9 +95,12 @@ export default function Documents() {
/>
</header>
- <div className="grid gap-2 md:grid-cols-4">
- <div className="truncate md:col-span-1">
- <SidebarFolderTree dataroomId={dataroom?.id!} />
+ <div className="grid h-full gap-4 pb-2 md:grid-cols-4">
+ <div className="h-full truncate md:col-span-1">
+ <ScrollArea showScrollbar>
+ <SidebarFolderTree dataroomId={dataroom?.id!} />
+ <ScrollBar orientation="horizontal" />
+ </ScrollArea>
</div>
<div className="space-y-4 md:col-span-3">
<BreadcrumbComponent />
diff --git a/pages/documents/index.tsx b/pages/documents/index.tsx
index 17399700..530281e9 100644
--- a/pages/documents/index.tsx
+++ b/pages/documents/index.tsx
@@ -17,7 +17,7 @@ export default function Documents() {
return (
<AppLayout>
- <main className="p-4 sm:mx-4 sm:mt-4">
+ <div className="sticky top-0 z-50 bg-white p-4 pb-0 sm:mx-4 sm:pt-8">
<section className="mb-4 flex items-center justify-between md:mb-8 lg:mb-12">
<div className="space-y-1">
<h2 className="text-xl font-semibold tracking-tight text-foreground sm:text-2xl">
@@ -27,18 +27,6 @@ export default function Documents() {
Manage all your documents in one place.
</p>
</div>
- {/* <div className="flex items-center justify-between gap-4"> */}
- {/* <AddDocumentModal>
- <Button
- size="icon"
- className="fixed bottom-6 right-5 z-30 lg:hidden sm:bottom-0 sm:right-0 sm:relative w-10 sm:w-44 h-10 sm:h-10"
- >
- <span className="hidden sm:block">Add New Document</span>
- <span className="block sm:hidden">
- <PlusIcon className="w-6 h-6" />
- </span>
- </Button>
- </AddDocumentModal> */}
<div className="flex items-center gap-x-1">
<AddDocumentModal>
<Button
@@ -81,13 +69,15 @@ export default function Documents() {
</section>
<Separator className="mb-5 bg-gray-200 dark:bg-gray-800" />
+ </div>
+ <div className="p-4 pt-0 sm:mx-4 sm:mt-4">
<DocumentsList
documents={documents}
folders={folders}
teamInfo={teamInfo}
/>
- </main>
+ </div>
</AppLayout>
);
}