@@ -10,10 +10,7 @@ import { useTheme } from "next-themes";
1010import { toast } from "sonner" ;
1111import { mutate } from "swr" ;
1212
13- import { MoveToFolderModal } from "@/components/documents/move-folder-modal" ;
1413import BarChart from "@/components/shared/icons/bar-chart" ;
15- import Check from "@/components/shared/icons/check" ;
16- import Copy from "@/components/shared/icons/copy" ;
1714import NotionIcon from "@/components/shared/icons/notion" ;
1815import { Button } from "@/components/ui/button" ;
1916import {
@@ -27,20 +24,21 @@ import {
2724
2825import { type DataroomFolderDocument } from "@/lib/swr/use-dataroom" ;
2926import { type DocumentWithLinksAndLinkCountAndViewCount } from "@/lib/types" ;
30- import { nFormatter , timeAgo } from "@/lib/utils" ;
31- import { useCopyToClipboard } from "@/lib/utils/use-copy-to-clipboard" ;
27+ import { cn , nFormatter , timeAgo } from "@/lib/utils" ;
3228
3329import { MoveToDataroomFolderModal } from "./move-dataroom-folder-modal" ;
3430
3531type DocumentsCardProps = {
3632 document : DataroomFolderDocument ;
3733 teamInfo : TeamContextType | null ;
3834 dataroomId : string ;
35+ isDragging ?: boolean ;
3936} ;
4037export default function DataroomDocumentCard ( {
4138 document : dataroomDocument ,
4239 teamInfo,
4340 dataroomId,
41+ isDragging,
4442} : DocumentsCardProps ) {
4543 const { theme, systemTheme } = useTheme ( ) ;
4644 const isLight =
@@ -147,9 +145,24 @@ export default function DataroomDocumentCard({
147145 }
148146 } ;
149147
148+ const handleCardClick = ( e : React . MouseEvent ) => {
149+ if ( isDragging ) {
150+ e . preventDefault ( ) ;
151+ e . stopPropagation ( ) ;
152+ return ;
153+ }
154+ router . push ( `/documents/${ dataroomDocument . document . id } ` ) ;
155+ } ;
156+
150157 return (
151158 < >
152- < li className = "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" >
159+ < div
160+ onClick = { handleCardClick }
161+ className = { cn (
162+ "group/row relative flex items-center justify-between rounded-lg border-0 bg-white 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" ,
163+ isDragging ? "cursor-grabbing" : "cursor-pointer" ,
164+ ) }
165+ >
153166 < div className = "flex min-w-0 shrink items-center space-x-2 sm:space-x-4" >
154167 < div className = "mx-0.5 flex w-8 items-center justify-center text-center sm:mx-1" >
155168 { dataroomDocument . document . type === "notion" ? (
@@ -167,13 +180,7 @@ export default function DataroomDocumentCard({
167180 < div className = "flex-col" >
168181 < div className = "flex items-center" >
169182 < h2 className = "min-w-0 max-w-[150px] truncate text-sm font-semibold leading-6 text-foreground sm:max-w-md" >
170- < Link
171- href = { `/documents/${ dataroomDocument . document . id } ` }
172- className = "w-full truncate"
173- >
174- < span > { dataroomDocument . document . name } </ span >
175- < span className = "absolute inset-0" />
176- </ Link >
183+ { dataroomDocument . document . name }
177184 </ h2 >
178185 </ div >
179186 < div className = "mt-1 flex items-center space-x-1 text-xs leading-5 text-muted-foreground" >
@@ -216,7 +223,12 @@ export default function DataroomDocumentCard({
216223 </ DropdownMenuTrigger >
217224 < DropdownMenuContent align = "end" ref = { dropdownRef } >
218225 < DropdownMenuLabel > Actions</ DropdownMenuLabel >
219- < DropdownMenuItem onClick = { ( ) => setMoveFolderOpen ( true ) } >
226+ < DropdownMenuItem
227+ onClick = { ( e ) => {
228+ e . stopPropagation ( ) ;
229+ setMoveFolderOpen ( true ) ;
230+ } }
231+ >
220232 < FolderInputIcon className = "mr-2 h-4 w-4" />
221233 Move to folder
222234 </ DropdownMenuItem >
@@ -239,7 +251,7 @@ export default function DataroomDocumentCard({
239251 </ DropdownMenuContent >
240252 </ DropdownMenu >
241253 </ div >
242- </ li >
254+ </ div >
243255 { moveFolderOpen ? (
244256 < MoveToDataroomFolderModal
245257 open = { moveFolderOpen }
0 commit comments