diff --git a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Contract-Functional-Group-on-a-structure-1-chromium-linux.png b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Contract-Functional-Group-on-a-structure-1-chromium-linux.png index 30e1ac77f8..b44fdff3ba 100644 Binary files a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Contract-Functional-Group-on-a-structure-1-chromium-linux.png and b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Contract-Functional-Group-on-a-structure-1-chromium-linux.png differ diff --git a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Expand-Functional-Group-on-a-structure-1-chromium-linux.png b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Expand-Functional-Group-on-a-structure-1-chromium-linux.png index 8819bf99be..a48f875b94 100644 Binary files a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Expand-Functional-Group-on-a-structure-1-chromium-linux.png and b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts-snapshots/Templates---Functional-Group-Tools2-Expand-Functional-Group-on-a-structure-1-chromium-linux.png differ diff --git a/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Add-a-custom-structure-to-a--13afb--an-expanded-functional-group-and-contract-it-1-chromium-linux.png b/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Add-a-custom-structure-to-a--13afb--an-expanded-functional-group-and-contract-it-1-chromium-linux.png index d7555d9eb1..819f009df5 100644 Binary files a/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Add-a-custom-structure-to-a--13afb--an-expanded-functional-group-and-contract-it-1-chromium-linux.png and b/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Add-a-custom-structure-to-a--13afb--an-expanded-functional-group-and-contract-it-1-chromium-linux.png differ diff --git a/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Check-that-expanded-Functional-Groups-not-overlap-each-other-1-chromium-linux.png b/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Check-that-expanded-Functional-Groups-not-overlap-each-other-1-chromium-linux.png index b1679e3e58..0cbf2ac5c4 100644 Binary files a/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Check-that-expanded-Functional-Groups-not-overlap-each-other-1-chromium-linux.png and b/ketcher-autotests/tests/Templates/Functional-Groups/functional-groups.spec.ts-snapshots/Functional-Groups-Check-that-expanded-Functional-Groups-not-overlap-each-other-1-chromium-linux.png differ diff --git a/packages/ketcher-react/src/script/ui/views/components/ContextMenu/hooks/useFunctionalGroupEoc.ts b/packages/ketcher-react/src/script/ui/views/components/ContextMenu/hooks/useFunctionalGroupEoc.ts index 69c9d7dfff..0f96aeb7d7 100644 --- a/packages/ketcher-react/src/script/ui/views/components/ContextMenu/hooks/useFunctionalGroupEoc.ts +++ b/packages/ketcher-react/src/script/ui/views/components/ContextMenu/hooks/useFunctionalGroupEoc.ts @@ -1,4 +1,4 @@ -import { Action, setExpandSGroup } from 'ketcher-core'; +import { Action, setExpandMonomerSGroup } from 'ketcher-core'; import { useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { useAppContext } from 'src/hooks'; @@ -27,7 +27,7 @@ const useFunctionalGroupEoc = () => { selectedFunctionalGroups?.forEach((functionalGroup) => { action.mergeWith( - setExpandSGroup(molecule, functionalGroup.relatedSGroupId, { + setExpandMonomerSGroup(molecule, functionalGroup.relatedSGroupId, { expanded: toExpand, }), ); @@ -47,17 +47,8 @@ const useFunctionalGroupEoc = () => { ), ); }, []); - const disabled = useCallback(({ props }: Params) => { - const editor = getKetcherInstance().editor as Editor; - const molecule = editor.render.ctab.molecule; - return Boolean( - props?.functionalGroups?.every((functionalGroup) => - functionalGroup?.relatedSGroup.isNotContractible(molecule), - ), - ); - }, []); - return [handler, hidden, disabled] as const; + return [handler, hidden] as const; }; export default useFunctionalGroupEoc; diff --git a/packages/ketcher-react/src/script/ui/views/components/ContextMenu/menuItems/FunctionalGroupMenuItems.tsx b/packages/ketcher-react/src/script/ui/views/components/ContextMenu/menuItems/FunctionalGroupMenuItems.tsx index 6655a3745c..267387ac83 100644 --- a/packages/ketcher-react/src/script/ui/views/components/ContextMenu/menuItems/FunctionalGroupMenuItems.tsx +++ b/packages/ketcher-react/src/script/ui/views/components/ContextMenu/menuItems/FunctionalGroupMenuItems.tsx @@ -10,18 +10,14 @@ import { const FunctionalGroupMenuItems: FC< MenuItemsProps > = (props) => { - const [ - handleExpandOrContract, - ExpandOrContractHidden, - ExpandOrContractDisabled, - ] = useFunctionalGroupEoc(); + const [handleExpandOrContract, ExpandOrContractHidden] = + useFunctionalGroupEoc(); const handleRemove = useFunctionalGroupRemove(); return ( <> ExpandOrContractDisabled(params)} hidden={(params) => ExpandOrContractHidden(params, true)} onClick={(params) => handleExpandOrContract(params, true)} > @@ -29,7 +25,6 @@ const FunctionalGroupMenuItems: FC< ExpandOrContractDisabled(params)} hidden={(params) => ExpandOrContractHidden(params, false)} onClick={(params) => handleExpandOrContract(params, false)} >