@@ -6,7 +6,7 @@ import { Textarea } from "@/components/ui/textarea";
66import { Label } from "@/components/ui/label" ;
77import { Switch } from "@/components/ui/switch" ;
88import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select" ;
9- import { Sheet , SheetContent , SheetHeader , SheetTitle , SheetDescription , SheetFooter } from "@/components/ui/sheet " ;
9+ import { Dialog , DialogContent , DialogHeader , DialogTitle , DialogDescription , DialogFooter } from "@/components/ui/dialog " ;
1010import { ScrollArea } from "@/components/ui/scroll-area" ;
1111import { Badge } from "@/components/ui/badge" ;
1212import { Save , Loader2 , AlertCircle } from "lucide-react" ;
@@ -30,9 +30,10 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
3030 async function loadDef ( ) {
3131 if ( ! client ) return ;
3232 try {
33- const found = await client . meta . getItem ( 'object' , objectApiName ) ;
33+ const found : any = await client . meta . getItem ( 'object' , objectApiName ) ;
3434 if ( mounted && found ) {
35- setDef ( found ) ;
35+ const resolved = found . data || found ;
36+ setDef ( resolved ) ;
3637 if ( record ) {
3738 setFormData ( { ...record } ) ;
3839 } else {
@@ -98,25 +99,25 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
9899 const isEdit = ! ! ( record && ( record . id || record . _id ) ) ;
99100
100101 return (
101- < Sheet open = { true } onOpenChange = { ( open ) => ! open && onCancel ( ) } >
102- < SheetContent className = "w-full sm:max-w-lg flex flex-col p-0 gap-0" >
103- < SheetHeader className = "px-6 py -4 border-b" >
102+ < Dialog open = { true } onOpenChange = { ( open ) => ! open && onCancel ( ) } >
103+ < DialogContent className = "sm:max-w-lg max-h-[85vh] flex flex-col p-0 gap-0" >
104+ < DialogHeader className = "px-6 pt-6 pb -4 border-b" >
104105 < div className = "flex items-center gap-2" >
105- < SheetTitle className = "text-lg" >
106+ < DialogTitle className = "text-lg" >
106107 { isEdit ? 'Edit' : 'New' } { def . label }
107- </ SheetTitle >
108+ </ DialogTitle >
108109 < Badge variant = { isEdit ? "secondary" : "default" } className = "text-xs" >
109110 { isEdit ? 'Editing' : 'Creating' }
110111 </ Badge >
111112 </ div >
112- < SheetDescription >
113- { isEdit
114- ? `Update the fields below to modify this ${ def . label . toLowerCase ( ) } .`
113+ < DialogDescription >
114+ { isEdit
115+ ? `Update the fields below to modify this ${ def . label . toLowerCase ( ) } .`
115116 : `Fill in the fields below to create a new ${ def . label . toLowerCase ( ) } .`
116117 }
117- </ SheetDescription >
118- </ SheetHeader >
119-
118+ </ DialogDescription >
119+ </ DialogHeader >
120+
120121 < form onSubmit = { handleSubmit } className = "flex-1 flex flex-col overflow-hidden" >
121122 < ScrollArea className = "flex-1" >
122123 < div className = "p-6 space-y-5" >
@@ -126,7 +127,7 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
126127 { error }
127128 </ div >
128129 ) }
129-
130+
130131 { fieldKeys . map ( key => {
131132 const field = fields [ key ] ;
132133 const label = field . label || key ;
@@ -145,7 +146,7 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
145146 { field . type }
146147 </ Badge >
147148 </ div >
148-
149+
149150 { field . type === 'boolean' ? (
150151 < div className = "flex items-center gap-3 rounded-lg border p-3" >
151152 < Switch
@@ -202,7 +203,7 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
202203 </ div >
203204 </ ScrollArea >
204205
205- < SheetFooter className = "px-6 py-4 border-t bg-muted/30 flex items-center gap-2 sm:justify-end " >
206+ < DialogFooter className = "px-6 py-4 border-t bg-muted/30" >
206207 < Button variant = "outline" onClick = { onCancel } type = "button" className = "gap-1.5" >
207208 Cancel
208209 </ Button >
@@ -217,9 +218,9 @@ export function ObjectDataForm({ client, objectApiName, record, onSuccess, onCan
217218 </ >
218219 ) }
219220 </ Button >
220- </ SheetFooter >
221+ </ DialogFooter >
221222 </ form >
222- </ SheetContent >
223- </ Sheet >
223+ </ DialogContent >
224+ </ Dialog >
224225 ) ;
225226}
0 commit comments