@@ -17,8 +17,6 @@ import { useHydrateComponentReference } from "@/hooks/useHydrateComponentReferen
1717import type { ComponentReference } from "@/utils/componentSpec" ;
1818
1919import InfoIconButton from "../Buttons/InfoIconButton" ;
20- import TooltipButton from "../Buttons/TooltipButton" ;
21- import { ComponentEditorDialog } from "../ComponentEditor/ComponentEditorDialog" ;
2220import { ComponentFavoriteToggle } from "../FavoriteComponentToggle" ;
2321import { InfoBox } from "../InfoBox" ;
2422import { PublishComponent } from "../ManageComponent/PublishComponent" ;
@@ -32,9 +30,7 @@ interface ComponentDetailsProps {
3230 component : ComponentReference ;
3331 displayName : string ;
3432 trigger ?: ReactNode ;
35- actions ?: ReactNode [ ] ;
3633 onClose ?: ( ) => void ;
37- onDelete ?: ( ) => void ;
3834}
3935
4036const ComponentDetailsDialogContentSkeleton = ( ) => {
@@ -64,12 +60,7 @@ const ComponentDetailsDialogContentSkeleton = () => {
6460} ;
6561
6662const ComponentDetailsDialogContent = withSuspenseWrapper (
67- ( {
68- component,
69- displayName,
70- actions = [ ] ,
71- onDelete,
72- } : ComponentDetailsProps ) => {
63+ ( { component, displayName } : ComponentDetailsProps ) => {
7364 const remoteComponentLibrarySearchEnabled = useBetaFlagValue (
7465 "remote-component-library-search" ,
7566 ) ;
@@ -84,7 +75,7 @@ const ComponentDetailsDialogContent = withSuspenseWrapper(
8475 ) ;
8576 }
8677
87- const { url , spec : componentSpec , digest : componentDigest } = componentRef ;
78+ const componentSpec = componentRef . spec ;
8879
8980 const hasPublishSection =
9081 remoteComponentLibrarySearchEnabled && component . owned ;
@@ -133,14 +124,7 @@ const ComponentDetailsDialogContent = withSuspenseWrapper(
133124 < PublishedComponentDetails component = { componentRef } />
134125 ) : null }
135126
136- < TaskDetails
137- displayName = { displayName }
138- componentRef = { componentRef }
139- componentDigest = { componentDigest }
140- url = { url }
141- actions = { actions }
142- onDelete = { onDelete }
143- />
127+ < TaskDetails componentRef = { componentRef } />
144128 </ TabsContent >
145129
146130 < TabsContent value = "io" className = "h-full" >
@@ -175,18 +159,11 @@ const ComponentDetails = ({
175159 component,
176160 displayName,
177161 trigger,
178- actions = [ ] ,
179162 onClose,
180- onDelete,
181163} : ComponentDetailsProps ) => {
182- const hasEnabledInAppEditor = useBetaFlagValue ( "in-app-component-editor" ) ;
183-
184- const [ isEditDialogOpen , setIsEditDialogOpen ] = useState ( false ) ;
185164 const [ open , setOpen ] = useState ( false ) ;
186165 const dialogTriggerButton = trigger || < InfoIconButton /> ;
187166
188- const componentText = component . text ;
189-
190167 const dialogContextValue = useMemo (
191168 ( ) => ( {
192169 name : "ComponentDetails" ,
@@ -197,79 +174,42 @@ const ComponentDetails = ({
197174 [ ] ,
198175 ) ;
199176
200- const handleCloseEditDialog = useCallback ( ( ) => {
201- setIsEditDialogOpen ( false ) ;
202- } , [ ] ) ;
203-
204177 const onOpenChange = useCallback ( ( open : boolean ) => {
205178 setOpen ( open ) ;
206179 if ( ! open ) {
207180 onClose ?.( ) ;
208181 }
209182 } , [ ] ) ;
210183
211- const handleEditComponent = useCallback ( ( ) => {
212- setIsEditDialogOpen ( true ) ;
213- } , [ ] ) ;
214-
215- const actionsWithEdit = useMemo ( ( ) => {
216- if ( ! hasEnabledInAppEditor ) return actions ;
217-
218- const EditButton = (
219- < TooltipButton
220- variant = "secondary"
221- onClick = { handleEditComponent }
222- tooltip = "Edit Component Definition"
223- key = { `${ displayName } -edit-button` }
224- >
225- < Icon name = "FilePenLine" />
226- </ TooltipButton >
227- ) ;
228-
229- return [ ...actions , EditButton ] ;
230- } , [ actions , hasEnabledInAppEditor , handleEditComponent ] ) ;
231-
232184 return (
233- < >
234- < Dialog modal open = { open } onOpenChange = { onOpenChange } >
235- < DialogTrigger asChild > { dialogTriggerButton } </ DialogTrigger >
236-
237- < DialogDescription
238- className = "hidden"
239- aria-label = { `${ displayName } component details` }
240- >
241- { `${ displayName } component details` }
242- </ DialogDescription >
243- < DialogContent
244- className = "max-w-2xl min-w-2xl overflow-hidden"
245- aria-label = { `${ displayName } component details` }
246- >
247- < DialogHeader >
248- < DialogTitle className = "flex items-center gap-2 mr-5" >
249- < span > { displayName } </ span >
250- < ComponentFavoriteToggle component = { component } />
251- </ DialogTitle >
252- </ DialogHeader >
185+ < Dialog modal open = { open } onOpenChange = { onOpenChange } >
186+ < DialogTrigger asChild > { dialogTriggerButton } </ DialogTrigger >
253187
254- < DialogContext . Provider value = { dialogContextValue } >
255- < ComponentDetailsDialogContent
256- component = { component }
257- displayName = { displayName }
258- trigger = { dialogTriggerButton }
259- actions = { actionsWithEdit }
260- onClose = { onClose }
261- onDelete = { onDelete }
262- />
263- </ DialogContext . Provider >
264- </ DialogContent >
265- </ Dialog >
266- { isEditDialogOpen && (
267- < ComponentEditorDialog
268- text = { componentText }
269- onClose = { handleCloseEditDialog }
270- />
271- ) }
272- </ >
188+ < DialogDescription
189+ className = "hidden"
190+ aria-label = { `${ displayName } component details` }
191+ >
192+ { `${ displayName } component details` }
193+ </ DialogDescription >
194+ < DialogContent
195+ className = "max-w-2xl min-w-2xl overflow-hidden"
196+ aria-label = { `${ displayName } component details` }
197+ >
198+ < DialogHeader >
199+ < DialogTitle className = "flex items-center gap-2 mr-5" >
200+ < span > { displayName } </ span >
201+ < ComponentFavoriteToggle component = { component } />
202+ </ DialogTitle >
203+ </ DialogHeader >
204+
205+ < DialogContext . Provider value = { dialogContextValue } >
206+ < ComponentDetailsDialogContent
207+ component = { component }
208+ displayName = { displayName }
209+ />
210+ </ DialogContext . Provider >
211+ </ DialogContent >
212+ </ Dialog >
273213 ) ;
274214} ;
275215
0 commit comments