11import { useEffect , useRef } from "react" ;
22import type { CardWithDetails } from "@/types/types" ;
33import {
4- Sheet ,
5- SheetContent ,
6- SheetHeader ,
7- } from "@/components/ui/sheet " ;
4+ Dialog ,
5+ DialogContent ,
6+ DialogHeader ,
7+ } from "@/components/ui/dialog " ;
88import { Separator } from "@/components/ui/separator" ;
99import { Skeleton } from "@/components/ui/skeleton" ;
1010import { useCardDetails } from "@/hooks/useCardDetails" ;
@@ -105,28 +105,28 @@ export const CardDetailsPanel = ({
105105
106106 // Handler functions
107107 const handleUpdateTitle = ( title : string ) => {
108- if ( ! cardId ) return ;
109- updateDetails . mutate ( { id : cardId , title } ) ;
108+ if ( ! cardId || ! cardDetails ) return ;
109+ updateDetails . mutate ( { id : cardId , list_id : cardDetails . list_id , title } ) ;
110110 } ;
111111
112112 const handleUpdateDescription = ( description : string ) => {
113- if ( ! cardId ) return ;
114- updateDetails . mutate ( { id : cardId , description } ) ;
113+ if ( ! cardId || ! cardDetails ) return ;
114+ updateDetails . mutate ( { id : cardId , list_id : cardDetails . list_id , description } ) ;
115115 } ;
116116
117117 const handleUpdatePriority = ( priority : "low" | "medium" | "high" | "critical" | undefined ) => {
118- if ( ! cardId ) return ;
119- updateDetails . mutate ( { id : cardId , priority } ) ;
118+ if ( ! cardId || ! cardDetails ) return ;
119+ updateDetails . mutate ( { id : cardId , list_id : cardDetails . list_id , priority } ) ;
120120 } ;
121121
122122 const handleUpdateStatus = ( status : string ) => {
123- if ( ! cardId ) return ;
124- updateDetails . mutate ( { id : cardId , status } ) ;
123+ if ( ! cardId || ! cardDetails ) return ;
124+ updateDetails . mutate ( { id : cardId , list_id : cardDetails . list_id , status } ) ;
125125 } ;
126126
127127 const handleUpdateDueDate = ( due_date : string | undefined ) => {
128- if ( ! cardId ) return ;
129- updateDetails . mutate ( { id : cardId , due_date } ) ;
128+ if ( ! cardId || ! cardDetails ) return ;
129+ updateDetails . mutate ( { id : cardId , list_id : cardDetails . list_id , due_date } ) ;
130130 } ;
131131
132132 const handleDeleteCard = ( ) => {
@@ -142,8 +142,8 @@ export const CardDetailsPanel = ({
142142 } ;
143143
144144 return (
145- < Sheet open = { isOpen } onOpenChange = { onClose } >
146- < SheetContent size = "wide" className = "overflow-y-auto p-0" >
145+ < Dialog open = { isOpen } onOpenChange = { onClose } >
146+ < DialogContent className = "max-w-4xl max-h-[90vh] overflow-y-auto p-0" >
147147 { isLoading && (
148148 < div className = "p-6 space-y-4" >
149149 < Skeleton className = "h-8 w-3/4" />
@@ -153,9 +153,9 @@ export const CardDetailsPanel = ({
153153 ) }
154154
155155 { ! isLoading && cardDetails && (
156- < div className = "flex flex-col h-full " >
156+ < div className = "flex flex-col" >
157157 { /* Header */ }
158- < SheetHeader className = "p-6 pb-4" >
158+ < DialogHeader className = "p-6 pb-4" >
159159 < div className = "flex items-start justify-between pr-8" ref = { titleRef } >
160160 < EditableTitle
161161 value = { cardDetails . title }
@@ -171,10 +171,10 @@ export const CardDetailsPanel = ({
171171 < div className = "flex items-center gap-2 text-sm text-muted-foreground" >
172172 in list < span className = "font-medium" > List Name</ span >
173173 </ div >
174- </ SheetHeader >
174+ </ DialogHeader >
175175
176176 { /* Main Content */ }
177- < div className = "flex-1 px-6 pb-6 space-y-6" >
177+ < div className = "px-6 pb-6 space-y-6" >
178178 { /* Metadata Section */ }
179179 < div className = "flex flex-wrap gap-3" >
180180 < PrioritySelector
@@ -250,10 +250,10 @@ export const CardDetailsPanel = ({
250250 < p > Card not found</ p >
251251 </ div >
252252 ) }
253- </ SheetContent >
253+ </ DialogContent >
254254
255255 { /* Keyboard Shortcuts Dialog */ }
256256 < KeyboardShortcutsDialog open = { showDialog } onOpenChange = { setShowDialog } />
257- </ Sheet >
257+ </ Dialog >
258258 ) ;
259259} ;
0 commit comments