@@ -4,13 +4,14 @@ import {DFlowFolderItemPathInput} from "./DFlowFolderItemPathInput";
44import { Flex } from "../flex/Flex" ;
55import { Button } from "../button/Button" ;
66import { DFlowFolderContextMenuGroupData , DFlowFolderContextMenuItemData } from "./DFlowFolderContextMenu" ;
7- import { DFlowFolderProps } from "./DFlowFolder" ;
87import { useForm } from "../form" ;
8+ import { Flow } from "@code0-tech/sagittarius-graphql-types" ;
99
10- export interface DFlowFolderRenameDialogProps extends DFlowFolderProps {
10+ export interface DFlowFolderRenameDialogProps {
1111 contextData : DFlowFolderContextMenuGroupData | DFlowFolderContextMenuItemData
1212 open ?: boolean
1313 onOpenChange ?: ( open : boolean ) => void
14+ onRename ?: ( flow : Flow , newName : string ) => void
1415}
1516
1617export const DFlowFolderRenameDialog : React . FC < DFlowFolderRenameDialogProps > = ( props ) => {
@@ -35,8 +36,8 @@ export const DFlowFolderRenameDialog: React.FC<DFlowFolderRenameDialogProps> = (
3536 onSubmit : ( values ) => {
3637 if ( props . contextData . type === "item" ) {
3738 props . onRename ?.( props . contextData . flow , values . path )
38- } else if ( props . contextData . type === "group " ) {
39- props . contextData . flows . forEach ( flow => {
39+ } else if ( props . contextData . type === "folder " ) {
40+ props . contextData . flow . forEach ( flow => {
4041 const newName = flow . name ?. replace ( props . contextData . name , values . path ) ?? flow . name
4142 props . onRename ?.( flow , newName ! )
4243 } )
@@ -46,7 +47,6 @@ export const DFlowFolderRenameDialog: React.FC<DFlowFolderRenameDialogProps> = (
4647
4748 return < Dialog open = { renameDialogOpen } onOpenChange = { ( open ) => {
4849 props . onOpenChange ?.( open )
49- setRenameDialogOpen ( open )
5050 } } >
5151 < DialogPortal >
5252 < DialogContent autoFocus showCloseButton
0 commit comments