Skip to content

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

refactor: add <li> element where missing

Marc Seitz5ffc73a1a2c5
diff --git a/components/documents/documents-list.tsx b/components/documents/documents-list.tsx
index e87b637c..6dafca36 100644
--- a/components/documents/documents-list.tsx
+++ b/components/documents/documents-list.tsx
@@ -486,16 +486,18 @@ export function DocumentsList({
{folders && !foldersLoading
? folders.map((folder) => {
return (
- <FolderCard
- key={folder.id}
- folder={folder}
- teamInfo={teamInfo}
- isSelected={selectedFolders.includes(folder.id)}
- isDragging={
- isDragging && selectedFolders.includes(folder.id)
- }
- onDelete={handleDeleteFolder}
- />
+ <li key={folder.id}>
+ <FolderCard
+ key={folder.id}
+ folder={folder}
+ teamInfo={teamInfo}
+ isSelected={selectedFolders.includes(folder.id)}
+ isDragging={
+ isDragging && selectedFolders.includes(folder.id)
+ }
+ onDelete={handleDeleteFolder}
+ />
+ </li>
);
})
: Array.from({ length: 3 }).map((_, i) => (
@@ -521,14 +523,17 @@ export function DocumentsList({
{documents && !loading
? documents.map((document) => {
return (
- <DocumentCard
- key={document.id}
- document={document}
- teamInfo={teamInfo}
- isDragging={
- isDragging && selectedDocuments.includes(document.id)
- }
- />
+ <li key={document.id}>
+ <DocumentCard
+ key={document.id}
+ document={document}
+ teamInfo={teamInfo}
+ isDragging={
+ isDragging &&
+ selectedDocuments.includes(document.id)
+ }
+ />
+ </li>
);
})
: Array.from({ length: 3 }).map((_, i) => (
@@ -579,35 +584,39 @@ export function DocumentsList({
{folders && !foldersLoading
? folders.map((folder) => {
return (
- <DroppableFolder
- key={folder.id}
- id={folder.id}
- disabledFolder={selectedFolders}
- path={folder.path}
- >
- <DraggableItem
+ <li key={folder.id}>
+ <DroppableFolder
key={folder.id}
id={folder.id}
- isSelected={selectedFolders.includes(folder.id)}
- onSelect={(id, type) => {
- handleSelect(id, type);
- }}
- isDraggingSelected={isDragging}
- type="folder"
+ disabledFolder={selectedFolders}
+ path={folder.path}
>
- <FolderCard
+ <DraggableItem
key={folder.id}
- folder={folder}
- teamInfo={teamInfo}
+ id={folder.id}
isSelected={selectedFolders.includes(folder.id)}
- isDragging={
- isDragging &&
- selectedFolders.includes(folder.id)
- }
- onDelete={handleDeleteFolder}
- />
- </DraggableItem>
- </DroppableFolder>
+ onSelect={(id, type) => {
+ handleSelect(id, type);
+ }}
+ isDraggingSelected={isDragging}
+ type="folder"
+ >
+ <FolderCard
+ key={folder.id}
+ folder={folder}
+ teamInfo={teamInfo}
+ isSelected={selectedFolders.includes(
+ folder.id,
+ )}
+ isDragging={
+ isDragging &&
+ selectedFolders.includes(folder.id)
+ }
+ onDelete={handleDeleteFolder}
+ />
+ </DraggableItem>
+ </DroppableFolder>
+ </li>
);
})
: Array.from({ length: 3 }).map((_, i) => (
@@ -633,26 +642,30 @@ export function DocumentsList({
{documents && !loading
? documents.map((document) => {
return (
- <DraggableItem
- key={document.id}
- id={document.id}
- isSelected={selectedDocuments.includes(document.id)}
- isDraggingSelected={isDragging}
- type="document"
- onSelect={(id, type) => {
- handleSelect(id, type);
- }}
- >
- <DocumentCard
+ <li key={document.id}>
+ <DraggableItem
key={document.id}
- document={document}
- teamInfo={teamInfo}
- isDragging={
- isDragging &&
- selectedDocuments.includes(document.id)
- }
- />
- </DraggableItem>
+ id={document.id}
+ isSelected={selectedDocuments.includes(
+ document.id,
+ )}
+ isDraggingSelected={isDragging}
+ type="document"
+ onSelect={(id, type) => {
+ handleSelect(id, type);
+ }}
+ >
+ <DocumentCard
+ key={document.id}
+ document={document}
+ teamInfo={teamInfo}
+ isDragging={
+ isDragging &&
+ selectedDocuments.includes(document.id)
+ }
+ />
+ </DraggableItem>
+ </li>
);
})
: Array.from({ length: 3 }).map((_, i) => (
diff --git a/components/documents/drag-and-drop/draggable-item.tsx b/components/documents/drag-and-drop/draggable-item.tsx
index f2e0dc1e..29e28903 100644
--- a/components/documents/drag-and-drop/draggable-item.tsx
+++ b/components/documents/drag-and-drop/draggable-item.tsx
@@ -2,10 +2,10 @@ import React, { useCallback, useState } from "react";
import { useDraggable } from "@dnd-kit/core";
-import { Checkbox } from "@/components/ui/checkbox";
-
import { cn } from "@/lib/utils";
+import { Checkbox } from "@/components/ui/checkbox";
+
interface DraggableItemProps {
id: string;
isSelected: boolean;
@@ -61,7 +61,7 @@ export function DraggableItem({
});
return (
- <li
+ <div
ref={setNodeRef}
style={style}
{...attributes}
@@ -88,6 +88,6 @@ export function DraggableItem({
/>
</div>
{childWithProps}
- </li>
+ </div>
);
}
diff --git a/components/view/dataroom/document-card.tsx b/components/view/dataroom/document-card.tsx
index 96bb417d..35b757f3 100644
--- a/components/view/dataroom/document-card.tsx
+++ b/components/view/dataroom/document-card.tsx
@@ -166,77 +166,75 @@ export default function DocumentCard({
};
return (
- <>
- <li
- className={cn(
- "group/row relative flex items-center justify-between rounded-lg border-0 p-3 ring-1 ring-gray-200 transition-all hover:bg-secondary hover:ring-gray-300 dark:bg-secondary dark:ring-gray-700 hover:dark:ring-gray-500 sm:p-4",
- isProcessing && "cursor-not-allowed opacity-60",
- )}
- >
- <div className="z-0 flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
- <div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
- {fileIcon({
- fileType: document.versions[0].type ?? "",
- className: "h-8 w-8",
- isLight,
- })}
- </div>
+ <div
+ className={cn(
+ "group/row relative flex items-center justify-between rounded-lg border-0 p-3 ring-1 ring-gray-200 transition-all hover:bg-secondary hover:ring-gray-300 dark:bg-secondary dark:ring-gray-700 hover:dark:ring-gray-500 sm:p-4",
+ isProcessing && "cursor-not-allowed opacity-60",
+ )}
+ >
+ <div className="z-0 flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
+ <div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
+ {fileIcon({
+ fileType: document.versions[0].type ?? "",
+ className: "h-8 w-8",
+ isLight,
+ })}
+ </div>
- <div className="flex-col">
- <div className="flex items-center">
- <h2 className="min-w-0 max-w-[300px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-lg">
- <button
- onClick={handleDocumentClick}
- className="w-full truncate"
- disabled={isProcessing}
- >
- <span>{document.name}</span>
- {isProcessing && (
- <span className="ml-2 text-xs text-muted-foreground">
- (Processing...)
- </span>
- )}
- <span className="absolute inset-0" />
- </button>
- </h2>
- </div>
- <div className="mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground">
- <p className="truncate">
- Updated {timeAgo(document.versions[0].updatedAt)}
- </p>
- </div>
+ <div className="flex-col">
+ <div className="flex items-center">
+ <h2 className="min-w-0 max-w-[300px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-lg">
+ <button
+ onClick={handleDocumentClick}
+ className="w-full truncate"
+ disabled={isProcessing}
+ >
+ <span>{document.name}</span>
+ {isProcessing && (
+ <span className="ml-2 text-xs text-muted-foreground">
+ (Processing...)
+ </span>
+ )}
+ <span className="absolute inset-0" />
+ </button>
+ </h2>
</div>
- </div>
- {canDownload && !isProcessing && (
- <div className="z-10">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="ghost"
- size="icon"
- className="h-8 w-8 p-0 text-gray-500 ring-1 ring-gray-100 hover:bg-gray-200 group-hover/row:text-foreground group-hover/row:ring-gray-300"
- aria-label="Open menu"
- >
- <MoreVerticalIcon className="h-4 w-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuLabel>Actions</DropdownMenuLabel>
- <DropdownMenuItem
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- downloadDocument();
- }}
- >
- <Download className="h-4 w-4" />
- Download
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <div className="mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground">
+ <p className="truncate">
+ Updated {timeAgo(document.versions[0].updatedAt)}
+ </p>
</div>
- )}
- </li>
- </>
+ </div>
+ </div>
+ {canDownload && !isProcessing && (
+ <div className="z-10">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8 p-0 text-gray-500 ring-1 ring-gray-100 hover:bg-gray-200 group-hover/row:text-foreground group-hover/row:ring-gray-300"
+ aria-label="Open menu"
+ >
+ <MoreVerticalIcon className="h-4 w-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuLabel>Actions</DropdownMenuLabel>
+ <DropdownMenuItem
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ downloadDocument();
+ }}
+ >
+ <Download className="h-4 w-4" />
+ Download
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )}
+ </div>
);
}
diff --git a/components/view/dataroom/folder-card.tsx b/components/view/dataroom/folder-card.tsx
index 3bb01379..1bbae480 100644
--- a/components/view/dataroom/folder-card.tsx
+++ b/components/view/dataroom/folder-card.tsx
@@ -87,7 +87,7 @@ export default function FolderCard({
};
return (
- <li className="group/row relative flex items-center justify-between rounded-lg border-0 p-3 ring-1 ring-gray-400 transition-all hover:bg-secondary hover:ring-gray-500 dark:bg-secondary dark:ring-gray-500 hover:dark:ring-gray-400 sm:p-4">
+ <div className="group/row relative flex items-center justify-between rounded-lg border-0 p-3 ring-1 ring-gray-400 transition-all hover:bg-secondary hover:ring-gray-500 dark:bg-secondary dark:ring-gray-500 hover:dark:ring-gray-400 sm:p-4">
<div className="flex min-w-0 shrink items-center space-x-2 sm:space-x-4">
<div className="mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1">
<FolderIcon className="h-8 w-8" strokeWidth={1} />
@@ -141,6 +141,6 @@ export default function FolderCard({
</DropdownMenu>
</div>
) : null}
- </li>
+ </div>
);
}
diff --git a/pages/room_ppreview_demo.tsx b/pages/room_ppreview_demo.tsx
index af5957ca..6274a6bc 100644
--- a/pages/room_ppreview_demo.tsx
+++ b/pages/room_ppreview_demo.tsx
@@ -114,64 +114,70 @@ export default function ViewPage() {
<div className="space-y-4">
<div className="text-sm text-muted-foreground">Home</div>
<ul className="grid gap-4">
- <FolderCard
- folder={{
- id: "1",
- name: "Marketing",
- parentId: null,
- dataroomId: "1",
- orderIndex: 0,
- path: "/",
- createdAt: new Date(),
- updatedAt: new Date(),
- }}
- dataroomId="1"
- setFolderId={() => {}}
- isPreview={false}
- linkId="1"
- allowDownload={false}
- />
+ <li key="1">
+ <FolderCard
+ folder={{
+ id: "1",
+ name: "Marketing",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 0,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ }}
+ dataroomId="1"
+ setFolderId={() => {}}
+ isPreview={false}
+ linkId="1"
+ allowDownload={false}
+ />
+ </li>
- <FolderCard
- folder={{
- id: "2",
- name: "Sales",
- parentId: null,
- dataroomId: "1",
- orderIndex: 1,
- path: "/",
- createdAt: new Date(),
- updatedAt: new Date(),
- }}
- dataroomId="1"
- setFolderId={() => {}}
- isPreview={false}
- linkId="1"
- allowDownload={false}
- />
+ <li key="2">
+ <FolderCard
+ folder={{
+ id: "2",
+ name: "Sales",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 1,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ }}
+ dataroomId="1"
+ setFolderId={() => {}}
+ isPreview={false}
+ linkId="1"
+ allowDownload={false}
+ />
+ </li>
- <DocumentCard
- document={{
- id: "1",
- name: "Q4 Report.pdf",
- dataroomDocumentId: "1",
- downloadOnly: false,
- canDownload: false,
- versions: [
- {
- id: "1",
- type: "pdf",
- versionNumber: 1,
- hasPages: true,
- isVertical: true,
- updatedAt: new Date(),
- },
- ],
- }}
- linkId="1"
- isPreview={false}
- allowDownload={false}
- />
+ <li key="3">
+ <DocumentCard
+ document={{
+ id: "1",
+ name: "Q4 Report.pdf",
+ dataroomDocumentId: "1",
+ downloadOnly: false,
+ canDownload: false,
+ versions: [
+ {
+ id: "1",
+ type: "pdf",
+ versionNumber: 1,
+ hasPages: true,
+ isVertical: true,
+ updatedAt: new Date(),
+ },
+ ],
+ }}
+ linkId="1"
+ isPreview={false}
+ allowDownload={false}
+ />
+ </li>
</ul>
</div>
</div>